<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>It appears that you are trying to use some code from my github extension:</div><div><br></div><div><a href="https://github.com/blowekamp/itkOBBLabelMap">https://github.com/blowekamp/itkOBBLabelMap</a></div><div><br></div><div>I am not sure where to begin helping you. You didn't include the run-time error message, and your code fragment is missing key parts. Can you post a minimal compilable example which illustrates the problem? Sometime just narrowing down you code to this part help you figure out your issue.</div><div><br></div><div>Do the tests for the extension pass for you?</div><div><br></div><div>Are you able to run the example?</div><div><br></div><div><a href="https://github.com/blowekamp/itkOBBLabelMap/blob/master/test/itkOBBExample.cxx">https://github.com/blowekamp/itkOBBLabelMap/blob/master/test/itkOBBExample.cxx</a></div><div><br></div><div>Brad</div><div><br></div><div><br><div><div>On Nov 12, 2013, at 1:43 PM, elhadj meljane &lt;<a href="mailto:elhadj.meljane@gmail.com">elhadj.meljane@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"><div>Hi all, <br>I am&nbsp;trying to use itk to select a component from a binary image. The binary image contains several items and I want to separate them in different images.<br>&nbsp;&nbsp; <br>I used the code below but it doesn't work. I got an error message at the run time. It looks from the debugger that the line </div>
<div>&nbsp;</div><div>labelerAttribute-&gt;Update() </div><div>&nbsp;</div><div>causes the error. I gave a valid file as input and&nbsp; checked that ITK reads correctly this file.&nbsp; I would appreciate your help to fix this! </div><p><br>
 #include "itkAttributeImageLabelObject.h"</p><p>const&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;unsigned int&nbsp;&nbsp;&nbsp; Dimension = 2;<br>typedef &nbsp;unsigned char LabelPixelType;<br>typedef &nbsp;itk::Image&lt; LabelPixelType, Dimension &gt;&nbsp; LabelImageType;<br>
typedef &nbsp;unsigned char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputPixelType;<br> typedef &nbsp;itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;<br>typedef&nbsp; &nbsp;itk::ImageFileReader&lt; OutputImageType &gt; ReaderType;<br>typedef&nbsp; &nbsp;itk::ImageFileWriter&lt;&nbsp; OutputImageType&nbsp; &gt; WriterType;<br>
typedef &nbsp;itk::AttributeImageLabelObject&lt; LabelPixelType, Dimension, OutputImageType &gt; LabelObjectAttributeType;<br> typedef &nbsp;itk::LabelMap&lt;LabelObjectAttributeType&gt; LabelMapAttributeType;<br>typedef &nbsp;itk::BinaryImageToShapeLabelMapFilter <br>
&nbsp;&nbsp;&nbsp;&lt;OutputImageType, LabelMapAttributeType&gt;&nbsp; LabelMapperAttributeType;<br>typedef &nbsp;itk::LabelMapToLabelImageFilter&lt;LabelMapAttributeType, OutputImageType&gt; LabelMapToLabelImageFilterType;<br> typedef &nbsp;itk::BoundingBoxImageLabelMapFilter&lt;LabelMapAttributeType&gt; BBILabelMapFilter;<br>
typedef&nbsp; &nbsp;itk::ImageFileWriter&lt;&nbsp; OutputImageType&nbsp; &gt; WriterType;</p><p>ReaderType::Pointer reader = ReaderType::New();</p><p>reader-&gt;SetFileName( argv[1] );<br>&nbsp;<br>LabelMapperAttributeType::Pointer labelerAttribute = LabelMapperAttributeType::New();</p>
<div><br>labelerAttribute-&gt;SetInput( reader-&gt;GetOutput() );<br>labelerAttribute-&gt;SetComputePerimeter( false ); <br> labelerAttribute-&gt;SetOutputBackgroundValue(0); <br>labelerAttribute-&gt;Update();</div><div>&nbsp;</div>
<div>&nbsp;</div><div>//select the item with the label 1</div><p>const LabelObjectAttributeType* labelObjectAttribute = toBBILabelMap-&gt;GetOutput()-&gt;GetLabelObject(1);</p><p>BBILabelMapFilter::Pointer toBBILabelMap =&nbsp; BBILabelMapFilter::New();<br>
toBBILabelMap-&gt;SetInput(labelMapAttribute);<br>toBBILabelMap-&gt;Update();</p><p><br>Thanks.<br>Best <br><span><font color="#888888">EM </font></span></p></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://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-developers<br></blockquote></div><br></div></body></html>