# itk::RelabelComponentImageFilter::GetSizeOfObjectInPhysicalUnits signature

**URL:** <https://discourse.itk.org/t/itk-getsizeofobjectinphysicalunits-signature/7237>\
**Category:** Algorithms\
**Created:** [October 1, 2024, 3:07pm UTC](https://discourse.itk.org/t/itk-getsizeofobjectinphysicalunits-signature/7237 "2024-10-01T15:07:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cg2](https://discourse.itk.org/user_avatar/discourse.itk.org/cg2/32/1298_2.png) [@cg2](https://discourse.itk.org/u/cg2)\
**Post date:** [October 1, 2024, 3:07pm UTC](https://discourse.itk.org/t/itk-getsizeofobjectinphysicalunits-signature/7237/1 "2024-10-01T15:07:53Z")

</div>

Hi,

After the detection of of a signedness comparison error during the compilation of RelabelComponentImageFilter:

```auto
ITK-5.2/itkRelabelComponentImageFilter.h:228:24: error: comparison of integer expressions of different signedness: ‘itk::RelabelComponentImageFilter<itk::Image<short int, 3>, itk::Image<short int, 3> >::LabelType’ {aka ‘short int’} and ‘const SizeValueType’ {aka ‘const long unsigned int’} [-Werror=sign-compare]
  228 | if (obj > 0 && obj <= m_NumberOfObjects)

```

I realized that the `GetSizeOfObjectInPhysicalUnits` signature expects a `LabelType=InputPixelType` parameter. Does it make sense since we are accessing a `std::vector<float>` by index? I would have expected something like `ObjectSizeType` or `itk::IdentifierType`…

I’m sure I’m missing something. Thanks for your help.

Best Regards,

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [October 1, 2024, 3:20pm UTC](https://discourse.itk.org/t/itk-getsizeofobjectinphysicalunits-signature/7237/2 "2024-10-01T15:20:53Z")

</div>

You are right, that should be `SizeValueType`, as per:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/3b04ad1b377c6d5d77a2c1f454c363eab8197340/Modules/Segmentation/ConnectedComponents/include/itkRelabelComponentImageFilter.h#L284>

Can you make a PR?

---

<div class="post-metadata">

**Author:** ![cg2](https://discourse.itk.org/user_avatar/discourse.itk.org/cg2/32/1298_2.png) [@cg2](https://discourse.itk.org/u/cg2)\
**Post date:** [October 1, 2024, 7:41pm UTC](https://discourse.itk.org/t/itk-getsizeofobjectinphysicalunits-signature/7237/4 "2024-10-01T19:41:04Z")

</div>

> <https://github.com/InsightSoftwareConsortium/ITK/pull/4866>
>
> \* Update parameter type to reflect underlying container indexing
> 
> Fixes #4865
> …
> 
> \<!-- The text within this markup is a comment, and is intended to provide
> guidelines to open a Pull Request for the ITK repository. This text will not
> be part of the Pull Request. --\>
> 
> 
> \<!-- See the CONTRIBUTING (CONTRIBUTING.md) guide. Specifically:
> 
> Start ITK commit messages with a standard prefix (and a space):
> 
> \* BUG: fix for runtime crash or incorrect result
> \* COMP: compiler error or warning fix
> \* DOC: documentation change
> \* ENH: new functionality
> \* PERF: performance improvement
> \* STYLE: no logic impact (indentation, comments)
> \* WIP: Work In Progress not ready for merge
> 
> Provide a short, meaningful message that describes the change you made.
> 
> When the PR is based on a single commit, the commit message is usually left as
> the PR message.
> 
> A reference to a related issue or pull request (https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests)
> in your repository. You can automatically
> close a related issues using keywords (https://help.github.com/articles/closing-issues-using-keywords/)
> 
> @mentions (https://help.github.com/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams)
> of the person or team responsible for reviewing proposed changes. --\>
> 
> \## PR Checklist
> 
> There is a public API change as the parameter type is changed.
> 
> \- \[\] No \[API changes\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md#breaking-changes) were made (or the changes have been approved)
> \- \[x\] No \[major design changes\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md#design-changes) were made (or the changes have been approved)
> 
> 
> Refer to the \[ITK Software Guide\](https://itk.org/ItkSoftwareGuide.pdf) for
> further development details if necessary.

---

<div class="post-metadata">

**Author:** ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)\
**Post date:** [October 1, 2024, 10:43pm UTC](https://discourse.itk.org/t/itk-getsizeofobjectinphysicalunits-signature/7237/5 "2024-10-01T22:43:51Z")

</div>

Thanks for addressing this issue @cg2.

I’m not entirely sure, but my guess it that `LabelType` is usually an _unsigned_ integer type. I mean, intuitively you would use natural numbers to label objects, `1`, `2`, `3`, … right? So then the label image ( `itk::Image`) would almost naturally have an _unsigned_ integer type as pixel type.

That might explain why these errors did not occur before. But I’m just guessing.
