Skip to main content

Features

Data Input

  • Support for centroid and profile data stored in imzML format:
    • Range-based ion images
    • Individual spectra
    • imzML metadata
  • Gray-scale images (ie. ion images, mask images, normalization images) are accessible as SimpleITK's Image objects.
    • ImzML images and images exported using SimpleITK (e.g. in NRRD format) can be explored interactively in M²aia desktop application.

Data Structures & Functions:

  • Signal Processing for profile imzML files:
    • Baseline correction
    • Normalization
    • Smoothing
  • Batch generators (TensorFlow/PyTorch):
    • Spectral, spatial, and spatio-spectral access
    • Optional in-memory or on-disk batch/data buffering

Data Output

  • Write Continuous Centroid imzML files

Examples@ https://github.com/m2aia/pym2aia-examples.git

Installation

Requirements on Windows

Microsoft Visual C++ Redistributable latest supported downloads: https://learn.microsoft.com/de-de/cpp/windows/latest-supported-vc-redist?view=msvc-170

Requirements on Ubuntu/Linux

apt-get install -q -y --no-install-recommends \
    libglu1-mesa-dev \
    libgomp1 \
    libopenslide-dev \
    python3 \
    python3-pip \
    python3-venv

Package installation

Consider to install pyM²aia in an virtual environment.

Install pyM²aia on windows or linux using pip.

# cd projectDir/
python3 -m venv .venv
pip3 install --upgrade pip

source .venv/bin/activate
# 

pip install pym2aia

Note: Different versions of the pypi package exists for windows and linux based systems:

  • Linux: m2aia-x.x.x-py3-none-manylinux_2_31_x86_64.whl
  • Windows: m2aia-x.x.x-py3-none-win-amd64.whl
  • Source: m2aia-x.x.x.tar.gz

The Source distribution contains *.so and *.dll library files for both, windows and linux. You can try to install pyM²aia by extracting the archive and using the following command within the project folder:

python setup.py install

Getting started

pyM2aia offers a interface to M2aia’s imzML reader and signal processing utilities. Complete processing examples can be found on pym2aia-examples

Example create ion images:

import m2aia as m2

I = m2.ImzMLReader("path/to/imzMl/file.imzML")
I.SetNormalization(m2.m2NormalizationTIC)
I.SetIntensityTransformation(m2.m2IntensityTransformationSquareRoot)
ys_2 = I.GetMeanSpectrum()
# get the ion image as array
center_mz = 1123.43
i_2 = I.GetArray(center_mz, 75)

Example write continuous centroid imzML:

import m2aia as m2
import numpy as np

# load a coninuous profile imzML
I = m2.ImzMLReader("path/to/imzMl/file.imzML")

# Find/load centroids ...
# centroids = [x for x in range(2000,3000,20)]

# csv with i.e. 3 columns with header line ('mz','min','max')
centroids = np.genfromtxt("path/to/csv/centroids.csv", delimiter=',', skip_header=1)[:,0]

I.SetTolerance(50)
I.WriteContinuousCentroidImzML("/tmp/continuous_centroid.imzML", centroids)

Developer Documentation

Known issues

The following Warnings can be ignored:

  • "WARNING: In AutoLoadModulesFromPath at /opt/mitk/Modules/CppMicroServices/core/src/util/usUtils.cpp:176 : Auto-loading of module /usr/local/lib/python3.10/dist-packages/m2aia/binaries/bin/MitkCore/libMitk<XY>IO.so failed."

  • "WARNING: In load_impl at /opt/mitk/Modules/CppMicroServices/core/src/util/usUtils.cpp:76 : libMitk<XY>.so: cannot open shared object file: No such file or directory"

Development

New python features for MSI processing

Python side processing utilities are currently limited. To change this, you can add new Python based features by adding new utilities. New tools should focus on the utilization of pyM²aia's data access and structures.

./utils/<toolName>.py

To promote your work you can just create a pull request or contact me personally.

Improve the C++-Python interface

To Further enhance the C++-Python interface it is required to make changes in m2PythonWrapper.cpp. By using MITK's super build approach, a development environment can be setup following these instructions. It is required to change the library search path for pyM2aia to the modified libraries. This can be realized by setting a system environment variable. Following the example shown in the above mentioned instructions, ie. it is required to set it in windows to

M2AIA_PATH=C:/M2aiaWorkDir/build/MITK-build/lib

For linux you can add the following lines to the end of your ~/.profile file:

M2AIA_PATH=/home/username/M2aiaWorkDir/build/MITK-build/lib

All pyM2aia libraries on the system will now use this custom library search path.

To promote your work you can just create a pull requests in both repositories or contact me personally.

Cite M²aia

M²aia is an interactive desktop application for visualization and processing of mass spectrometry (MS) imaging data. Please visit https://m2aia.github.io/m2aia for further information.

Cordes J; Enzlein T; Marsching C; Hinze M; Engelhardt S; Hopf C; Wolf I (July, 2021): M²aia - Interactive, fast and memory efficient analysis of 2D and 3D multi-modal mass spectrometry imaging data https://doi.org/10.1093/gigascience/giab049

DOI

Metadata

Release files for m2aia 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for m2aia 0.5.1
File Size Uploaded
m2aia-0.5.1.tar.gz 93.3 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for m2aia 0.5.1
File Interpreter ABI Platform
m2aia-0.5.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
m2aia-0.5.1-py3-none-manylinux_2_31_x86_64.whl Python 3 none Linux glibc 2.31+ x86-64 Details

Total release size: 187.2 MB

Release files / m2aia-0.5.1.tar.gz

Download URL m2aia-0.5.1.tar.gz
Size 93.3 MB
Tags Source
SHA-256 checksum
How to use checksums
e75edac5a6d6f86217e46a325b43126d492759972d6b64f60b5d824856adb6f8
BLAKE2b-256 checksum
How to use checksums
eb0613ac8811d46f12f6599490d5c6fe6318bf13d79a4fcb5aae6f4984d9e402
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / m2aia-0.5.1-py3-none-win_amd64.whl

Download URL m2aia-0.5.1-py3-none-win_amd64.whl
Size 48.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
8512723163a989fdf82527f7c7247cfc85ee36eef2a4498d9ab6a107f70d9287
BLAKE2b-256 checksum
How to use checksums
903209e8368c4bd245a1c4d7cc2ec69cc8bf1ec58eeacc9f72e622c729d084c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / m2aia-0.5.1-py3-none-manylinux_2_31_x86_64.whl

Download URL m2aia-0.5.1-py3-none-manylinux_2_31_x86_64.whl
Size 45.9 MB
Tags Linux glibc 2.31+ x86-64 Python 3
SHA-256 checksum
How to use checksums
3c2a201ef8b36834d7208cb95f50c1c08b69177c1b060a4e08643f1d14d10bd8
BLAKE2b-256 checksum
How to use checksums
2032ea57b21f7c6e8fb56149d6ada9c387fe98b8ee5ca0e7d2712249a0e85fc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

0.5.10

3 release files

0.5.7

3 release files

0.5.6

3 release files

This release

0.5.1 This release

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page