Skip to content

COMP: Drop use of itk::Math::Absolute to fix compilation warnings#916

Merged
SimonRit merged 1 commit intoRTKConsortium:mainfrom
SimonRit:absolute
Mar 5, 2026
Merged

COMP: Drop use of itk::Math::Absolute to fix compilation warnings#916
SimonRit merged 1 commit intoRTKConsortium:mainfrom
SimonRit:absolute

Conversation

@SimonRit
Copy link
Collaborator

@SimonRit SimonRit commented Mar 5, 2026

InsightSoftwareConsortium/ITK#5802 and #904 have triggered new warnings such as

[CTest: warning matched] /home/srit/src/rtk/dashboard_tests/RTK/include/rtkJosephBackProjectionImageFilter.hxx:277:28: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  277 |         for (int i{ 0 }; i < itk::Math::Absolute(fs - ns) - 1; ++i)

The new behavior is intentional but returning an unsigned is problematic in this case as we subtract 1 from it. So we now use std::abs throughout the code

@SimonRit
Copy link
Collaborator Author

SimonRit commented Mar 5, 2026

See discourse discussion https://discourse.itk.org/t/how-to-best-handle-itk-absolute/7724 on this topic.

InsightSoftwareConsortium/ITK#5802 and RTKConsortium#904 have triggered new warnings
such as
```
[CTest: warning matched] /home/srit/src/rtk/dashboard_tests/RTK/include/rtkJosephBackProjectionImageFilter.hxx:277:28: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  277 |         for (int i{ 0 }; i < itk::Math::Absolute(fs - ns) - 1; ++i)
```
The new behavior is intentional but returning an unsigned is problematic in
this case as we subtract 1 from it. So we now use `std::abs` throughout the
code
@SimonRit
Copy link
Collaborator Author

SimonRit commented Mar 5, 2026

Failing test is due to recent changes in CudaCommon, will be fixed with #906 when CudaCommon is released (soon)

@SimonRit SimonRit merged commit 3936486 into RTKConsortium:main Mar 5, 2026
28 of 34 checks passed
@SimonRit SimonRit deleted the absolute branch March 5, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant