# label map overlay .. I dont' understand the problem ?

**URL:** <https://discourse.itk.org/t/label-map-overlay-i-dont-understand-the-problem/950>\
**Category:** Beginner Questions\
**Tags:** simpleitk, python\
**Created:** [May 25, 2018, 10:29am UTC](https://discourse.itk.org/t/label-map-overlay-i-dont-understand-the-problem/950 "2018-05-25T10:29:45Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [May 25, 2018, 6:11pm UTC](https://discourse.itk.org/t/label-map-overlay-i-dont-understand-the-problem/950/4 "2018-05-25T18:11:03Z")

</div>

> [@rcatwood](#):
>
> Yes, that clarifies things a little … now it’s at least as clear as mud 🙂 ! I.e I can make my code work but now I think its done the wrong way … It sounds like I really should be using the LabelMapImage in the first place; once obtaining a binary threshold with separated objects and applying some connected components and then wanting to filter on various attributes e.g. roundness, touching boundary, etc. on images or timeseries that will be a lot bigger than the test case. So runlength encoded storage for manipulating these things makes a lot of sense. Which is why I would have thought I had such a creature already; what is the output of ConnectedComponents and why isn’t it one of those??

At first in ITK there was just the regular images then the LabelMap module was contributed to ITK via the Insight Journal: [http://hdl.handle.net/1926/584](http://hdl.handle.net/1926/584) As the ConnectedComponentsI and the BinaryImageToLabelMap filters produce different output data structures, why both have their purpose.

> [@rcatwood](#):
>
> I have implemented the same project before, a long time ago , in ITK C++ version 3 and it’s mostly a lot easier in Simpleitk+Python … but there’s (a) lots of changes, ok , for the better! but, (b) not clear explanation, please see the Doxygen for ConnectedComponents ?

Great to hear that it is easier and for the better! 🙂

As I just said in [another thread](https://discourse.itk.org/t/python-sitk-extractimagefilter-basic-usage-help/949/4)

> We really should be doing better with our SimpleITK Doxygen. As of right now the description for the filters are just taken from ITK, with all the features exposed from the C++ interface. We should really mark this as coming for C++ ITK, and provide brief info about the SimpleITK simplification done, or implementation choices made.

However, for the ConnectedComponents doxygen, the filter does not talk about C++ or features that have been simplified for the interface, so I am no sure why you reference this [particular one](https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1ConnectedComponentImageFilter.html)?

> [@rcatwood](#):
>
> So do I now understand that the output of LabelIntensityStatisticsImageFilter is actually one of the “LabelMap Image” objects, which could be overlain directly by the previous filter? But can you use ChangeLabel filter on it, it seems like it wants the “Label Image” ??

The LabelMap version of `ConnectedComponentsImageFilter` is `BinaryImageToLabelMapImageFilter` and the LabelMap version of `ChangeLabelImageFilter` is `ChangeLabelLabelMapFilter`. So the output of BinaryImageToLabelMapFilter can be used as input to the ChangeLabelIamgeFilter. That is not a typeo, Label is repeated in the filter name, the ITK naming conventions follow strict conventions. They make since, _really_ then do.

So… The SimpleITK filter [sitk::LabelIntensityStatisticsImageFilter](https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1LabelIntensityStatisticsImageFilter.html) is a case where the Doxygen was taken from the underlying ITK class, [itk::LabelImageToStatisticsLabelMapFilter](https://www.itk.org/Doxygen/html/classitk_1_1LabelImageToStatisticsLabelMapFilter.html) and it is not good to say the least, combined with that little changes that SimpleITK made to the interface it is now double-plus not good. For SimpleITK filter, this is a case where the input is not a LabelMap but a scalar label image, and there is no output image/LabelMap. The computed statistics are just available with Get methods of the filter after execution.

Hope that helps.

---

_[View the full topic](https://discourse.itk.org/t/label-map-overlay-i-dont-understand-the-problem/950)._
