[ITK Community] [Insight-users] [slicer-devel] itkLabelMapMaskImageFilter issue

Laurent Chauvin lchauvin at bwh.harvard.edu
Thu Jan 30 18:22:34 EST 2014


Thank you very much for your answer Bradley, I will have a look at it.

-Laurent


On Wed, Jan 29, 2014 at 6:34 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>wrote:

>
> On Jan 29, 2014, at 4:52 PM, Laurent Chauvin <lchauvin at bwh.harvard.edu>
> wrote:
>
> Thank you Bradley for your answer.
> (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).
>
>
> missing link:
> http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ManuallyRemovingLabels
>
>
>
> 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 ?
>
>
> No, it expects an itk::LabelMap as the first template argument, and an
> itk::Image for the second.
>
> Please read the Insight Journal article to understand itk::LabelMaps:
> http://hdl.handle.net/1926/584
> Brad
>
>
> But when I try to do:
>   typename MaskFilter::Pointer mFilter = MaskFilter::New();
>
> I got the error at compilation about LabelObjectType.
>
> This is how I built all other ITK filters so far. I don't understand why
> this one is not compiling.
>
> Thank you very much.
> -Laurent
>
>
>
> On Wed, Jan 29, 2014 at 4:38 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>wrote:
>
>
>  Laurent,
>>
>> I am moving this question to the ITK users list as JC suggested.
>>
>> 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.
>>
>> 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.
>>
>> The hard part is getting the segmentation done, you seem to indicate that
>> you have done that already thought :)
>>
>>
>> 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:
>>
>>
>> BinaryImageToShapeLabelMapFilter[1]->AttributeOpeningImageFilter[2]->LabelMapToBinaryImageFilter[3]
>>
>>
>> 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.
>>
>> If all you need is a masked feature image output and not the opened
>> binary image, you what you initially tried, the LabelMapMaskImageFilter[5]
>>
>> This is a useful example[6].
>>
>> Hope this helps,
>> Brad
>>
>> [1]
>> http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToShapeLabelMapFilter.html
>> [2]
>> http://www.itk.org/Doxygen/html/classitk_1_1AttributeOpeningLabelMapFilter.html
>> [3]
>> http://www.itk.org/Doxygen/html/classitk_1_1LabelMapToBinaryImageFilter.html
>> [4]
>> http://www.itk.org/Doxygen/html/classitk_1_1BinaryShapeOpeningImageFilter.html
>> [5]
>> http://www.itk.org/Doxygen/html/classitk_1_1LabelMapMaskImageFilter.html
>> [6]
>>
>> On Jan 29, 2014, at 3:56 PM, Laurent Chauvin <lchauvin at bwh.harvard.edu>
>> wrote:
>>
>>
>>  Hello Bradley,
>>>
>>> I understand.
>>> 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.
>>>
>>> I applied a ConnectedComponentImageFilter, and then a
>>> RelabelComponentImageFilter to label object by size of pixels.
>>> 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).
>>>
>>> I don't think I can specify a label in MaskImageFilter, can I ?
>>>
>>> Thank you very much.
>>> -Laurent
>>>
>>>
>>> On Wed, Jan 29, 2014 at 3:34 PM, Bradley Lowekamp <
>>> blowekamp at mail.nih.gov> wrote:
>>>
>>>
>>> Hello Laurent,
>>>
>>> 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.
>>>
>>> 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.
>>>
>>> [1] http://www.insight-journal.org/browse/publication/176
>>> [2] http://www.itk.org/Doxygen/html/classitk_1_1MaskImageFilter.html
>>>
>>> On Jan 29, 2014, at 3:22 PM, Laurent Chauvin <lchauvin at bwh.harvard.edu>
>>> wrote:
>>>
>>>
>>>  Hello slicer developers,
>>>>
>>>> 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.
>>>>
>>>> This is the code:
>>>>
>>>>   const    unsigned int      Dimension  = 3;
>>>>   typedef unsigned short  IntegralPixelType;
>>>>   typedef itk::Image<IntegralPixelType, Dimension>  IntegralImageType;
>>>>   typedef itk::LabelMapMaskImageFilter<IntegralImageType,
>>>> IntegralImageType> MaskFilter;
>>>>
>>>>
>>>>   // This line create an issue
>>>>   typename MaskFilter::Pointer mFilter = MaskFilter::New();
>>>>
>>>>
>>>> Here is the error:
>>>>
>>>>  In file included from
>>>> /home/snr/Slicer4/Slicer-Debug/ITKv4/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.h:21:0,
>>>>
>>>>>                  from
>>>> /home/snr/Slicer4/ExternalModules/PointillismRegistration/PointillismRegistration/PointillismRegistration.cxx:7:
>>>>
>>>>> /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> >':
>>>>
>>>>> /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> >'
>>>>
>>>>> /home/snr/Slicer4/ExternalModules/PointillismRegistration/PointillismRegistration/PointillismRegistration.cxx:74:22:
>>>>   required from here
>>>>
>>>>> /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>}'
>>>> /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>}'
>>>>
>>>>
>>>> I'm not sure why LabelObjectType cannot be found in LabelMapFilter (and
>>>> why it's looking LabelMapFilter for it and not in LabelMapMaskFilter).
>>>>
>>>> I tried to find examples of code with itkLabelMapMaskImageFilter but I
>>>> couldn't find any.
>>>>
>>>> Is there something wrong in the class or is it in my code ?
>>>>
>>>> Thank you.
>>>> -Laurent
>>>>
>>>> --
>>>> Laurent Chauvin, MS
>>>> Surgical Navigation and Robotics Laboratory, Radiology Department
>>>> Brigham And Women's Hospital, Harvard Medical School
>>>> http://wiki.ncigt.org/index.php/User:Lchauvin
>>>> _______________________________________________
>>>> slicer-devel mailing list
>>>> slicer-devel at bwh.harvard.edu
>>>> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
>>>> To unsubscribe: send email to
>>>> slicer-devel-request at massmail.spl.harvard.edu with unsubscribe as the
>>>> subject
>>>>
>>>> http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
>>>>
>>>>
>>>> The information in this e-mail is intended only for the person to whom
>>>> it is
>>>> addressed. If you believe this e-mail was sent to you in error and the
>>>> e-mail
>>>> contains patient information, please contact the Partners Compliance
>>>> HelpLine at
>>>> http://www.partners.org/complianceline . If the e-mail was sent to you
>>>> in error
>>>> but does not contain patient information, please contact the sender and
>>>> properly
>>>> dispose of the e-mail.
>>>>
>>>
>>> --
>>> Laurent Chauvin, MS
>>> Surgical Navigation and Robotics Laboratory, Radiology Department
>>> Brigham And Women's Hospital, Harvard Medical School
>>>  http://wiki.ncigt.org/index.php/User:Lchauvin
>>>
>>
> --
> Laurent Chauvin, MS
> Surgical Navigation and Robotics Laboratory, Radiology Department
> Brigham And Women's Hospital, Harvard Medical School
> http://wiki.ncigt.org/index.php/User:Lchauvin
>
>
>
> --
> Laurent Chauvin, MS
> Surgical Navigation and Robotics Laboratory, Radiology Department
> Brigham And Women's Hospital, Harvard Medical School
> http://wiki.ncigt.org/index.php/User:Lchauvin
>
>
>


-- 
Laurent Chauvin, MS
Surgical Navigation and Robotics Laboratory, Radiology Department
Brigham And Women's Hospital, Harvard Medical School
http://wiki.ncigt.org/index.php/User:Lchauvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140130/baee4144/attachment-0002.html>
-------------- next part --------------
_____________________________________
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


More information about the Community mailing list