dMRI segmentation learning
dMRISeg is a tool to segment brain tissue from diffusion MRI data. Its use has been demonstrated on cerebellar tissue segmentation, and is based on a SegResNet architecture and spherical mean data.
Downloading the source code from git:
git clone http://github.com/SlicerDMRI/dmriseg.gitThe following commands change the current working directory to the cloned repository and install the package along with its dependencies:
cd dmriseg
pip install .Note
In order to efficiently run dMRISeg you will need to have a GPU and the corresponding drivers installed.
Training the model requires access to both training and validation datasets, including the corresponding labelmaps, in order to learn and evaluate the segmentation. The following command demonstrates how to run the training script:
cd scripts
train_cerebparc.py \
/path/to/training/data \
/path/to/training/labelmaps \
/path/to/validation/data \
/path/to/validation/labelmaps \
/path/to/output \
--lr 1.0e-4where:
/path/to/training/data: Directory containing the input images for training the model./path/to/training/labelmaps: Directory containing the labelmaps corresponding to the training images. These provide the ground truth segmentations./path/to/validation/data: Directory containing input images used for validation during training./path/to/validation/labelmaps: Directory containing the labelmaps for the validation images. These allow monitoring of model performance on unseen data./path/to/output: Directory where the trained model and related outputs (e.g., logs, checkpoints) will be saved.lr: Learning rate. Optional.
Make sure the training and validation directories contain the same file names for images and labelmaps, so the script can correctly match them.
Input data are assumed to be 192 x 192 x 192.
Once the model is trained, predictions on unseen volume data can be performed using the following command:
predict_cerebparc.py \
/path/to/testing/data \
/path/to/model/weights \
/path/to/outputwhere
/path/to/testing/data: Directory containing the input images (volumes) for which you want to generate predictions./path/to/model/weights: Path to the trained model weights (from the training step)./path/to/output: Directory where the predicted segmentations will be saved.
Ensure that the testing images are in the same format and preprocessed similarly to the training data.