mean-intensity-aggregation
Summary
Compute mean intensity values across all pixels in a mass spectrometry imaging (MSI) dataset by aggregating intensity arrays at each unique m/z value. This workflow step produces a representative mean spectrum and optionally exports it for downstream ROI analysis and metabolite annotation.
When to use
Apply this skill after importing imzML or vendor-specific MSI data into napari and visualizing the raw spectral dataset. Use it when you need a global intensity profile across the entire MSI experiment to identify dominant m/z peaks, normalize intensity ranges, or generate a reference spectrum for region-of-interest (ROI) comparisons.
When NOT to use
- Input MSI data has not been imported and loaded into the napari environment—perform data import first.
- You require intensity values for a single pixel or localized region only—use ROI selection instead.
- The dataset is already pre-aggregated into a mean spectrum; recalculating would be redundant.
Inputs
- Imported MSI spectral dataset in imzML or vendor-specific format
- m/z values and intensity arrays from all pixels/samples
- Optional pre-processing parameters (noise reduction %, normalization method, hotspot removal quantile)
Outputs
- Mean spectrum: m/z vs. mean intensity table
- CSV or HDF5 export file of aggregated mean intensities
- Mean spectrum visualization plot (optional)
- Image view of mean intensity distribution (optional)
How to apply
Load the imported MSI spectral data (imzML or converted centroid format) into the MSI-Explorer napari plugin environment. Extract m/z values and their corresponding intensity arrays for all spectra in the dataset. For each unique m/z value across all pixels/samples, calculate the arithmetic mean of intensities at that m/z. Optionally apply pre-processing steps (noise reduction as a percentage threshold, normalization methods such as TIC, RMS, or reference peak, and hotspot removal at a quantile threshold like 99.9%) before mean calculation. Aggregate results into a structured m/z vs. mean intensity table and export as CSV or HDF5 for compatibility with downstream ROI analysis and annotation workflows.
Related tools
- napari (Plugin framework environment for loading, visualizing, and processing MSI spectral data) — https://github.com/napari/napari
- MSI-Explorer (napari plugin that implements mean intensity calculation as a workflow step following data import and visualization) — https://github.com/MMV-Lab/MSI-Explorer
- Python (Programming language for arithmetic aggregation and export of mean intensity arrays)
Evaluation signals
- Output table contains all unique m/z values present in the original dataset with no missing entries
- Each mean intensity value is the arithmetic average of intensities at that m/z across all pixels; spot-check by manual calculation on a subset
- Output file is valid CSV or HDF5 and is compatible with downstream ROI analysis and annotation tools
- Mean spectrum plot shows expected dominant peaks and relative intensity relationships consistent with the raw data distribution
- When pre-processing is applied, mean intensities reflect the specified noise reduction percentage, normalization method, and hotspot removal threshold
Limitations
- Profile mode MSI data must be converted to centroid mode before processing; the plugin prompts for this conversion but cannot be circumvented
- Mean intensity calculation assumes all pixels have comparable sampling; highly uneven sampling or missing pixels may skew the aggregate
- Pre-processing steps (noise reduction, normalization, hotspot removal) are applied before aggregation; the order and parameters chosen will significantly affect the final mean spectrum
- Export format (CSV vs. HDF5) must be chosen appropriately for downstream tools; some tools may require specific formats
Evidence
- [other] MSI-Explorer implements mean intensity calculation as a workflow step that processes imported MSI data following data import and visualization stages, operating within the napari plugin framework.: "MSI-Explorer implements mean intensity calculation as a workflow step that processes imported MSI data following data import and visualization stages, operating within the napari plugin framework."
- [other] For each unique m/z value across all spectra, calculate the arithmetic mean of intensities at that m/z across all pixels/samples.: "For each unique m/z value across all spectra, calculate the arithmetic mean of intensities at that m/z across all pixels/samples."
- [other] Aggregate results into a structured table (m/z vs. mean intensity) and save as a CSV or HDF5 file compatible with downstream ROI analysis and annotation workflows.: "Aggregate results into a structured table (m/z vs. mean intensity) and save as a CSV or HDF5 file compatible with downstream ROI analysis and annotation workflows."
- [readme] To calculate the mean spectrum, click on
Show true mean spectrum. Clicking Show image will create an image view of the currently plotted data: "To calculate the mean spectrum, click on Show true mean spectrum. Clicking Show image will create an image view"
- [readme] After pre-processing steps are chosen, click
Execute and Show true mean spectrum to calculate the mean intensity.: "After pre-processing steps are chosen, click Execute and Show true mean spectrum to calculate the mean intensity."
1---2name: mean-intensity-aggregation3description: Use when after importing imzML or vendor-specific MSI data into napari and visualizing the raw spectral dataset.4license: CC-BY-4.05---67# mean-intensity-aggregation89## Summary1011Compute mean intensity values across all pixels in a mass spectrometry imaging (MSI) dataset by aggregating intensity arrays at each unique m/z value. This workflow step produces a representative mean spectrum and optionally exports it for downstream ROI analysis and metabolite annotation.1213## When to use1415Apply this skill after importing imzML or vendor-specific MSI data into napari and visualizing the raw spectral dataset. Use it when you need a global intensity profile across the entire MSI experiment to identify dominant m/z peaks, normalize intensity ranges, or generate a reference spectrum for region-of-interest (ROI) comparisons.1617## When NOT to use1819- Input MSI data has not been imported and loaded into the napari environment—perform data import first.20- You require intensity values for a single pixel or localized region only—use ROI selection instead.21- The dataset is already pre-aggregated into a mean spectrum; recalculating would be redundant.2223## Inputs2425- Imported MSI spectral dataset in imzML or vendor-specific format26- m/z values and intensity arrays from all pixels/samples27- Optional pre-processing parameters (noise reduction %, normalization method, hotspot removal quantile)2829## Outputs3031- Mean spectrum: m/z vs. mean intensity table32- CSV or HDF5 export file of aggregated mean intensities33- Mean spectrum visualization plot (optional)34- Image view of mean intensity distribution (optional)3536## How to apply3738Load the imported MSI spectral data (imzML or converted centroid format) into the MSI-Explorer napari plugin environment. Extract m/z values and their corresponding intensity arrays for all spectra in the dataset. For each unique m/z value across all pixels/samples, calculate the arithmetic mean of intensities at that m/z. Optionally apply pre-processing steps (noise reduction as a percentage threshold, normalization methods such as TIC, RMS, or reference peak, and hotspot removal at a quantile threshold like 99.9%) before mean calculation. Aggregate results into a structured m/z vs. mean intensity table and export as CSV or HDF5 for compatibility with downstream ROI analysis and annotation workflows.3940## Related tools4142- **napari** (Plugin framework environment for loading, visualizing, and processing MSI spectral data) — https://github.com/napari/napari43- **MSI-Explorer** (napari plugin that implements mean intensity calculation as a workflow step following data import and visualization) — https://github.com/MMV-Lab/MSI-Explorer44- **Python** (Programming language for arithmetic aggregation and export of mean intensity arrays)4546## Evaluation signals4748- Output table contains all unique m/z values present in the original dataset with no missing entries49- Each mean intensity value is the arithmetic average of intensities at that m/z across all pixels; spot-check by manual calculation on a subset50- Output file is valid CSV or HDF5 and is compatible with downstream ROI analysis and annotation tools51- Mean spectrum plot shows expected dominant peaks and relative intensity relationships consistent with the raw data distribution52- When pre-processing is applied, mean intensities reflect the specified noise reduction percentage, normalization method, and hotspot removal threshold5354## Limitations5556- Profile mode MSI data must be converted to centroid mode before processing; the plugin prompts for this conversion but cannot be circumvented57- Mean intensity calculation assumes all pixels have comparable sampling; highly uneven sampling or missing pixels may skew the aggregate58- Pre-processing steps (noise reduction, normalization, hotspot removal) are applied before aggregation; the order and parameters chosen will significantly affect the final mean spectrum59- Export format (CSV vs. HDF5) must be chosen appropriately for downstream tools; some tools may require specific formats6061## Evidence6263- [other] MSI-Explorer implements mean intensity calculation as a workflow step that processes imported MSI data following data import and visualization stages, operating within the napari plugin framework.: "MSI-Explorer implements mean intensity calculation as a workflow step that processes imported MSI data following data import and visualization stages, operating within the napari plugin framework."64- [other] For each unique m/z value across all spectra, calculate the arithmetic mean of intensities at that m/z across all pixels/samples.: "For each unique m/z value across all spectra, calculate the arithmetic mean of intensities at that m/z across all pixels/samples."65- [other] Aggregate results into a structured table (m/z vs. mean intensity) and save as a CSV or HDF5 file compatible with downstream ROI analysis and annotation workflows.: "Aggregate results into a structured table (m/z vs. mean intensity) and save as a CSV or HDF5 file compatible with downstream ROI analysis and annotation workflows."66- [readme] To calculate the mean spectrum, click on `Show true mean spectrum`. Clicking `Show image` will create an image view of the currently plotted data: "To calculate the mean spectrum, click on `Show true mean spectrum`. Clicking `Show image` will create an image view"67- [readme] After pre-processing steps are chosen, click `Execute` and `Show true mean spectrum` to calculate the mean intensity.: "After pre-processing steps are chosen, click `Execute` and `Show true mean spectrum` to calculate the mean intensity."