connected components use the same label for different objects

Dear all,

I am writing becaue i am using this method because i want every different object (not connected) with a different value but i obtained but results and i figured out that there are separate objects labeled with the same label. Has someone the same problem?

Thanks

    typedef itk::ConnectedComponentImageFilter <ImageType, ImageType >
		ConnectedComponentImageFilterType;

	ConnectedComponentImageFilterType::Pointer connected =
		ConnectedComponentImageFilterType::New();
	connected->SetInput(ROISegm->GetOutput());
	connected->Update();

That might be possible due to a few reasons:

  1. Objects might be connected in 3D space even if they don’t look connected on any individual 2D slice
  2. There are more objects/labels than ImageType’s PixelType can represent. If there are 300 objects and pixel type of output image is unsigned char, then objects 256 and later will be given labels 0 through 44.
  3. There is a bug somewhere

Can you narrow it down to one of there options?

1 Like

Hi, can you further explain your first reason? I can not understand it. " 1. Objects might be connected in 3D space even if they don’t look connected on any individual 2D slice"

I also met this problem and I found there are two components in 3D, which are not connected in any 2D slice from their axial view, but sitk.ConnectedComponents() function said they belong to one label.

Yours sincerely,
Oscar Pang

Take a look at this 3D torus:


It is clearly a single object. But if you look at it in a plane in which the highlighted red circle is, there will be two circular intersections with it (the red one, and an additional one on the opposite side of the torus). If you judged just by that slice, you would mistakenly think there are 2 objects in the image.