From Slicer Wiki
Jump to: navigation, search
Home < Slicer3:Module:LabelBinaryImages-Documentation

Return to Slicer Documentation

Binary Thresholding and Labeling


Module Type&Category

The type of this module is CLI and is under the category Segmentation in Slicer 3. The name of this module is LabelBinaryImages in Slicer 3.

Authors, Collaborators&Contact

  • Author: Bike Kilic, MSc student in Northeastern University
  • Contact:

Module Description

The purpose of this module is defining different labels in an image after morphological operations. This module performs thresholding in the first step and then implements labeling by using the information of connectedness in given input.

The input of this module is the last eroded image. And after this process, the labeled binary image is taken to dilation process. After LabelBinaryImages module, the output shows us different labeled areas. For instance, in this project, the input is eroded spheres and then after this module the output is an image with three different labeled areas:background as 0, one of the spheres as 1 and the other one as 2. The sphere with bigger area is labeled as 1.

The results can be seen in the section called Screen shots in this page.


Quick Tour of Features and Use

The GUI panel for LabelBinaryImages Module



In this module, there are 3 ITK classes which are used.

One of them is for binary thresholding which is called itkBinaryThresholdImageFilter[1]. It takes two user inputs which are LowerThreshold and UpperThreshold values. The output is a binary images with 0 outside and 255 inside.

The other class which is for labeling the objects in a binary image is itkConnectedComponentImageFilter class [2].Each distinct object is assigned a unique label. The filter experiments with some improvements to the existing implementation, and is based on run length encoding along raster lines. The final object labels start with 1 and are consecutive. Objects that are reached earlier by a raster order scan have a lower label. This is different to the behavior of the original connected component image filter which did not produce consecutive labels or impose any particular ordering. The input of this algorithm is the output of binary thresholding.

The last one is used for remapping the labels associated with the objects in an image. The input comes from the output of ConnectedComponentImageFilter. The name of this last class is itkRelabelComponentImageFilter [3]. The output of this method is used for BinaryDilateOperations module.

The Problems

The problem with this module is that I could not create a 3D model after dilation processes with given labels by using Editor module of Slicer 3. As I had the output of the dilation, I created a label map by using Editor module but what I has as an output is just a black screen labeled as 0. Therefore, I could not perform thresholding tool in Editor so could not able to change the labels and then using Model Maker module.

Screen shots

The output of LabelBinaryImagesModule and then dilation

In the first square, the output of dilation by using BinaryDilateOperations module and label mapping by using Editor module can be seen. Second one indicates the output of LabelBinaryImages module. As mentioned in the section Module Description in this page, the background is labeled as 0 whereas the separated spheres are labeled as 1 and 2 consecutively.

As we keep on dilating the image, the spheres are still labeled as 1 and 2 and the background as 0.



In this part, I tried to explain if we are able to use LabelBinaryImages module in morphological operations. What I have seen after using this module is that even I continue on dilation of the separated images and make them overwritten, the labels of the objects does not change. The label numbers remain the same as I had seen after I performed the algorithms in LabelBinaryImages module on the last eroded image.

What the user should be careful is that if user has the output of BinaryThresholding module as an input for BinaryDilateOperations module, the dilate value should be chosen as 255. However, if user chooses the output of LabelBinaryImages module as an input for dilation, the dilate value should be the same as label numbers. The reason is that as I have seen from my experiments, when I entered 255 for dilate value to dilate the output image of LabelBinaryImages module, there was no change in the output image. However, when I chose 1 or 2 for the dilate value, the image has been dilated by given structuring element. In my opinion, the reason is that the output of LabelBinaryImages module is formed by the label values 0, 1 and 2, whereas the output of BinaryThresholding module has 255 inside and 0 outside.

Future work

As a future work, it will be better to add an algorithm which makes label mapping in LabelBinaryImages module instead of using Editor module in Slicer 3. The reason is that the thresholding in Editor module and the one in LabelBinaryImages module works different so creating label maps and then coloring these maps with different labels fails by using Editor module. In 2D plane, I can see that the labels which are defined by LabelBinaryImages module by performing on the separated binary spheres after erosion processes do not change even they overwrite after many dilation processes. However, when I want to color these different labeled objects, at that point I can not achieve my goal and am not be able to see the result in 3D space.


  1. Ibanez L., Schroeder W.,Ng L. & Cates J., The ITK Software Guide Second Edition Updated for ITK Version 2.4, 2005.
  2. Lehmann G.,Label object representation and manipulation with ITK, 2007. [4]