[ITK] ConnectedComponentImageFilter and RelabelComponentImageFilter

Timothee Evain tevain at telecom-paristech.fr
Fri Apr 15 11:00:26 EDT 2016


Hello,

I would suggest to use some mathematical morphology, it's very useful for the kind of task you want.
For example, use an area opening to get rid of your small components.
( AreaOpeningImagefilter in itk : http://www.itk.org/Doxygen/html/classitk_1_1AreaOpeningImageFilter.html )

HTH,

Tim

----- Mail original -----
De: "Zein Salah" <zeinsalah at gmail.com>
À: community at itk.org
Envoyé: Vendredi 15 Avril 2016 16:36:34
Objet: [ITK] ConnectedComponentImageFilter and RelabelComponentImageFilter

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
_______________________________________________
Community mailing list
Community at itk.org
http://public.kitware.com/mailman/listinfo/community


More information about the Community mailing list