- 3D Slicer extension
- Manual medical image segmentation
This module is currently targeted at the segmentation of intracerebral hemorrhage (ICH), intraventricular hemorrhage (IVH) and perihematomal edema (PHE) in CT scans. It can be adapted to other tasks. Among other things, it allows the user to:
- Load a CT scan and its corresponding labels.
- Use thresholding to segment the ICH, IVH and PHE.
- Smooth the segmentations.
- Use standardized filenaming conventions.
- Record the annotatore name, level and revision step in the filenames.
- Save the segmentations in NRRD format. A separate script is avalaible to convert the NRRD files to NIFTI format.
- Remove outliers from the segmentations based on the corresponding volume Housefield units (HU). For example, if the HU of a voxel is -300, it is likely that the voxel is not part of the ICH and represent air. The upper and lower HU thresholds are configurable in the
label_config.yml
file. - Perform a QC to check that each label as the right label value. TODO: This part is hard-coded for the moment and works only for ICH = 1, IVH = 2, PHE = 3but could be adapted to be more flexible in the future. A separate is available to perform the later task.
- Install 3D Slicer.
- Clone this repository.
- Modify
label_config.yml
to describe your annotations. There can be as many or as few as you would like. The colors are configurable using RGB integer values between 0 and 255. The default HU thresholds for each label are also configurable. These can also be modified directly in the extension. Note that additional tools will appear in the user interface if one of the labels is either intracerebral hemorrhage (ICH) or perihematomal edema (PHE). - Open 3D Slicer.
- Activate the checkbox
Enable developer mode
inEdit -> Application Settings -> Developer -> Enable developer mode
. - Add the path of this repository in
Edit -> Application Settings -> Modules -> Additional module paths
.- There might be errors. These would be seen in the Python Console.
- The module can be found under
Examples -> SEGMENTER_V2
.
- Qt might need to be installed. The first five steps of the following procedure might be useful for this: procedure.
- If some modules are missing (
ModuleNotFoundError
), they must be added to the 3D Slicer environment by using the following commands in the Python Console:from slicer.util import pip_install
. Alternatively, it is possible to use : slicer.util.pip_install('XYZ')pip_install("XYZ")
whereXYZ
is replaced by the proper library
Minimally the following packages are not already available (copy and paste in the python interactor):
slicer.util.pip_install('pandas')
slicer.util.pip_install('nibabel')
slicer.util.pip_install('pynrrd')
slicer.util.pip_install('pyyaml')
slicer.util.pip_install('slicerio')
A configuration file config.yaml
is required to use the extension. The configuration file is a YAML file that describes the input directories, regular expression pattern to extract the ID from the the labels that will be used for the segmentation.
- In the future, the IDs won't be incorporated in the segment names, only in the filenames. This will require a change in post-annotation QC script (separate repository).
- Add the QC check module within the extension and allow to check the label name : value correspondance based on the config file.
SlicerJupyter
to be able to use Jupyter Notebooks connected to 3D Slicer.
The videos are much less blurry if the mp4 files are downloaded to your computer.