[ITK] ConnectedComponentImageFilter and RelabelComponentImageFilter

Matt McCormick matt.mccormick at kitware.com
Fri Apr 15 10:59:02 EDT 2016


Hi Zeno,

One option is OpeningByReconstructionImageFilter:

  http://www.itk.org/Doxygen/html/classitk_1_1OpeningByReconstructionImageFilter.html

HTH,
Matt

On Fri, Apr 15, 2016 at 10:36 AM, Zein Salah <zeinsalah at gmail.com> wrote:
> 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