I/O of Medical Image Data Structure (MIDS) for Open and Reproducible Musculoskeletal Imaging Research (ORMIR). Based on the BIDS data structure.
Note
This package is a fork of muscle-bids for muscle MR imaging data.
- Francesco Santini
- Donnie Cameron
- Leonardo Barzaghi
- Judith Cueto Fernandez
- Jilmen Quintiens
- Lee Youngjun
- Jukka Hirvasniemi
- Gianluca Iori
To install ormir-mids
, run the code below, noting this list of dependencies.
It is recommended to install ormir-mids
in a separate virtual environment:
conda env create -n ormir-mids
conda activate ormir-mids
Clone the git repository:
git clone https://github.com/ormir-mids/ormir-mids.git
Now we can install the package using pip
. This will also install the required dependencies.
cd ormir-mids
pip install .
pip install --upgrade nibabel # the default nibabel has bugs
ormir-mids
can be used in two ways:
- Running
dcm2mbids
as an executable to convert DICOM data to the BIDS format. - Importing
ormir-mids
as a Python module to find, load, and interrogate BIDS-format data.
The commandline script is called dcm2mbids.exe
. To view the commandline script help type
dcm2mbids -h
To use ormir-mids
within Python, import the following modules
from muscle_bids.utils.io import find_bids, load_bids
import nibabel as nib
For a detailed description of how to use ormir-mids
see the following notebook
ormir-mids
can be used within Python to load, manipule and visualize medical volume datasets, without convertion to the BIDS format.
- Load a DICOM file to a MedicalVolume object
from muscle_bids.utils.io import load_dicom
mv = load_dicom('<Path-to-DICOM-file>')
- Slice the volume. This will create a separate subvolume. Metadata will be sliced appropriately.
mv_subvolume = mv[50:90, 50:90, 30:70]
- Convert volume to ITK image with SimpleITK
mv_itk = mv.to_sitk()
Examples of how to use ormir-mids
for common data handling, image manipulation and processing tasks within Python can be found in this notebook
This package was developed thanks to the support of the JCMSK community during the Maastricht 2022 workshop and hackaton “Building the Jupyter Community in Musculoskeletal Imaging Research”.
Image I/O is based on DOSMA by Arjun Desai. A stripped-down version of DOSMA is present in muscle-bids/dosma_io.