[Insight-users] Extracting each connected component of a binary image

Bradley Lowekamp blowekamp at mail.nih.gov
Sat Sep 14 06:22:24 EDT 2013


Hello,

I have an ITK extension which does what Richard suggests:

https://github.com/blowekamp/itkOBBLabelMap

I believe this test does what you want:

https://github.com/blowekamp/itkOBBLabelMap/blob/master/test/itkBoundingBoxImageLabelMapFilterTest.cxx

Also in the module is the computation of Oriented Bounding Boxes based on the orientation of the second movements. And similarly there is a way to extract the resampled images. However, there is an issue with the lack of thread safely with the interpolator, so a line needs to currently be commented out of OBB image.

I'd recommend writing a test to validate the results are as expected before using it.

Let me know if it works for you.

Brad

On Sep 14, 2013, at 1:32 AM, Richard Beare <richard.beare at gmail.com> wrote:

> The label map tools make it easy to construct this kind of facility, with bounding box computation and other useful options. There is also AutoCropLabelMapFilter which may be a useful starting point.
> 
> 
> On Sat, Sep 14, 2013 at 6:41 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> As far as I know, there is not an ITK filter that will extract N
> images from a label image. You could use itkThresholdImageFilter to
> extract each label.
> 
> On Fri, Sep 13, 2013 at 4:33 PM, Pol Monsó <pol.monso+tools at gmail.com> wrote:
> > Hi,
> >
> > I've searching how to extract each connected component of a binary image
> > such as
> > http://blogs.mathworks.com/images/steve/2008/binary_indexed_vis_01.png
> > into a separate image through the ConnectedComponentFilter (or maybe the
> > labelmap?)
> >
> > I've seen how to extract the largest one on the examples, but I couldn't see
> > how to iterate over the image to extract each one of them into a separate
> > image. I could iterate over the image checking pixelvalues, but that does
> > not seem efficient and I suspect there's another way to do this.
> >
> > It looks that the ChangeLabelImageFilter should be able to do it but I
> > couldn't figure out how. A short example would be perfect, or a pointer to
> > how to iterate over the connected components.
> >
> > Cheers,
> >
> > Pol
> >
> > _____________________________________
> > 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.php
> >
> > 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
> >
> 
> 
> 
> --
> Unpaid intern in BillsBasement at noware dot com
> _____________________________________
> 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.php
> 
> 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.php
> 
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130914/ca3fd93d/attachment.htm>


More information about the Insight-users mailing list