Skip to content

Get DICOM masks of vertebrae from sagittal IDEAL (Iterative Decomposition of water and fat with Echo Asymmetric and Least-squares estimation) spine MR images

License

zhoji/verteseg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VerteSeg: Automatic Vertebral Segmentation

Source code for Zhou et al., Automatic Vertebral Body Segmentation Based on Deep Learning of Dixon Images for Bone Marrow Fat Fraction Quantification. Frontiers in Endocrinology (2020).

About

This code performs automatic segmentation of vertebrae from sagittal IDEAL (Iterative Decomposition of water and fat with Echo Asymmetric and Least-squares estimation) spine MR images

Segmentation is performed via a U-net (Ronneberger et al., 2015) that was trained on the water, fat, fat fraction, and R2* IDEAL images and manual segmentations. segmentation example

Setup

Installing a virtual environment

Set up a conda environment if you do not have all the packages/compatible versions (the list of dependencies is listed in environment.yml).

Create and activate virtual environment using conda
Set-up environment using conda (make sure you are in the verteseg code repository): conda env create -f environment.yml
The default name of the environment is vseg. Activate the environment with source activate vseg, and deactivate with source deactivate.
Use conda info vseg to see more information about the environment and ensure that it was installed properly.

Usage

Make sure you are in the verteseg code repository.

source activate vseg
python get_masks.py [-h] --data_path "/path/to/your/data/" --exam "E1234" --series "5" --save_path "/path/to/save/masks/"

This assumes that your data is organized such that the fat fraction DICOM series is located in /path/to/your/data/E1234/5/
Masks will be saved as /path/to/save/masks/E1234/5/E1234S501I_mask_pred_#.DCM where # is the slice number.

Further steps

To automatically convert the DICOM masks into regions of interest (ROIs) in IDL:

idl
brimage,/load
files = file_search("/path/to/save/masks/E1234","*DCM")
MaskToMir,files

These automatically generated ROIs, saved as a .mir file, can then be visualized in IDL's interactive environment, accessed by the command brimage or mrsc_image:

  1. Open an IDEAL series (e.g. the water series) that you want to overlay the masks on.
  2. On the image viewer, click "Tools > ROIs", then click the name of the image series (outlined in green) to display a drop-down menu, and select "Open ROI file" to open your .mir file. This will display the masks.
  3. To view as an overlay, click the name of image series above the green outlined text and select the name of the series corresponding to what you want the masks to be overlaid on.

All tools in IDL can be used as normal to modify the ROIs as needed.

This can also be done manually by:

idl
brimage,/load
MaskToMir,/interactive

This opens an interactive version of the MaskToMir function, in which you can select the .DCM or .int2 file corresponding to your mask, and automatically make a .mir file with default parameters.

Credits

This was created by the Musculoskeletal Magnetic Resonance Imaging Lab.
Please contact Jiamin Zhou, MS if you have any questions or comments.

About

Get DICOM masks of vertebrae from sagittal IDEAL (Iterative Decomposition of water and fat with Echo Asymmetric and Least-squares estimation) spine MR images

Resources

License

Stars

Watchers

Forks

Packages

No packages published