Subir archivos a "/"

This commit is contained in:
2026-08-13 01:34:52 +02:00
parent 3ee3de31c3
commit fa75917e72
+12 -11
View File
@@ -2,7 +2,7 @@
title: "A scalable deep learning workflow for mass spectrometry imaging: benchmarking Julia-Python hybrid processing across multi-instrument datasets" title: "A scalable deep learning workflow for mass spectrometry imaging: benchmarking Julia-Python hybrid processing across multi-instrument datasets"
bibliography: zotero.bib bibliography: zotero.bib
abstract: | abstract: |
Mass spectrometry imaging (MSI) generates terabyte-scale datasets whose analysis is increasingly bottlenecked by software rather than instrumentation. Most MSI processing pipelines are written in interpreted languages whose memory and speed limits scale poorly with next-generation instruments, and the deep learning ecosystem needed for modern unsupervised analysis lives almost entirely in Python. We present an open-source hybrid Julia-Python workflow that resolves this "two-language problem": a Julia engine performs all high-throughput preprocessing — memory-mapped imzML parsing, peak picking, ion image extraction, TrIQ normalization, and PNG export of every ion map in a single pass — and hands a clean, file-based corpus to a Python self-supervised (SimCLR) convolutional encoder for representation learning and clustering. We benchmark the Julia preprocessing stage on an equalized per-stage workload (imzML load and one ion slice at each dataset's reference *m/z*) against Cardinal (R/Bioconductor) and MALDIquant (R) on seven public datasets spanning 0.07–4.4 GB (LD-LTP, AP-SMALDI, MALDI, DESI), covering both centroid and profile acquisitions. Under this equalized workload, the Julia engine generates an ion slice two orders of magnitude faster than Cardinal on every dataset (0.0001–0.32 s vs 6.3–19.5 s) and materially faster than MALDIquant, while its memory-mapped loader keeps peak load RAM at only 7–84 MB — lower than Cardinal's lazy loader (~120 MB) on all seven datasets — and it completes the additional normalization and export steps within the same memory envelope, all orchestrated by a single reproducible entry point. The complete environment is containerized with Docker and released under a permissive license, so the entire analysis — from raw imzML to trained embeddings — is fully reproducible on any hardware. As a demonstration of the workflow's biological utility, we apply it to *Datura innoxia* leaves and roots (2.0 GB and 2.5 GB): self-supervised segmentation of the leaf recovers five spatially coherent metabolic domains and of the root six, co-localizing the tropane alkaloid biosynthetic pathway in the root and its transport intermediates in the leaf vasculature. Mass spectrometry imaging (MSI) generates terabyte-scale datasets whose analysis is increasingly bottlenecked by software rather than instrumentation. Most MSI processing pipelines are written in interpreted languages whose memory and speed limits scale poorly with next-generation instruments, and the deep learning ecosystem needed for modern unsupervised analysis lives almost entirely in Python. We present an open-source hybrid Julia-Python workflow that resolves this "two-language problem": a Julia engine performs all high-throughput preprocessing — memory-mapped imzML parsing, peak picking, ion image extraction, TrIQ normalization, and PNG export of every ion map in a single pass — and hands a clean, file-based corpus to a Python self-supervised (SimCLR) convolutional encoder for representation learning and clustering. We benchmark the Julia preprocessing stage on an equalized per-stage workload (imzML load and one ion slice at each dataset's reference *m/z*) against Cardinal (R/Bioconductor) and MALDIquant (R) on seven public datasets spanning 0.07–4.4 GB (LD-LTP, AP-SMALDI, MALDI, DESI), covering both centroid and profile acquisitions. Under this equalized workload, the Julia engine generates an ion slice two orders of magnitude faster than Cardinal on every dataset (0.0001–0.32 s vs 6.3–19.5 s) and materially faster than MALDIquant, while its memory-mapped loader keeps peak load RAM at only 7–84 MB — lower than Cardinal's lazy loader (~120 MB) on all seven datasets — and it completes the additional normalization and export steps within the same memory envelope, all orchestrated by a single reproducible entry point. The complete environment is containerized with Docker and released under a permissive license, so the entire analysis — from raw imzML to trained embeddings — is fully reproducible on any hardware. As a demonstration of the workflow's biological utility, we apply it to *Datura innoxia* leaves and roots (2.0 GB and 2.5 GB): self-supervised segmentation of the leaf recovers five spatially coherent metabolic domains and of the root three, co-localizing the tropane alkaloid biosynthetic intermediates and their transport products across the two tissues.
keywords: mass spectrometry imaging, Julia language, Python, hybrid pipeline, benchmark, peak RAM, reproducibility, Docker, deep learning, SimCLR, contrastive learning, spatial metabolomics keywords: mass spectrometry imaging, Julia language, Python, hybrid pipeline, benchmark, peak RAM, reproducibility, Docker, deep learning, SimCLR, contrastive learning, spatial metabolomics
--- ---
@@ -20,7 +20,7 @@ To demonstrate the biological utility of the workflow, we acquired an MSI datase
## Multi-Dataset Benchmarking ## Multi-Dataset Benchmarking
To evaluate the scalability and robustness of the Julia-Python preprocessing pipeline, we assembled a diverse collection of seven publicly available MSI datasets covering a range of file sizes (0.07--4.4 GB), ionization sources, mass analyzers, and biological matrices (Table \ref{tab:datasets}). The datasets comprise both centroid and profile acquisitions; all were processed using the same pipeline configuration described in Section \ref{sec:julia_preprocessing}. ROI masks derived from the optical image were applied wherever a tissue reference was available — the *Datura* leaf, the human colon, and the three mouse tissues — restricting peak picking to pixels inside the tissue; the datasets without an optical reference (the *Datura* root and San Pedro) were processed without a mask. Peaks were then filtered using the default intensity threshold of 2\% of the base peak. To evaluate the scalability and robustness of the Julia-Python preprocessing pipeline, we assembled a diverse collection of seven publicly available MSI datasets covering a range of file sizes (0.07--4.4 GB), ionization sources, mass analyzers, and biological matrices (Table \ref{tab:datasets}). The datasets comprise both centroid and profile acquisitions; all were processed using the same pipeline configuration described in Section \ref{sec:julia_preprocessing}. ROI masks derived from the optical image were applied wherever a tissue reference was available — the *Datura* leaf and root, the human colon, and the three mouse tissues — restricting peak picking to pixels inside the tissue; only San Pedro, which lacks an optical reference, was processed without a mask. Peaks were then filtered using the default intensity threshold of 2\% of the base peak.
\begin{table}[htbp] \begin{table}[htbp]
\centering \centering
@@ -45,7 +45,6 @@ All computational analyses — the high-performance data extraction in Julia, th
Reproducibility is a first-class design requirement of the workflow. The entire environment — Julia package set, Python virtual environment with pinned dependencies, R/Bioconductor stack, and system tools — is codified in a Docker image. Because MSI software stacks are notoriously version-sensitive (a change in a peak-picking or normalization library can silently alter every downstream result), the container pins all package versions and orchestrates the seven pipeline stages (Section \ref{sec:pipeline}) with a single entry point, so the analysis can be reproduced bit-for-bit on any machine with Docker, independent of the host operating system or pre-installed software. This containerized approach follows the reproducibility recommendations of the SMART protocol [@xi_smart_2023] and the MIAMSIE guidelines for metabolomics data and metadata [@gustafsson_balancing_2018]; we additionally adopt the REFORMS checklist for reporting machine learning in the life sciences [@kapoor_reforms_2024], disclosing model architecture, hyperparameters, data processing, and all evaluation metrics in this manuscript and the repository. The workflow is released as open source under the MIT License, in keeping with the open-science philosophy that reproducible computational methods should be re-usable and auditable by the community. Reproducibility is a first-class design requirement of the workflow. The entire environment — Julia package set, Python virtual environment with pinned dependencies, R/Bioconductor stack, and system tools — is codified in a Docker image. Because MSI software stacks are notoriously version-sensitive (a change in a peak-picking or normalization library can silently alter every downstream result), the container pins all package versions and orchestrates the seven pipeline stages (Section \ref{sec:pipeline}) with a single entry point, so the analysis can be reproduced bit-for-bit on any machine with Docker, independent of the host operating system or pre-installed software. This containerized approach follows the reproducibility recommendations of the SMART protocol [@xi_smart_2023] and the MIAMSIE guidelines for metabolomics data and metadata [@gustafsson_balancing_2018]; we additionally adopt the REFORMS checklist for reporting machine learning in the life sciences [@kapoor_reforms_2024], disclosing model architecture, hyperparameters, data processing, and all evaluation metrics in this manuscript and the repository. The workflow is released as open source under the MIT License, in keeping with the open-science philosophy that reproducible computational methods should be re-usable and auditable by the community.
The manuscript is version-controlled markdown compiled to PDF with the same container, so text, figures, and tables regenerate on any machine.
## High-Performance Processing and Data Normalization (Julia) ## High-Performance Processing and Data Normalization (Julia)
\label{sec:julia_preprocessing} \label{sec:julia_preprocessing}
@@ -108,7 +107,6 @@ We implemented a Contrastive Learning (SimCLR) scheme in PyTorch [@paszke_pytorc
Model Architecture and VRAM Optimization: A custom Fully Convolutional Contrastive Network was engineered to replace standard heavy computer vision backbones. Crucially, all standard batch normalization blocks were replaced with Group Normalization (GroupNorm) layers (8 groups per layer). In datasets characterized by massive empty, zero-padded backgrounds, standard Batch Normalization calculates running statistics that become overwhelmingly biased by the blank space, leading to gradient instability and the artificial clustering of the background mask. Group Normalization computes statistics per individual image slice, mathematically neutralizing the static background and forcing the network to optimize strictly on the high-variance internal biological structures. The network concludes with an Adaptive Average Pooling layer and a 2-layer MLP to project the spatial features into a 128-dimensional latent space (Table \ref{tab:training_hyperparameters}). Model Architecture and VRAM Optimization: A custom Fully Convolutional Contrastive Network was engineered to replace standard heavy computer vision backbones. Crucially, all standard batch normalization blocks were replaced with Group Normalization (GroupNorm) layers (8 groups per layer). In datasets characterized by massive empty, zero-padded backgrounds, standard Batch Normalization calculates running statistics that become overwhelmingly biased by the blank space, leading to gradient instability and the artificial clustering of the background mask. Group Normalization computes statistics per individual image slice, mathematically neutralizing the static background and forcing the network to optimize strictly on the high-variance internal biological structures. The network concludes with an Adaptive Average Pooling layer and a 2-layer MLP to project the spatial features into a 128-dimensional latent space (Table \ref{tab:training_hyperparameters}).
To enable training on consumer-grade hardware (NVIDIA RTX 3050 Mobile, ~4 GB VRAM), a gradient accumulation strategy was employed. Rather than fitting an effective batch of 32 images simultaneously into GPU memory —which would trigger a CUDA out-of-memory error— the engine processes 8 images physically per step and accumulates gradients over 4 consecutive forward passes before executing a single optimizer update, as described in the Hugging Face documentation [@huggingface_gradient_2025]. This is mathematically equivalent to training with a true batch size of 32 while using only a quarter of the VRAM. To enable training on consumer-grade hardware (NVIDIA RTX 3050 Mobile, ~4 GB VRAM), a gradient accumulation strategy was employed. Rather than fitting an effective batch of 32 images simultaneously into GPU memory —which would trigger a CUDA out-of-memory error— the engine processes 8 images physically per step and accumulates gradients over 4 consecutive forward passes before executing a single optimizer update, as described in the Hugging Face documentation [@huggingface_gradient_2025]. This is mathematically equivalent to training with a true batch size of 32 while using only a quarter of the VRAM.
+pxl: aunque ese ajuste de los 8 imagenes con transformacion para dar 32 a la gpu fue con la tarjeta de 4 vram, es buena idea mencionarlo aqui? o solo valdria la pena mencionar que se hace este ajuste debido a buscar encajar el analisis para computadoras de grado consumidor?
\begin{table}[htbp] \begin{table}[htbp]
\centering \centering
@@ -236,27 +234,30 @@ The spatial organization of the tropane alkaloid pathway in the leaf can therefo
\label{fig:carpet} \label{fig:carpet}
\end{figure} \end{figure}
### Root Case Study: Biosynthetic Site (k = 6) ### Root Case Study: Biosynthetic Site (k = 3)
The pipeline was applied identically to the *Datura innoxia* root dataset (2.5 GB, 21,060 pixels, 1,218 ion images). The same multi-metric sweep (k = 2--20) was applied, and under the same Davies-Bouldin-driven selection criterion used for the leaf it selects k = 6 (Davies-Bouldin optimum 0.8430 at k = 6; at this k the Calinski-Harabasz Index is 988.87 and the Silhouette Score is 0.5591), confirming that the root's metabolic architecture is distinct from the leaf's. The root segmentation places the tropane alkaloid biosynthetic machinery at its source: tropinone (*m/z* 140.17), tropine (*m/z* 142.08), cuscohygrine (*m/z* 225.92), and atropine/hyoscyamine (*m/z* 290.08) are all co-localized in a single domain, Cluster 1 (289 ions). Notably, no scopolamine signal (*m/z* 304.17) is detected in the root dataset, which is consistent with the classical model in which scopolamine is produced in the root but accumulates distally in the shoot [@schlesinger_tropane_2021]: the root is the biosynthetic site where the pathway intermediates and atropine/hyoscyamine co-reside, whereas the leaf is the accumulation site where the mature alkaloid mixture is transported. The pipeline was applied identically to the *Datura innoxia* root dataset (2.5 GB, 21,060 pixels, 858 ion images after ROI-mask filtering). The same multi-metric sweep (k = 2--20) was applied, and all three metrics agree, selecting k = 3 (Silhouette optimum 0.5916 at k = 3; Davies-Bouldin optimum 0.8518 at k = 3; Calinski-Harabasz optimum 868.21 at k = 3), confirming that the root's metabolic architecture is distinct from the leaf's. The root segmentation separates the tropane alkaloid biosynthetic pathway into its source components: tropinone (*m/z* 140.17) and tropine (*m/z* 142.08) are co-localized in one domain (Cluster 0; 270 ions), while cuscohygrine (*m/z* 225.92) and atropine/hyoscyamine (*m/z* 290.08) are co-localized in a second domain (Cluster 1; 237 ions), and a diffuse background domain (Cluster 2; 351 ions) contains the remaining signal. Notably, scopolamine (*m/z* 304.17) is absent from the root ion corpus. This is not because the ion is undetectable in the root — a signal of ~45,000 arbitrary intensity units is present in the un-masked root average spectrum at *m/z* 304.1667 — but because the peak-picking threshold of 2% of the base peak filters it out: the root spectrum is dominated by the biosynthetic precursors (the base peak is tropine, *m/z* 142.08, followed by *m/z* 124.08, *m/z* 142.00, and *m/z* 224.17), so the scopolamine channel reaches only 1.5% of the base-peak intensity and falls below the 2% cutoff. This is consistent with the classical model in which scopolamine is produced in the root but accumulates distally in the shoot [@schlesinger_tropane_2021]: the root is the biosynthetic site where the pathway intermediates and atropine/hyoscyamine dominate the total ion budget, whereas the leaf is the accumulation site where scopolamine, the mature end product, is abundant enough to pass the same threshold and drive the segmentation.
\begin{figure}[htbp] \begin{figure}[htbp]
\centering \centering
\includegraphics[width=0.85\textwidth]{Figure-root-tsne.png} \includegraphics[width=0.85\textwidth]{Figure-root-tsne.png}
\caption{t-SNE projection of the SimCLR latent space for the \textit{Datura innoxia} root (k=6), colored by cluster assignment. The tropane alkaloid biosynthetic intermediates and atropine/hyoscyamine co-localize in a single domain (Cluster 1), while no scopolamine signal is detected in the root.} \caption{t-SNE projection of the SimCLR latent space for the \textit{Datura innoxia} root (k=3), colored by cluster assignment. The tropane alkaloid biosynthetic intermediates tropinone/tropine (Cluster 0) and cuscohygrine/atropine-hyoscyamine (Cluster 1) are resolved as separate biosynthetic-site domains, while scopolamine falls below the 2\% peak-picking threshold and is excluded from the corpus.}
\label{fig:root_tsne} \label{fig:root_tsne}
\end{figure} \end{figure}
\begin{figure}[htbp] \begin{figure}[htbp]
\centering \centering
\includegraphics[width=\textwidth]{Figure-carpet-root.png} \includegraphics[width=\textwidth]{Figure-carpet-root.png}
\caption{Ion carpet of the \textit{Datura innoxia} root: the complete set of 1,218 ion images of the dataset (one per ion, at native $256\times 256$ resolution) tiled into a single mosaic rendered in viridis with the Julia preprocessing stage's native \texttt{ViridisPalette}. As for the leaf, every ion of the dataset appears in the carpet, providing a full visual index in which any tile can be mapped back to its \textit{m/z} via the sorted ion manifest produced by Stage 1.} \caption{Ion carpet of the \textit{Datura innoxia} root: the complete set of 858 ion images of the dataset (one per ion, at native $256\times 256$ resolution) tiled into a single mosaic rendered in viridis with the Julia preprocessing stage's native \texttt{ViridisPalette}. As for the leaf, every ion of the dataset appears in the carpet, providing a full visual index in which any tile can be mapped back to its \textit{m/z} via the sorted ion manifest produced by Stage 1.}
\label{fig:carpet_root} \label{fig:carpet_root}
\end{figure} \end{figure}
Quantitatively, the root recapitulates the same validation signature as the leaf. The SimCLR embeddings outperform a PCA baseline on all three metrics (Silhouette 0.4236 vs 0.2969; Davies-Bouldin 0.8430 vs 1.1723; Calinski-Harabasz 988.87 vs 805.31), and the segmentation is highly stable across seeds (mean Silhouette 0.4235 $\pm$ 0.0001; Adjusted Rand Index 0.9962). Isotope co-localization is positive (943 isotopic pairs; mean latent distance 0.6422 for isotopes vs 0.6669 for random pairs, Welch's t-test $p = 0.027$), although the effect is weaker than in the leaf, consistent with the root's more homogeneous biosynthetic metabolism. The root result demonstrates that the workflow generalizes across tissues without any parameter change: the same Julia preprocessing, the same SimCLR encoder, and the same K-selection logic produce a biologically coherent segmentation of a second, independent *Datura* tissue. Quantitatively, the root recapitulates the validation signature of the leaf. The SimCLR embeddings outperform a PCA baseline on all three metrics (Silhouette 0.4716 vs 0.2871; Davies-Bouldin 0.8518 vs 1.2417; Calinski-Harabasz 868.21 vs 626.25), and the segmentation is highly stable across seeds (mean Silhouette 0.4716 $\pm$ 0.0000; Adjusted Rand Index 1.0000). Isotope co-localization is positive but does not reach significance (624 isotopic pairs; mean latent distance 0.4591 for isotopes vs 0.4786 for random pairs, Welch's t-test $p = 0.100$), consistent with the root's more homogeneous biosynthetic metabolism and the reduced number of ions retained after mask filtering. The root result demonstrates that the workflow generalizes across tissues without any parameter change: the same Julia preprocessing, the same SimCLR encoder, and the same K-selection logic produce a biologically coherent segmentation of a second, independent *Datura* tissue.
### Human Colon Case Study: Broad-Coverage Tissue (k = 20)
To demonstrate the workflow's generality beyond the *Datura* system, the pipeline was applied identically to the human colon dataset (DESI, 69 MB, 20,022 pixels, 682 ion images after ROI-mask filtering). All three metrics select the upper bound of the tested range, returning k = 20 (Silhouette 0.7365 at k = 20; Davies-Bouldin 0.6477 at k = 20; Calinski-Harabasz 732.70 at k = 20), reflecting the architectural complexity of the tissue. The SimCLR embeddings again outperform the PCA baseline (Silhouette 0.6822 vs 0.5449; Davies-Bouldin 0.6477 vs 0.9201; Calinski-Harabasz 732.70 vs 116.33), with isotope co-localization highly significant (4,117 isotopic pairs; mean latent distance 0.4096 for isotopes vs 0.5596 for random pairs, Welch's t-test $p < 10^{-6}$) and near-identical cluster stability across seeds (mean Silhouette 0.6838 $\pm$ 0.0042; Adjusted Rand Index 0.9003). Together with the *Datura* leaf and root, the human colon case confirms that the pipeline produces biologically coherent segmentations across unrelated organisms, ionizations (LD-LTP, MALDI, DESI), and tissue architectures.
## Advantages of Contrastive Learning over Linear Decomposition ## Advantages of Contrastive Learning over Linear Decomposition
Furthermore, the superiority of the self-supervised contrastive learning approach over traditional linear methods, such as Principal Component Analysis (PCA), lies in its fundamental shift from intensity-driven variance to morphological feature extraction [@shah_msinet_2025]. To establish a fair quantitative baseline, we compared SimCLR and PCA embeddings under identical conditions: both feature sets were projected to the same dimensionality via PCA and clustered using standard k-means at the pipeline-selected k. For the leaf (k = 5), the SimCLR pipeline achieved a Silhouette Score of 0.3703, compared to the PCA baseline of 0.1641, while the Calinski-Harabasz Index rose from 351.56 to 1304.29. The Davies-Bouldin Index for SimCLR was 0.9124 versus 1.7096 for PCA, confirming that the combination of contrastive feature learning produces substantial improvements in spatial separation. Furthermore, the SimCLR embeddings exhibited exceptional stability across multiple random seeds, with a mean Silhouette Score of 0.3703 $\pm$ 0.0000 and an Adjusted Rand Index (ARI) of 0.9959 between runs, indicating that the learned representations are highly reproducible and independent of stochastic initialization. The same superiority holds for the root at its pipeline-selected k = 6 (Silhouette 0.4236 vs 0.2969; Davies-Bouldin 0.8430 vs 1.1723; Calinski-Harabasz 988.87 vs 805.31; mean Silhouette 0.4235 $\pm$ 0.0001; ARI 0.9962), showing that the advantage is not specific to a single tissue. Furthermore, the superiority of the self-supervised contrastive learning approach over traditional linear methods, such as Principal Component Analysis (PCA), lies in its fundamental shift from intensity-driven variance to morphological feature extraction [@shah_msinet_2025]. To establish a fair quantitative baseline, we compared SimCLR and PCA embeddings under identical conditions: both feature sets were projected to the same dimensionality via PCA and clustered using standard k-means at the pipeline-selected k. For the leaf (k = 5), the SimCLR pipeline achieved a Silhouette Score of 0.3703, compared to the PCA baseline of 0.1641, while the Calinski-Harabasz Index rose from 351.56 to 1304.29. The Davies-Bouldin Index for SimCLR was 0.9124 versus 1.7096 for PCA, confirming that the combination of contrastive feature learning produces substantial improvements in spatial separation. Furthermore, the SimCLR embeddings exhibited exceptional stability across multiple random seeds, with a mean Silhouette Score of 0.3703 $\pm$ 0.0000 and an Adjusted Rand Index (ARI) of 0.9959 between runs, indicating that the learned representations are highly reproducible and independent of stochastic initialization. The same superiority holds for the root at its pipeline-selected k = 3 (Silhouette 0.4716 vs 0.2871; Davies-Bouldin 0.8518 vs 1.2417; Calinski-Harabasz 868.21 vs 626.25; mean Silhouette 0.4716 $\pm$ 0.0000; ARI 1.0000), showing that the advantage is not specific to a single tissue.
While PCA relies on magnitude-dependent variance—essentially grouping ions based on their absolute 'brightness' and pixel-to-pixel correlation—it is highly sensitive to the dynamic range of the detector and often fails to resolve low-abundance metabolites that do not contribute significantly to the total variance. In contrast, the custom SimCLR architecture prioritizes the underlying spatial topographies (morphological fingerprints) of the ion images. This allows the model to project ions with vastly different absolute intensities but identical anatomical 'silhouettes'—such as a primary alkaloid and its trace-level isotopes or precursors—into adjacent coordinates within the latent space. By decoupling chemical distribution from absolute abundance, this workflow captures the structural integrity of the tissue, offering a more robust and biologically grounded segmentation that traditional linear or intensity-based algorithms cannot easily achieve. While PCA relies on magnitude-dependent variance—essentially grouping ions based on their absolute 'brightness' and pixel-to-pixel correlation—it is highly sensitive to the dynamic range of the detector and often fails to resolve low-abundance metabolites that do not contribute significantly to the total variance. In contrast, the custom SimCLR architecture prioritizes the underlying spatial topographies (morphological fingerprints) of the ion images. This allows the model to project ions with vastly different absolute intensities but identical anatomical 'silhouettes'—such as a primary alkaloid and its trace-level isotopes or precursors—into adjacent coordinates within the latent space. By decoupling chemical distribution from absolute abundance, this workflow captures the structural integrity of the tissue, offering a more robust and biologically grounded segmentation that traditional linear or intensity-based algorithms cannot easily achieve.
@@ -269,4 +270,4 @@ The complete computational environment is containerized: the Docker image pins t
The equalized benchmark against Cardinal (R/Bioconductor) and MALDIquant (R) — identical per-stage workloads on the same hardware across seven public datasets spanning 0.07 to 4.4 GB — shows that the Julia engine generates ion slices two orders of magnitude faster than Cardinal on every dataset (0.00009--0.32 s vs 6.3--19.5 s) while keeping peak load resident memory (VmRSS) at 7--84 MB, lower than Cardinal's ~120 MB and far below MALDIquant's up to 4.0 GB, and it completes the additional normalization and export steps within the same memory envelope. We report the per-stage timings transparently, including where the R ecosystem is competitive (Cardinal's eager load is faster in wall time on the larger files), and we note that MALDIquant exhausted the reference machine on the two heaviest datasets. The workflow scales from commodity laptops to GPU-equipped workstations and is fully reproducible: the containerized environment and permissive open-source license allow any researcher to rebuild the entire analysis — from raw imzML to trained embeddings and final segmentation — on any hardware. The equalized benchmark against Cardinal (R/Bioconductor) and MALDIquant (R) — identical per-stage workloads on the same hardware across seven public datasets spanning 0.07 to 4.4 GB — shows that the Julia engine generates ion slices two orders of magnitude faster than Cardinal on every dataset (0.00009--0.32 s vs 6.3--19.5 s) while keeping peak load resident memory (VmRSS) at 7--84 MB, lower than Cardinal's ~120 MB and far below MALDIquant's up to 4.0 GB, and it completes the additional normalization and export steps within the same memory envelope. We report the per-stage timings transparently, including where the R ecosystem is competitive (Cardinal's eager load is faster in wall time on the larger files), and we note that MALDIquant exhausted the reference machine on the two heaviest datasets. The workflow scales from commodity laptops to GPU-equipped workstations and is fully reproducible: the containerized environment and permissive open-source license allow any researcher to rebuild the entire analysis — from raw imzML to trained embeddings and final segmentation — on any hardware.
As a demonstration of biological utility, application of the workflow to *Datura innoxia* recovered five spatially coherent metabolic domains in the leaf and six in the root. The segmentation resolves the spatial organization of tropane alkaloid metabolism without manual annotation: the biosynthetic intermediates and atropine/hyoscyamine co-localize in the root — the biosynthetic site, where no scopolamine is detected — while the leaf co-localizes the full scopolamine envelope with atropine/hyoscyamine and 6-hydroxyhyoscyamine in a single transport domain, with the precursors tropinone, tropine, and cuscohygrine compartmentalized in three separate domains. Together, the computational benchmark, the containerized reproducibility, and the two-tissue biological case study establish the workflow as a scalable, democratized foundation for MSI analysis — lowering the memory and setup barriers that currently gate the analysis of next-generation imaging datasets in plant science and beyond. As a demonstration of biological utility, application of the workflow to *Datura innoxia* recovered five spatially coherent metabolic domains in the leaf and three in the root. The segmentation resolves the spatial organization of tropane alkaloid metabolism without manual annotation: the biosynthetic intermediates tropinone/tropine and the pathway products cuscohygrine/atropine-hyoscyamine co-localize in the root — the biosynthetic site, where scopolamine is present only below the peak-picking threshold — while the leaf co-localizes the full scopolamine envelope with atropine/hyoscyamine and 6-hydroxyhyoscyamine in a single transport domain, with the precursors tropinone, tropine, and cuscohygrine compartmentalized in three separate domains. Together, the computational benchmark, the containerized reproducibility, and the two-tissue biological case study establish the workflow as a scalable, democratized foundation for MSI analysis — lowering the memory and setup barriers that currently gate the analysis of next-generation imaging datasets in plant science and beyond.