[ITK] ConnectedComponentImageFilter and RelabelComponentImageFilter

Zein Salah zeinsalah at gmail.com
Fri Apr 15 10:36:34 EDT 2016


Hi,

I am doing kind of thresholding on CT images. The result is a binary image
with the parts of the images I need. However, the resulting image contains
a large number of small pieces (sparkle-like) that I want to remove. I thought,
the combination of ConnectedComponentImageFilter and RelabelComponentImageFilter
would accomplish the tast.

Si, I tried the code below to get rid of pieces that are smaller than
1000 voxels.

   typedef itk::ConnectedComponentImageFilter<BinaryImageType,
ImageType> ConnectedComponentImageFilterType;
   ConnectedComponentImageFilterType::Pointer connectedComponent =
ConnectedComponentImageFilterType::New();
   connectedComponent->SetInput(segmentedImage);
   connectedComponent->ReleaseDataFlagOn();

   typedef itk::RelabelComponentImageFilter<ImageType, ImageType>
RelabelFilterType;
   RelabelFilterType::Pointer relabel = RelabelFilterType::New();
   relabel->SetInput(connectedComponent->GetOutput());
   relabel->SetMinimumObjectSize(1000);
   relabel->Update();

Principally, this works. However, In some situations, the program craches
and I think this is due to a huge number of components, some of which are
probably few voxels in size.

1. Does the ConnectedComponentImageFilter compute the size of component?
Is there a way to force it ignore small ones?

2. If anybody had a better idea to doing the task I described, I would
be thankful.

Best,


Zeno


More information about the Community mailing list