Poster No:
1841
Submission Type:
Late-Breaking Abstract Submission
Authors:
Johan Medrano1, James Bonaiuto2, Yulia Bezsudnova1, Suvadeep Maiti3, Arthur Mitchell1, Tim Tierney4, Peter Zeidman5, Yael Balbastre1
Institutions:
1University College London, London, Greater London, 2CNRS, Lyon, Rhone-Alpes, 3University College London, London, London, 4University College London, London, United Kingdom, 5University College London, London, England
First Author:
Co-Author(s):
Tim Tierney
University College London
London, United Kingdom
Late Breaking Reviewer(s):
Jean Chen
Rotman Research Institute, Baycrest
Toronto, Ontario
Introduction:
Statistical Parametric Mapping (SPM) is a collection of methods for the analysis of multimodal neuroimaging data, as well as open source software (Friston, 1994; Ashburner, 2012; Tierney, 2025). SPM has been one of the workhorses of neuroimaging analysis for the past 30 years, and has been integral to the standardisation of neuroimaging file formats. While written in MATLAB (Moler & Little, 2020), SPM is distributed in a compiled form that can be used without a MATLAB license. However, interoperability with other analysis suites is restricted to information serialized in files – there is currently no way of sharing in-memory objects, and low-level functions are not exposed in the compiled package. Here, we introduce a new package, spm-python, that exposes the complete SPM interface to Python programs. These bindings allow users to develop novel analyses and algorithms in Python, while leveraging the thoroughly tested routines available in SPM. Importantly, this package does not require a MATLAB license.
Methods:
The Python API for MATLAB provides an interface to start and stop a MATLAB engine, implements a matlab-compatible array type in python, and exposes native functions through a pythonic interface. While it maps some MATLAB types to and from native Python types (cell to list, struct to dict), advanced types are unsupported. On the other hand, the MATLAB SDK allows external packages to be compiled and used without a license. These packages can be run through Python, but suffer from the same type limitations and do not come with a pythonic interface.
spm-python alleviates these issues with four key features:
1. It sets up, initializes and manages the Python runtime.
2. It automatically parses the SPM library and generates Python wrappers that mimic and document its behaviour in a pythonic way.
3. It serializes and deserializes MATLAB types into objects that are supported by the Python API for MATLAB.
4. Python-side, it implements a type system that feels natural to both Python and MATLAB users. Furthermore, it allows objects to be implicitly resized and allocated, thereby greatly easing the translation of SPM batch jobs from MATLAB to Python.
Results:
a) Easy adaptation of Matlab code to Python
spm-python aims to ease the conversion of existing MATLAB codes and examples to Python. This task is challenging due to the ability of the MATLAB engine to infer objects' type, size, and fields directly from indexing statements -- making typical MATLAB code lacking initialization statements. To this end, spm-python implements a smart type system that supports a MATLAB-style syntax, enabling existing MATLAB code to be straightforwardly translated to Python. We illustrate this system with two scripts from the SPM tutorial (Fig. 1).
b) Interoperability with existing Python neuroimaging softwares
An objective of the SPM software is to distribute the open-source implementation of tools and algorithms that accompany the peer-reviewed publications that introduced them. The Python bindings for SPM allow researchers to use in their analysis pipeline the standard and validated implementations of methods that are distributed through SPM, without the need to reimplement them. This interoperability between different neuroimaging suites is facilitated by common file formats, and can be easily extended to accommodate the conversion of non-standard data types between software packages. In Fig. 2, we demonstrate that SPM objects can be converted to MNE (Gramfort, 2013) in-memory.


Conclusions:
We have introduced Python bindings for the SPM software. This novel interface allows one to run SPM jobs and analyses in Python, and inter-operate with other analysis suites. We hope that our initiative will connect the Python and MATLAB neuroimaging communities and help reuse, validate, and compare neuroimaging tools across languages. A first official release of the spm-python package – distributed open-source at https://github.com/spm/spm-python – is expected in April 2025.
Modeling and Analysis Methods:
Bayesian Modeling 2
Methods Development
Neuroinformatics and Data Sharing:
Informatics Other 1
Novel Imaging Acquisition Methods:
BOLD fMRI
EEG
MEG
Keywords:
Data analysis
Design and Analysis
FUNCTIONAL MRI
Informatics
MEG
Modeling
Open-Source Code
Open-Source Software
Statistical Methods
STRUCTURAL MRI
1|2Indicates the priority used for review
By submitting your proposal, you grant permission for the Organization for Human Brain Mapping (OHBM) to distribute your work in any format, including video, audio print and electronic text through OHBM OnDemand, social media channels, the OHBM website, or other electronic publications and media.
I accept
The Open Science Special Interest Group (OSSIG) is introducing a reproducibility challenge for OHBM 2025. This new initiative aims to enhance the reproducibility of scientific results and foster collaborations between labs. Teams will consist of a “source” party and a “reproducing” party, and will be evaluated on the success of their replication, the openness of the source work, and additional deliverables. Click here for more information.
Propose your OHBM abstract(s) as source work for future OHBM meetings by selecting one of the following options:
I am submitting this abstract as an original work to be reproduced. I am available to be the “source party” in an upcoming team and consent to have this work listed on the OSSIG website. I agree to be contacted by OSSIG regarding the challenge and may share data used in this abstract with another team.
Please indicate below if your study was a "resting state" or "task-activation” study.
Other
Healthy subjects only or patients (note that patient studies may also involve healthy subjects):
Healthy subjects
Was this research conducted in the United States?
No
Were any human subjects research approved by the relevant Institutional Review Board or ethics panel?
NOTE: Any human subjects studies without IRB approval will be automatically rejected.
Not applicable
Were any animal research approved by the relevant IACUC or other animal research panel?
NOTE: Any animal studies without IACUC approval will be automatically rejected.
Not applicable
Please indicate which methods were used in your research:
Functional MRI
EEG/ERP
MEG
Which processing packages did you use for your study?
SPM
Provide references using APA citation style.
Ashburner, J. (2012). SPM: a history. Neuroimage, 62(2), 791-800.
Friston, K. J., Holmes, A. P., Worsley, K. J., Poline, J. P., Frith, C. D., & Frackowiak, R. S. (1994). Statistical parametric maps in functional imaging: a general linear approach. Human brain mapping, 2(4), 189-210.
Gramfort, A., Luessi, M., Larson, E., Engemann, D. A., Strohmeier, D., Brodbeck, C., ... & Hämäläinen, M. (2013). MEG and EEG data analysis with MNE-Python. Frontiers in Neuroinformatics, 7, 267.
Moler, C., & Little, J. (2020). A history of MATLAB. Proceedings of the ACM on Programming Languages, 4(HOPL), 1-67.
Tierney TM, Seedat Z, St Pier K, Mellor S, Barnes GR. Adaptive multipole models of optically pumped magnetometer data. Hum Brain Mapp. 2024 Mar;45(4):e26596. doi: 10.1002/hbm.26596. PMID: 38433646; PMCID: PMC10910270.
Tierney, T. M., Alexander, N. A., Avila, N. L., Balbastre, Y., Barnes, G., Bezsudnova, Y., ... & Zeidman, P. (2025). SPM 25: open source neuroimaging analysis software. arXiv preprint arXiv:2501.12081.
No