Cancer Imaging Phenomics Toolkit (CaPTk)  1.9.0
Geodesic Training Segmentation

'GeodesicTraining' builds upon the geodesic distance based segmentation by using machine learning (SVMs) [1].

It also adds support for multiple areas of interest, 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. A ROI image has to be drawn which will containing sample labels for the different areas the user wants to segment (see usage for details).


  1. Load the different images, that are different modalities of the same subject into CaPTk. It doesn't matter which image you have selected from the ones that are loaded. Everything that is loaded is passed to the algorithm.
  2. Draw over the images using CaPTk's drawing tools. Example: Suppose that you have an image of a brain tumor and you are interested in segmenting the image into 3 different sections, tumor core (the main tumor), edema (a fluid surrounding the tumor core) and healthy tissue (the reset of the brain). You have to use three different colors. Suppose you use RED for tumor core, GREEN for edema and BLUE for healthy tissue (it's up to you to pick the colors). Draw a little bit over the tumor core with the red marker, a little bit over the edema with the green one and a little bit anywhere else that is not an affected area with the blue marker. Keep in mind to always use a color for areas that are not of interest (like we used now for healthy tissue), otherwise the algorithm will try to classify the healthy tissue as one of the colors you have actually drawn. Obviously, whatever you do you have to use at least two different colors. You don't need to draw excessively. In fact it is advised not to go overboard, as this leaves you room for better corrections later on (see below). It's best to stick to the free-hand drawing tool with 1x1 or 3x3 marker size.
  3. After you have drawn, Click Applications>'Geodesic Training Segmentation' from the menu and wait ~30 seconds (depends on the number of images, the images' size and your computer specs).
  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 same 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 wish for something similar then, before saving, select the color you used for healthy tissues 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:
    ${CaPTk_InstallDir}/bin/GeodesicTraining.exe -i C:/inputImage1.nii.gz,C:/inputImage2.nii.gz,... -l C:/maskWithAtLeastTwoDifferentClasses.nii.gz -o C:/outputDirectoryNotFilename

You have to draw the ROI image somewhere else to use the CLI executable. This image should be zero everywhere, except for the voxels that you have drawn. These voxels should be the same value if they belong to the same area. For instance in the example we discussed before, you can use value 1 for tumor core, value 2 for edema and value 3 for healthy tissue. If you don't want the output to contain the healthy tissue you can use parameter "-cl 3/0" which means that value 3 will be changed to 0. Keep in mind that values for healthy tissue are still needed, they just not going to show up in the output segmentation. If you want to iterate (correct mistakes in the segmentation), it's a bit harder to do with the CLI. You have to add new values to the input ROI (not the output segmentation) and run again. If you are going to use the CLI it is recommended to spend a little bit more time when you draw your input ROI so the first segmentation you get is good and you don't have to iterate the algorithm often.

Note that the CLI allows users to configure a pixel limit. Images above this size (after normalization) will be downsampled for processing, then upsampled when done. This produces a faster, but less precise, result. The GUI does not currently perform this downscaling step.


  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.