[Insight-users] Problem with connected component Image filter

Harish Doddi harish.slicer at gmail.com
Tue Jan 26 20:01:04 EST 2010


Hi all,

I am trying to use  itk::ConnectedComponentImageFilter in the following
code..
.....
.....
  itk::ConnectedComponentImageFilter<ImageType, ImageType>::Pointer ccFilter
= itk::ConnectedComponentImageFilter<ImageType, ImageType>::New();

        /* Iterate through this code */ /* When to stop? When the two seed
points pixels differ */
        while(1)
        {

                ImageType::Pointer e = BinaryErodeFilter3D( img, 1 );
                ccFilter->SetInput( e );
                ccFilter->Update();
                if ( ccFilter->GetOutput()->GetPixel( pixelIndex1 ) ==
ccFilter->GetOutput()->GetPixel( pixelIndex2 ) ) // Same cluster
                {
                        img = e;
                        ++noOfIterations;
                        std::cout << "Iteration no = "<<noOfIterations <<
std::endl;
                        continue;
                }
                else // Different Cluster
                {
                        break;
                }
        }

When I try to run this code, I get an exception like this after executing
the line "ccFilter->Update();"

terminate called after throwing an instance of 'itk::ExceptionObject'
  what():
/home/harishd/ITK/InsightToolkit-3.16.0/Code/Common/itkMultiThreader.cxx:475:
itk::ERROR: MultiThreader(0x86c0598): Exception occurred during
SingleMethodExecute
/home/harishd/ITK/InsightToolkit-3.16.0/Code/BasicFilters/itkConnectedComponentImageFilter.txx:352:
itk::ERROR: ConnectedComponentImageFilter(0x86af268): Number of objects
greater than maximum of output pixel type
-- Process completed

*** Exception executing: Child aborted
***Exception: Other

Any ideas on this error?


Thanks,
Harish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100126/40c02f01/attachment-0001.htm>


More information about the Insight-users mailing list