[Insight-users] Problem with connected component Image filter

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Wed Jan 27 16:36:02 EST 2010


Le 27 janv. 10 à 22:29, Harish Doddi a écrit :

> Hi Bill,
>
> The ImageType is
>
> typedef itk::OrientedImage< unsigned short, 3 > ImageType;

with this pixel type, you can have up to 65535 objects in your image.  
If you have more then that, you have to use a larger type like  
unsigned long.

You may want to try to reduce the number of connected components by  
denoising your image, or by using SetFullyConnected(true) on the  
ConnectedComponentImageFilter.

Regards,

Gaëtan

>
> Thanks,
> Harish
>
>
> On Tue, Jan 26, 2010 at 8:09 PM, Bill Lorensen <bill.lorensen at gmail.com 
> > wrote:
> What is the type of ImageType?
>
> On Tue, Jan 26, 2010 at 8:01 PM, Harish Doddi  
> <harish.slicer at gmail.com> wrote:
> > 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
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.html
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100127/5925f66f/attachment.pgp>


More information about the Insight-users mailing list