A Python package for converting SCiLS Lab files (.slx) to open-standard imzML files for mass spectrometry imaging (MSI) data analysis.
This package reads proprietary SCiLS Lab files (using API clients) and exports regions as accessible imzML files that are compatible with M²aia and other open-source MSI analysis tools. The converter supports both continuous centroid and profile spectrum modes.
- Multi-format Export: Converts SCiLS Lab regions to imzML format with continuous profile/centroid spectrum support
- Additional Outputs: Exports spot images, optical images, and region masks as NRRD files
- Flexible Configuration: JSON-based export configuration for customizing output
- M²aia Compatibility: Generated imzML files are fully compatible with M²aia software
- Batch Processing: Process multiple regions and datasets in a single run
- Python ≥ 3.6
- SCiLS Lab Python API (Bruker Daltonics)
git clone <repository-url>
cd slx2imzml
pip install -e .The package automatically installs the following dependencies:
numpy- Numerical computationspandas- Data manipulationjinja2- XML template renderingmatplotlib- Plotting utilitiesSimpleITK- Medical image processingscilslab- SCiLS Lab API integration
slx2imzml export_instructions.jsonCreate a JSON configuration file to specify export parameters:
{
"description": "Export configuration for SCiLS to imzML conversion",
"slice_thickness": 10,
"data_exports": [
{
"filename": "path/to/your/file.slx",
"final_features": [],
"final_regions": [["Region1", "region_id_1"]],
"final_spot_images": ["normalization1", "normalization2"],
"final_optical_images": ["optical1"],
"final_labels": [],
"final_regions_as_labels": []
}
]
}For each processed region, the tool generates:
- imzML Files:
region_name.imzMLandregion_name.ibd- imzML format files - NRRD Files:
region_name.mask.nrrd- Region mask as multilabel imageregion_name.spot_image_name.nrrd- Spot images (e.g., normalizations)region_name.optical_image_name.nrrd- Optical reference images
The naming is based on the regions_name defined in SCiLS Lab.
- Continuous Profile/Centroid: Full spectrum data export (when
final_featuresis empty) - Continuous Centroid: Feature-based export with specified m/z values
The converter preserves spatial information including:
- Pixel spacing in micrometers
- Origin coordinates
- Direction matrix for proper spatial positioning
- Region Processing: Extracts spectral data for each specified region
- Feature Selection: Applies feature lists or exports full spectra
- Spatial Mapping: Maintains pixel-to-coordinate transformations
- Format Conversion: Generates imzML/ibd file pairs with proper metadata
slx2imzml/
├── __init__.py # Package initialization
├── ImzMLIO.py # Main conversion logic
├── ImzMLWriter.py # imzML file writing utilities
├── ScilsLabFileHelper.py # SCiLS Lab data access helpers
└── imzMLTemplate.j2 # Jinja2 template for imzML XML
This project is developed at Hochschule Mannheim in connection with the M²aia project for open-source mass spectrometry imaging analysis.
MIT License - See LICENSE file for details.
- M²aia - Open-source software for mass spectrometry imaging
- imzML - Open standard for mass spectrometry imaging data
For questions and issues, please contact the author or visit the M²aia project website.