IonMorphNet: Generalizable Learning of Ion Image Morphologies for Peak Picking in Mass Spectrometry Imaging
Official repository of the CVPR 2026 Workshop paper "IonMorphNet: Generalizable Learning of Ion Image Morphologies for Peak Picking in Mass Spectrometry Imaging".
Philipp Weigand*, Niels Nawrot*, Nikolas Ebert, Carsten Hopf & Oliver Wasenmüller | *Equal Contribution
CeMOS - Research and Transfer Center, University of Applied Sciences Mannheim
git clone https://github.com/CeMOS-IS/IonMorphNet.git
cd IonMorphNetconda create -n ionmorphnet python=3.9.23
conda activate ionmorphnetpip install -r requirements.txt
pip install -e .The package expects MSI datasets in the following structure:
IonMorphNet
└── data
└── datasets
├── <dataset-id-1>
│ ├── <dataset-id-1>.imzML
│ └── <dataset-id-1>.ibd
├── <dataset-id-2>
│ ├── <dataset-id-2>.imzML
│ └── <dataset-id-2>.ibd
└── ...
We provide our created morphology labels for each dataset at this path:
data/labeling/csv/<dataset-id>.csv
You can find the corresponding dataset under
https://metaspace2020.org/dataset/<dataset-id>
Run the following command and specify the validation and test split with
--val_files and --test_files. All remaining files will be used for training. The following split was used for our trainings.
python -m msianalyzer.training.train_msi_classifier \
--timm_model "convnextv2_tiny" \
--val_files "2017-09-25_19h48m56s.imzML,2023-07-04_10h26m22s.imzML,2025-05-20_08h21m56s.imzML,2025-06-18_03h24m09s.imzML,2025-09-24_18h51m29s.imzML" \
--test_files "2016-10-01_12h21m40s.imzML,2016-10-01_12h27m29s.imzML,2016-10-25_14h30m16s.imzML,2017-03-10_19h59m17s.imzML,2017-03-17_17h20m49s.imzML"Make sure to provide the mSCF1 evaluation datasets (GBM, CAC) with corresponding segmentation masks in the following folder structure:
├── IonMorphNet
├── data
├── mSCF1_Evaluation_Datasets
├── dataset1
│ ├── masks
│ │ ├── file1_mask.npy
│ │ ├── file2_mask.npy
│ │ └── ...
│ ├── file1.imzML
│ ├── file1.ibd
│ ├── file2.imzML
│ ├── file2.ibd
│ └── ...
├── cac
│ ├── masks
│ │ ├── 40TopL_mask.npy
│ │ ├── 40TopL_mask.npy
│ │ └── ...
│ ├── 40TopL.imzML
│ ├── 40TopL.ibd
│ └── ...
└── ...
To use our trained ConvNeXt-V2-tiny model, download it from here and extract the zip in the IonMorphNet/data/models/ directory. Then run the Peak Picking evaluation:
python -m msianalyzer.evaluate.evaluate_mSCF1_peak_quality \
--run-dir 20260204-164840_convnextv2_tiny \
--informative-classes structured,negative,localized
where --run-dir corresponds to the specific model foldername in IonMorphNet/data/models/ that should be used for evaluation. The results will be stored within that folder in /evaluation_mSCF1/<date-time>/evaluation_results.csv.
python -m msianalyzer.evaluate.classify_ion_images \
--run-dir <model_folder_name> \
--imzml-folderpath "/path/to/folder/with/imzML/files"
where --run-dir corresponds to the model foldername in IonMorphNet/data/models/ that should be used. The results will be stored within that folder in /morphology_predictions. --imzml-folderpath corresponds to the folder that contains the imzML file(s) that should be anaylzed.
No datasets are found. Verify that:
- dataset files are located at
IonMorphNet/data/datasets/<dataset-id>/ - each dataset directory contains two files:
<dataset-id>.imzML<dataset-id>.ibd
- the file extension is exactly
.imzMLwith the correct capitalization - each dataset has a matching CSV file in
IonMorphNet/data/labeling/csv/ - the CSV filename exactly matches the dataset name
If you use this code in your research, please cite our paper.
@inproceedings{weigand2026ionmorphnet,
title={IonMorphNet: Generalizable Learning of Ion Image Morphologies for Peak Picking in Mass Spectrometry Imaging},
author={Weigand, Philipp and Nawrot, Niels and Ebert, Nikolas and Hopf, Carsten and Wasenm{\"u}ller, Oliver},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
year={2026}
}