<div dir="ltr">Thank you very much for your answer Bradley, I will have a look at it.<div><br></div><div>-Laurent</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 29, 2014 at 6:34 PM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div class="im"><div>On Jan 29, 2014, at 4:52 PM, Laurent Chauvin <<a href="mailto:lchauvin@bwh.harvard.edu" target="_blank">lchauvin@bwh.harvard.edu</a>> wrote:</div>
<br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Thank you Bradley for your answer.<br>(I think the link to the example is missing. At least I cannot see it. Would it be possible for you to send it again ? Thank you).<br>
</div></div></div></blockquote><div><br></div></div>missing link:<br><div><a href="http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ManuallyRemovingLabels" target="_blank">http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ManuallyRemovingLabels</a></div>
<div class="im"><div><br></div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><br><br>I created an image type, unsigned short with 3 dimensions, and I passed this as input and output type for LabelMapMaskImageFilter (that I typedef MaskFilter). Is it what's required for this filter ?<br>
</div></div></div></blockquote><div><br></div></div><div>No, it expects an itk::LabelMap as the first template argument, and an itk::Image for the second.</div><div><br></div><div>Please read the Insight Journal article to understand itk::LabelMaps:</div>
<div><a href="http://hdl.handle.net/1926/584" style="line-height:22px;color:rgb(70,101,162);font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif;text-decoration:none" target="_blank">http://hdl.handle.net/1926/584</a><span style="line-height:22px;font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif"> </span></div>
<div><span style="line-height:22px;font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif">Brad</span></div><div><div class="h5"><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<br>But when I try to do:<br>
<span style="color:rgb(80,0,80)">  typename MaskFilter::Pointer mFilter = MaskFilter::New();</span><br><font color="#500050"><br></font>I got the error at compilation about LabelObjectType. <br><br>This is how I built all other ITK filters so far. I don't understand why this one is not compiling.<br>

<font color="#500050"><br></font><span style="color:rgb(80,0,80)">Thank you very much.</span><br><span style="color:rgb(80,0,80)">-Laurent</span><br><font color="#500050"><br><br><br></font><span style="color:rgb(80,0,80)">On Wed, Jan 29, 2014 at 4:38 PM, Bradley Lowekamp </span><span dir="ltr" style="color:rgb(80,0,80)"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span><span style="color:rgb(80,0,80)"> wrote:</span><br>

<font color="#500050"><br><br></font><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>
<div class="gmail_extra">
<div class="gmail_quote">Laurent,<br><br>I am moving this question to the ITK users list as JC suggested.<br><br>Your task is well suited to transforming from pixel based work to ITK's LabelMap base selection. It should be faster and reduce memory usage using this approach.<br>

<br>I encourage you to read the Insight Journal article on the LabelMaps there is a lot there are many different ways to put the pieces together.<br><br>The hard part is getting the segmentation done, you seem to indicate that you have done that already thought :)<br>

<br><br>The basic flow is to select "objects" based on a attribute criteria, with an input of a binary image and a output of the same:<br><br>BinaryImageToShapeLabelMapFilter[1]->AttributeOpeningImageFilter[2]->LabelMapToBinaryImageFilter[3]<br>

<br><br>This pipeline is composed into the BinaryShapeOpeningImageFilter[4], but I think you will need to have a couple of AttributeOpening filters in your pipeline, so building the pipeline your self is the flexibility you need for your case.<br>

<br>If all you need is a masked feature image output and not the opened binary image, you what you initially tried, the LabelMapMaskImageFilter[5]<br><br>This is a useful example[6].<br><br>Hope this helps,<br>Brad<br><br>

[1] <a href="http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToShapeLabelMapFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToShapeLabelMapFilter.html</a><br>[2] <a href="http://www.itk.org/Doxygen/html/classitk_1_1AttributeOpeningLabelMapFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1AttributeOpeningLabelMapFilter.html</a><br>

[3] <a href="http://www.itk.org/Doxygen/html/classitk_1_1LabelMapToBinaryImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1LabelMapToBinaryImageFilter.html</a><br>[4] <a href="http://www.itk.org/Doxygen/html/classitk_1_1BinaryShapeOpeningImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1BinaryShapeOpeningImageFilter.html</a><br>

[5] <a href="http://www.itk.org/Doxygen/html/classitk_1_1LabelMapMaskImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1LabelMapMaskImageFilter.html</a><br>[6]<br><br>On Jan 29, 2014, at 3:56 PM, Laurent Chauvin <<a href="mailto:lchauvin@bwh.harvard.edu" target="_blank">lchauvin@bwh.harvard.edu</a>> wrote:<br>

<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word">







<div>Hello Bradley,<br><br>I understand.<br>However my goal is too detect object with a certain number of pixels, and use the other "objects" (bigger or smaller than my range) to mask my original image to remove them, so I would only keep the object with the number of pixel in my range in my image.<br>

<br>I applied a ConnectedComponentImageFilter, and then a RelabelComponentImageFilter to label object by size of pixels.<br>Now from these filter, for each object, I would like to look if the number of pixel is in my range, and if not use the label created by RelabelComponentImageFilter to mask my original image (to remove the object from the original image).<br>

<br>I don't think I can specify a label in MaskImageFilter, can I ?<br><br>Thank you very much.<br>-Laurent<br><br><br>On Wed, Jan 29, 2014 at 3:34 PM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br>

<br><br><blockquote type="cite">
<div class="gmail_extra"><div class="gmail_quote">Hello Laurent,<br><br>The ITK "LabelMap" class is different that the Slicer concept of a label map. The ITK LabelMap is a run-length encode image designed to map label ID to associated data to facilitate label based attribute filtering. This was contributed in an Insight Journal article[1]. There are a great many things that can be efficiently computed in the framework.<br>

<br>You are using it wrong as it's not suppose to work with the ITK Image but the ITK LabelMap class. You are likely looking for just the regular MaskImageFilter[2] in ITK.<br><br>[1] <a href="http://www.insight-journal.org/browse/publication/176" target="_blank">http://www.insight-journal.org/browse/publication/176</a><br>

[2] <a href="http://www.itk.org/Doxygen/html/classitk_1_1MaskImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1MaskImageFilter.html</a><br><br>On Jan 29, 2014, at 3:22 PM, Laurent Chauvin <<a href="mailto:lchauvin@bwh.harvard.edu" target="_blank">lchauvin@bwh.harvard.edu</a>> wrote:<br>

<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div style="word-wrap:break-word">



<div>Hello slicer developers,<br><br>I'm trying to create a CLI that use some itk filters, and it's working, but now I want to include a itkLabelMapMaskImageFilter but I got some errors.<br><br>This is the code:<br>

<br>  const    unsigned int      Dimension  = 3;<br>  typedef unsigned short  IntegralPixelType;<br>  typedef itk::Image<IntegralPixelType, Dimension>  IntegralImageType;<br>  typedef itk::LabelMapMaskImageFilter<IntegralImageType, IntegralImageType> MaskFilter;<br>

<br><br>  // This line create an issue<br>  typename MaskFilter::Pointer mFilter = MaskFilter::New();<br><br><br>Here is the error:<br><br><blockquote type="cite">


<div>


<div><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;border-right-width:1px;border-right-color:rgb(204,204,204);border-right-style:solid;padding-left:1ex;padding-right:1ex">

</blockquote>In file included from /home/snr/Slicer4/Slicer-Debug/ITKv4/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.h:21:0,<br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;border-right-width:1px;border-right-color:rgb(204,204,204);border-right-style:solid;padding-left:1ex;padding-right:1ex">

</blockquote>                 from /home/snr/Slicer4/ExternalModules/PointillismRegistration/PointillismRegistration/PointillismRegistration.cxx:7:<br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;border-right-width:1px;border-right-color:rgb(204,204,204);border-right-style:solid;padding-left:1ex;padding-right:1ex">

</blockquote>/home/snr/Slicer4/Slicer-Debug/ITKv4/Modules/Filtering/LabelMap/include/itkLabelMapFilter.h: In instantiation of ‘class itk::LabelMapFilter<itk::Image<short unsigned int, 3u>, itk::Image<short unsigned int, 3u> >’:<br>

<blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;border-right-width:1px;border-right-color:rgb(204,204,204);border-right-style:solid;padding-left:1ex;padding-right:1ex">

</blockquote>/home/snr/Slicer4/Slicer-Debug/ITKv4/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.h:47:7:   required from ‘class itk::LabelMapMaskImageFilter<itk::Image<short unsigned int, 3u>, itk::Image<short unsigned int, 3u> >’<br>

<blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;border-right-width:1px;border-right-color:rgb(204,204,204);border-right-style:solid;padding-left:1ex;padding-right:1ex">

</blockquote>/home/snr/Slicer4/ExternalModules/PointillismRegistration/PointillismRegistration/PointillismRegistration.cxx:74:22:   required from here<br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;border-right-width:1px;border-right-color:rgb(204,204,204);border-right-style:solid;padding-left:1ex;padding-right:1ex">

</blockquote>/home/snr/Slicer4/Slicer-Debug/ITKv4/Modules/Filtering/LabelMap/include/itkLabelMapFilter.h:80:55: error: no type named ‘LabelObjectType’ in ‘itk::LabelMapFilter<itk::Image<short unsigned int, 3u>, itk::Image<short unsigned int, 3u> >::InputImageType {aka class itk::Image<short unsigned int, 3u>}’<br>




/home/snr/Slicer4/Slicer-Debug/ITKv4/Modules/Filtering/LabelMap/include/itkLabelMapFilter.h:127:37: error: no type named ‘Iterator’ in ‘itk::LabelMapFilter<itk::Image<short unsigned int, 3u>, itk::Image<short unsigned int, 3u> >::InputImageType {aka class itk::Image<short unsigned int, 3u>}’<br>




</div></div></blockquote><br>I'm not sure why LabelObjectType cannot be found in LabelMapFilter (and why it's looking LabelMapFilter for it and not in LabelMapMaskFilter).<br><br>I tried to find examples of code with itkLabelMapMaskImageFilter but I couldn't find any.<br>

<br>Is there something wrong in the class or is it in my code ?<br><br>Thank you.<br>-Laurent<br><br>-- <br>Laurent Chauvin, MS<br>Surgical Navigation and Robotics Laboratory, Radiology Department<br>Brigham And Women's Hospital, Harvard Medical School<br>

<a href="http://wiki.ncigt.org/index.php/User:Lchauvin" target="_blank">http://wiki.ncigt.org/index.php/User:Lchauvin</a><br>_______________________________________________<br>slicer-devel mailing list<br><a href="mailto:slicer-devel@bwh.harvard.edu" target="_blank">slicer-devel@bwh.harvard.edu</a><br>

<a href="http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel" target="_blank">http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel</a><br>To unsubscribe: send email to <a href="mailto:slicer-devel-request@massmail.spl.harvard.edu" target="_blank">slicer-devel-request@massmail.spl.harvard.edu</a> with unsubscribe as the subject<br>

<a href="http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ" target="_blank">http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ</a><br><br><br>The information in this e-mail is intended only for the person to whom it is<br>

addressed. If you believe this e-mail was sent to you in error and the e-mail<br>contains patient information, please contact the Partners Compliance HelpLine at<br><a href="http://www.partners.org/complianceline" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>

but does not contain patient information, please contact the sender and properly<br><div>

dispose of the e-mail.<br></div></div></div></blockquote></div></div></blockquote><br>-- <br>Laurent Chauvin, MS<br>Surgical Navigation and Robotics Laboratory, Radiology Department<br>Brigham And Women's Hospital, Harvard Medical School<br>

<div class="gmail_extra"><div>

<div><a href="http://wiki.ncigt.org/index.php/User:Lchauvin" target="_blank">http://wiki.ncigt.org/index.php/User:Lchauvin</a></div></div>
</div>
</div></div></blockquote></div></div></div></div></blockquote><font color="#500050"><br></font><span style="color:rgb(80,0,80)">-- </span><br><span style="color:rgb(80,0,80)">Laurent Chauvin, MS</span><br><span style="color:rgb(80,0,80)">Surgical Navigation and Robotics Laboratory, Radiology Department</span><br>

<span style="color:rgb(80,0,80)">Brigham And Women's Hospital, Harvard Medical School</span><br><div><div><div class="gmail_extra"><div>
<div><a href="http://wiki.ncigt.org/index.php/User:Lchauvin" target="_blank">http://wiki.ncigt.org/index.php/User:Lchauvin</a></div></div>
</div>
</div></div></div><br><br clear="all"><div><br></div>-- <br><div><div>Laurent Chauvin, MS</div><div>Surgical Navigation and Robotics Laboratory, Radiology Department</div><div>Brigham And Women's Hospital, Harvard Medical School<br>

</div><div><a href="http://wiki.ncigt.org/index.php/User:Lchauvin" target="_blank">http://wiki.ncigt.org/index.php/User:Lchauvin</a></div></div>
</div></div>
</blockquote></div></div></div><br></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Laurent Chauvin, MS</div><div>Surgical Navigation and Robotics Laboratory, Radiology Department</div>
<div>Brigham And Women's Hospital, Harvard Medical School<br></div><div><a href="http://wiki.ncigt.org/index.php/User:Lchauvin" target="_blank">http://wiki.ncigt.org/index.php/User:Lchauvin</a></div></div>
</div>