Skip to main content

MRISegmentator-Abdomen

MRISegmentator-Abdomen: A Fully Automated Multi-Organ and Structure Segmentation Tool for T1-weighted Abdominal MRI

Yan Zhuang1, Tejas Sudharshan Mathai1, *, Pritam Mukherjee1, *, Brandon Khoury2, Boah Kim1, Benjamin Hou1, Nusrat Rabbee3, Abhinav Suri1, and Ronald M. Summers1

1 Imaging Biomarkers and Computer-Aided Diagnosis Laboratory, NIH Clinical Center
2 Department of Radiology, Walter Reed National Military Medical Center
3 Biostatistics and Clinical Epidemiology Services, NIH Clinical Center
* equal contribution

[Paper] [Dataset(coming soon!)]

Acknowledgement: This work was supported by the Intramural Research Program of the National Institutes of Health (NIH) Clinical Center (project number 1Z01 CL040004). This work used the computational resources of the NIH HPC Biowulf cluster. We thank ChatGPT 4o for generating the logo used in this project.

Usage

Requirements: We recommend running on a computer with a GPU. This package can be run on a computer with a CPU, but it will take a very long time to process a single scan.

Step 1: Create a virtual environment and install the package.
We recommend you install MRISegmentator in a conda environment to avoid dependency conflicts. Note you can use any version of python that supports nnUNet v2.2 or above

conda create -n MRISegmentator python=3.11
conda activate MRISegmentator  
pip install MRISegmentator

Step 2: Run!

MRISegmentator -i path/to/input/mri.nii.gz -o path/to/output/segmentation.nii.gz -d gpu

Notes:

  • The model weights will download on their own to one of the following directories:

    • if the environment variable MRISEGMENTATOR_DIR is set, we will download to that directory (and create the directory if it does not exist)
    • if that environment variable is not set, it will download to the home directory at ~/.mrisegmentator_weights.
    • You can also specify a directory for the weights via the -m option (this must be a path to the extracted folder from this zip file)
  • For the -d option, you can also provide cpu or mps as an option (cpu runs on your computer's CPU only and mps runs on M1/2 processors).

Python API

You can also run this package via importing it in a python script:

from mrisegmentator.inference import mri_segmentator
input_file_path = # path to your input file /mypath/input/input.nii.gz
output_file_path = # path to where you want to segmentation to save. e.g. /mypath/result/out.nii.gz
device = # one of 'gpu', 'cpu', 'mps'
path_to_model = # path to a trained nnunet model, if None will attempt to search for model weights above
mri_segmentator(input_file_path, output_file_path, path_to_model, device)

Redownloading weights

Normally, we handle downloading the weights for you, but if we release a new model version, we will need you to redownload the weights via the following command

MRISegmentator_Redownload

The last time model weights were changed was on May 30, 2024.

Issues

MRISegmentator is a research-grade segmentation tool currently under active development. Please let us know if you encounter any issues or have suggestions for improvements.

References

If you find our work is useful for your research, please cite

@article{zhuang2024mrisegmentator,
  title={MRISegmentator-Abdomen: A Fully Automated Multi-Organ and Structure Segmentation Tool for T1-weighted Abdominal MRI},
  author={Zhuang, Yan and Mathai, Tejas Sudharshan and Mukherjee, Pritam and Khoury, Brandon and Kim, Boah and Hou, Benjamin and Rabbee, Nusrat and Suri, Abhinav and Summers, Ronald M},
  journal={arXiv preprint arXiv:2405.05944},
  year={2024}
}

We used nnUnet in our research, please also consider citing

@article{isensee2021nnu,
  title={nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation},
  author={Isensee, Fabian and Jaeger, Paul F and Kohl, Simon AA and Petersen, Jens and Maier-Hein, Klaus H},
  journal={Nature methods},
  volume={18},
  number={2},
  pages={203--211},
  year={2021},
  publisher={Nature Publishing Group}
}

License

Please check out the license file.

Segmentation labels

Below is a table that maps the segmentation codes to the original bodypart name, or

Here you can find the itk-snap label description.

Organ or Structure name Label
spleen 1
kidney_right 2
kidney_left 3
gallbladder 4
liver 5
esophagus 6
stomach 7
aorta 8
inferior_vena_cava 9
portal_vein_and_splenic_vein 10
pancreas 11
adrenal_gland_right 12
adrenal_gland_left 13
lung_right 14
lung_left 15
small_bowel 16
duodenum 17
colon 18
iliac_artery_left 19
iliac_artery_right 20
iliac_vena_left 21
iliac_vena_right 22
gluteus_maximus_left 23
gluteus_maximus_right 24
gluteus_medius_left 25
gluteus_medius_right 26
autochthon_left 27
autochthon_right 28
iliopsoas_left 29
iliopsoas_right 30
hip_left 31
hip_right 32
sacrum 33
rib_left_4 34
rib_left_5 35
rib_left_6 36
rib_left_7 37
rib_left_8 38
rib_left_9 39
rib_left_10 40
rib_left_11 41
rib_left_12 42
rib_right_4 43
rib_right_5 44
rib_right_6 45
rib_right_7 46
rib_right_8 47
rib_right_9 48
rib_right_10 49
rib_right_11 50
rib_right_12 51
vertebrae_L5 52
vertebrae_L4 53
vertebrae_L3 54
vertebrae_L2 55
vertebrae_L1 56
vertebrae_T12 57
vertebrae_T11 58
vertebrae_T10 59
vertebrae_T9 60
vertebrae_T8 61
vertebrae_T7 62

Metadata

Release files for MRISegmentator 0.4.2

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

Source distribution (sdist)

Source distribution for MRISegmentator 0.4.2
File Size Uploaded
mrisegmentator-0.4.2.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for MRISegmentator 0.4.2
File Interpreter ABI Platform
MRISegmentator-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / mrisegmentator-0.4.2.tar.gz

Download URL mrisegmentator-0.4.2.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
732e708c54a24e0a6d9e0ab723d7eedc5b97eada2f79e49402c5c2a414bc04a6
BLAKE2b-256 checksum
How to use checksums
e128d50ca456e33b85b995aea7774583f2425056606881bbf99f51a47590b457
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.5

Release files / MRISegmentator-0.4.2-py3-none-any.whl

Download URL MRISegmentator-0.4.2-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f24edb2d35a67b43d09a81df961283fafb412e161fed689bdef870d7b4911bd2
BLAKE2b-256 checksum
How to use checksums
f29dccbf690df14fcc68dd8dab84985fd88665b0966e51b955801be9bcf70f44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 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