A Dockerized R application for performing post-hoc feature selection on Mass Spectrometry Imaging (MSI) data using Cardinal::spatialShrunkenCentroids.
- Post-hoc Feature Selection: Identifies specific m/z values that differentiate spatial clusters.
- Niivue & M2aia Compatible: Outputs uncompressed (raw) NRRD files that load perfectly in standard volumetric viewers.
- Cross-Version Support: Poly-compatible with Cardinal 3.4.x (Bioconductor containers) and 3.12.x+.
- Rich Metadata: Embeds analysis parameters (r, s, AIC, BIC, Sparsity) and timestamps directly into NRRD headers.
docker build -t spatial-shrunken-centroids .Mount your project directory to /data and provide paths relative to that mount.
docker run --rm -v "C:/path/to/data:/data" spatial-shrunken-centroids \
--input /data/intensity_nrrds \
--labels /data/mask.nrrd \
--output /data/results.nrrd \
--s 2 \
--r 1--input: Directory containing one .nrrd file per m/z (filenames should be numeric m/z values).--labels: Path to the segmentation mask .nrrd file (labels should be integers, 0 reserved for background).--output: Path for the predicted labels NRRD.--s: Sparsity threshold (higher values = more sparse feature selection).--r: Spatial smoothing radius.
results.nrrd: The predicted cluster labels (16-bit unsigned integer).probabilities_cluster_*.nrrd: Probability maps for each cluster (32-bit float).importance.csv: Table of features ranked by their importance to each cluster.- NRRD Headers: Contains metadata for reproducibility:
Cardinal_SSC_r: Radius used.Cardinal_SSC_s: Sparsity used.Cardinal_SSC_Sparsity: Fraction of features removed.Cardinal_SSC_AIC/BIC: Model quality metrics.
- NRRD Filenames: Files in the
--inputdirectory should be named with their m/z value (e.g.,801.45.nrrd). - Dimensions: All input NRRDs and the label mask must have identical X, Y (and Z) dimensions.
- Orientation: Assumes standard MSI orientation (X varies fastest).
This tool uses Cardinal::spatialShrunkenCentroids with "adaptive" weights. It is designed to mirror the interface of spatialKmeansDocker to facilitate seamless multi-stage pipelines.