<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>I have an ITK extension which does what Richard suggests:</div><div><br></div><div><a href="https://github.com/blowekamp/itkOBBLabelMap">https://github.com/blowekamp/itkOBBLabelMap</a></div><div><br></div><div>I believe this test does what you want:</div><div><br></div><div><a href="https://github.com/blowekamp/itkOBBLabelMap/blob/master/test/itkBoundingBoxImageLabelMapFilterTest.cxx">https://github.com/blowekamp/itkOBBLabelMap/blob/master/test/itkBoundingBoxImageLabelMapFilterTest.cxx</a></div><div><br></div><div>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.</div><div><br></div><div>I'd recommend writing a test to validate the results are as expected before using it.</div><div><br></div><div>Let me know if it works for you.</div><div><br></div><div>Brad</div><div><br><div><div>On Sep 14, 2013, at 1:32 AM, Richard Beare &lt;<a href="mailto:richard.beare@gmail.com">richard.beare@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><div dir="ltr">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.</div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sat, Sep 14, 2013 at 6:41 AM, Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As far as I know, there is not an ITK filter that will extract N<br>
images from a label image. You could use itkThresholdImageFilter to<br>
extract each label.<br>
<div><div class="h5"><br>
On Fri, Sep 13, 2013 at 4:33 PM, Pol Monsó &lt;<a href="mailto:pol.monso%2Btools@gmail.com">pol.monso+tools@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I've searching how to extract each connected component of a binary image<br>
&gt; such as<br>
&gt; <a href="http://blogs.mathworks.com/images/steve/2008/binary_indexed_vis_01.png" target="_blank">http://blogs.mathworks.com/images/steve/2008/binary_indexed_vis_01.png</a><br>
&gt; into a separate image through the ConnectedComponentFilter (or maybe the<br>
&gt; labelmap?)<br>
&gt;<br>
&gt; I've seen how to extract the largest one on the examples, but I couldn't see<br>
&gt; how to iterate over the image to extract each one of them into a separate<br>
&gt; image. I could iterate over the image checking pixelvalues, but that does<br>
&gt; not seem efficient and I suspect there's another way to do this.<br>
&gt;<br>
&gt; It looks that the ChangeLabelImageFilter should be able to do it but I<br>
&gt; couldn't figure out how. A short example would be perfect, or a pointer to<br>
&gt; how to iterate over the connected components.<br>
&gt;<br>
&gt; Cheers,<br>
&gt;<br>
&gt; Pol<br>
&gt;<br>
</div></div>&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br></div>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></div></body></html>