Cancer Imaging Phenomics Toolkit (CaPTk)  1.6.2.Alpha

Geodesic Training Segmentation

The geodesic training builds upon the geodesic distance transform based segmentation by adding support vector machines, support for multiple classes, multiple modalities, the ability to iterate the algorithm until a desired outcome is achieved and no need for thresholding.

REQUIREMENTS: One or more co-register images of the same subject and a ROI image containing sample labels for the different areas the user wants to segment.


  1. Load the different modalities (of the same subject) into CaPTk. It doesn't matter which image you have selected, everything that is loaded is passed to the algorithm.
  2. Draw over the images using CaPTk's drawing tools. You have to use at least two different colors. This means that if there is only one region you want to segment, you have to draw some labels for this region and some, using a different color, for the healthy tissues too. There is no restriction for which color to use for what and you can use as many colors (classes) as you want (for instance for brain tumors you can use one color for non-enhancing, one for enhancing, one for edema and one for healthy tissue or just two and do whole tumor vs healthy tissue, etc). You don't need to draw a lot of labels. In fact it is advised not to go overboard, as this leaves you room for better corrections later on. It's best to stick to the free-hand drawing tool with 1x1 or 3x3 marker size.
  3. Click Applications>'Geodesic Training Segmentation' from the menu and wait ~30 seconds (depending on the image size).
  4. Now you will see the output segmentation where your labels were previously drawn. You can keep this segmentation if it's ok. Chances are though that it contains mistakes. Using the drawing tools again, draw over some of those mistakes (right on the output segmentation!) and then click Applications>'Geodesic Training Segmentation' again. You can repeat this as many times as you want. (There probably won't be a need for more than 2-3 runs though). Something that you might not know about about CaPTk is that you can change the opacity of the ROI by clicking an image, then the 'opacity' checkbox next to the image and using the slider.
  5. Once you are satisfied with the segmentation you can save it using File>Save>ROI. Most of the time people don't want their segmentations to contain labels for the healthy tissue. If you want that, before saving, select the color you used for healthy tissue from the 'label selector' in the drawing tools and click 'Clear selected label' and save.
  • This application is also available as with a stand-alone CLI for data analysts to build pipelines around, and can run in the following format (more advanced usage inside (src/applications/GeodesicTraining/GeodesicTraining/
      GeodesicTraining.exe -i C:/inputImage1.nii.gz,C:/inputImage2.nii.gz,... -l C:/maskWithAtLeastTwoDifferentClasses.nii.gz -o C:/outputDirectory.nii.gz

Geodesic Distance Transform-based Segmentation

The geodesic distance transform based segmentation is a semi-automatic technique to delineate structures of distinct intensity.

REQUIREMENTS: A single image with distinct boundaries for the structure that needs to be segmented [1].


  1. Load in CaPTk the image that you want to segment.
  2. Using Label 1 from the drawing tab, annotate a region of the tissue you would like to segment in the image.
  3. Launch the application using the 'Applications' -> 'Geodesic Segmentation' menu option.
  4. The mask is populated within ~5 minutes, showing the progress at the bottom right corner of CaPTk.
  5. The mask is visualized automatically in the visualization panels.
  6. You can revise the resulted segmentation mask (Label:1), by selecting the "Geodesic" preset and changing the "Threshold" at the bottom right corner of CaPTk.

This application is also available as with a stand-alone CLI for data analysts to build pipelines around, and can run in the following format:

[WINDOWS] GeodesicSegmentation.exe -i C:/inputImage.nii.gz -m C:/maskWithOneLabel.nii.gz -o C:/outputImage.nii.gz -t 20
[LINUX] captk GeodesicSegmentation -i /mnt/c/inputImage.nii.gz -m /mnt/c/maskWithOneLabel.nii.gz -o /mnt/c/outputImage.nii.gz -t 20


ITK-SNAP is a stand-alone software application used to segment structures in 3D medical images and other utilities [2] -

Within CaPTk specifically, ITK-SNAP is tightly integrated as a tool used for segmentation, accepting files chosen through the CaPTk interface and returning results for further use within CaPTk. ITK-SNAP uses a combination of random forests and level sets to obtain precise segmentations of structures [2]. Please see the following video for detailed instructions:


  1. B.Gaonkar, L.Shu, G.Hermosillo, Y.Zhan, "Adaptive geodesic transform for segmentation of vertebrae on CT images", Proceedings Volume 9035, Medical Imaging 2014: Computer-Aided Diagnosis; 9035:16, 2014. DOI:10.1117/12.2043527.
  2. P.Yushkevich, Y.Gao, G.Gerig, "ITK-SNAP: An interactive tool for semi-automatic segmentation of multi-modality biomedical images", Conf Proc IEEE Eng Med Biol Soc. 2016:3342-3345, 2016. DOI:10.1109/EMBC.2016.7591443.

DeepMedic (Windows-only)

DeepMedic is a Deep Learning based segmentation algorithm [1,2] and users can do inference using a pre-trained model (trained on BraTS 2017 Training Data) with CaPTk for Brain Tumor Segmentation.

REQUIREMENTS: The 4 basic MRI modalities (T1, T1-Gd, T2 and T2-FLAIR) for a subject which are co-registered.


  1. Load in CaPTk the images that you want to segment.
  2. [OPTIONAL] Load the brain mask - this is used for normalization.
  3. Select the output folder.
  4. Click on 'Applications' -> 'DeepMedic Segmentation'

This can also be used from the command line:

DeepMedic.exe -t1 C:/data/t1.nii.gz -t2 C:/data/t2.nii.gz -t1c C:/data/t1ce.nii.gz -fl C:/data/fl.nii.gz -o C:/data/output/ -m C:/data/optionalMask.nii.gz


  1. K.Kamnitsas, C.Ledig, V.F.J.Newcombe, J.P.Simpson, A.D.Kane, D.K.Menon, D.Rueckert, B.Glocker, "Efficient Multi-Scale 3D CNN with Fully Connected CRF for Accurate Brain Lesion Segmentation", Medical Image Analysis, 2016.
  2. K.Kamnitsas, L.Chen, C.Ledig, D.Rueckert, B.Glocker, "Multi-Scale 3D CNNs for segmentation of brain Lesions in multi-modal MRI", in proceeding of ISLES challenge, MICCAI 2015.