Backend API overview
Expand a topic to find the main functions and classes for that task. Each topic page covers arguments, array layouts, and examples in more detail.
Image I/O · Open or load a spectral image
- Image I/O reference
open_image()inspects metadata and lets you read selected time points or Z planes.load_image()reads pixels into aSpectralImage.SpectralImageReaderdescribes the interface shared by CZI and OME-TIFF readers.download_cos7_data()fetches the example acquisitions.
Image containers · Slice, display, reshape, and save images
- Image containers reference
SpectralImagekeeps a loaded image, its axes, and detector and spatial metadata together.slice()selects a plane from a loaded image.to_rgb()creates an RGB preview.unfold()prepares a pixel-by-channel matrix.save_ome_tiff()exports an image with its metadata.
UnfoldedImagerestores fitted spectra or component maps to the source image layout.
Spectra · Prepare and reuse reference signatures
- Spectra reference
Spectrumholds a single signature with optional wavelength coordinates.SpectrumCollectionholds several component spectra on a shared grid.from_spectra()groups aligned signatures.save_json()andload_json()exchange reusable reference sets.
Unmixing and spectral selection · Fit components and choose starting spectra
- Unmixing and spectral selection reference
positive_least_squares()fits abundances with fixed reference spectra.mcr_als()refines abundances and spectra together.select_analysis_pixels()builds a pool of usable pixels while retaining their original indices.essential_spectral_pixels()andunique_profiles()help select starting spectra.spectral_uniqueness_map()maps spectral distinctness across an image.
Simulation · Generate detector images with known components
- Simulation reference
load_offline_emission_spectrum()loads a bundled FPbase curve.SpectralDetectorintegrates curves over detector bands.simulate_linear_mixture()mixes aligned component spectra into a clean image.simulate_noisy_image()samples emission curves, mixes components, and adds count noise.
Evaluation · Inspect fit errors and measure recovery
- Evaluation reference
- Without ground truth
reconstruction_error_maps()shows where the prediction differs from the measured image.residual_pca_from_residuals()gives spatial scores and spectral loadings for patterns in the residuals.compare_spectra()compares spectral shapes between fits.
- With known ground truth
evaluate_factors()summarizes how well the fit recovers the known spectra and abundances.concentration_error_maps()maps the error for each recovered component.
Source code for contributors
Browse implementation modules on GitHub
- Image readers and format adapters:
readers.pyandio.py. - Spatial simulation: scene geometry, sampling and rendering, and point spread functions.
- Backend evaluation: evaluation modules.