[Insight-users] ConnectedComponents and RelabeledConnectedCom ponents

Miller, James V (Research) millerjv at crd.ge.com
Fri Jan 7 14:36:35 EST 2005


Ken,

As you hypothesized, do need to make sure the output image
type can hold the number of components that you have in 
your images.  So unsigned int, unsigned long are good choices
for representing thousands of components.

Some of the tests run on the ConnectedComponent filter do
generate many components. ConnectedComponentImageFilterTest2, generates at
least dozens of the components and does not 
generate the warning that you are seeing.

Can you verify that you are running on (input image) a scalar 
integral image?

Another thing to check is in itkConnectedComponentImageFilter.txx in the
GenerateData() method, print out the maxPossibleLabel variable after it is
calculated (about 6 lines into the function).  This may give some insight.
maxPossibleLabel is determined via a numeric 
trait of the output pixel type. What architecture/compiler
are you using? Perhaps the incorrect pixel trait is being used.

Jim


-----Original Message-----
From: Ken Urish [mailto:ken.urish at gmail.com]
Sent: Friday, January 07, 2005 1:35 PM
To: insight-users at itk.org
Subject: [Insight-users] ConnectedComponents and
RelabeledConnectedComponents


Im a long times listener, first time caller - 

Ive hit a brick wall that I have not been able to get past for the
past week and a half using ConnectedComponentsImageFilter and
RelabeledComponentsImageFilter.

I have a binary tiff (unisgned char) image that I have thresholded,
and I want to count the number of white pixeled islands against a
black background.  I am using ConnectedComponentsImageFilter and then
I use RelabeledComponents to count the number of islands.  The program
works if I have only 5 or less  white connected components( CC ).  It
falls apart if I have a large number of CCs.  Ultimately I will have
more than a thousand.

Fooling around with different pictures, here is my problem:
1) No matter how many CCs I have, I always generate the itk warning:
"ConnectedComponentImageFilter::GenerateData: Number of labels exceeds
number of available labels for the output type."  If I have only 5 or
7 CCs, even thou the warning is generated I still get an accurate
answer, however I think this is the root of my problem.
2) If I take the same picture I made that has 5 white pixeled islands,
copy it over and over to use as a template to make images of 10, 25,
50 and 75 white pixeled CCs, and print out the size of the connected
components, I will only get a max of 5 connected components even when
I have 75 CC.  In addition, at 25, 50 and 75 CCs all of the CCs that
are counted all have the same size and are all the very 1st white
island I have of the series of 5 pixeled island.

- I thought that I could fix the problem using "unsigned long" or
"unsigned int".  If I do this I get the CC saying I have only 0 and of
course I cant view the image since its not supported by tiff or jpeg.

-Even if i get an accurate count of 75 or 100 white pixeled islands
how can I get it too handle 500, 1000, or even 10,000???  I am
absolutely baffeled, please help.

Thanks
--Ken--
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list