Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the return type of multiply_image_and_position() #288

Merged
merged 4 commits into from
May 3, 2024

Conversation

thawn
Copy link
Collaborator

@thawn thawn commented Apr 28, 2024

for images of type int8, multiply_image_and_position was limited to positions < 256 (and for int16 to positions < 2^16), because the return type was the same as the image type. However int8 images can have positions larger than that because position indices are of type int32. This pull request ensures that the return type is at least int32 so that multiply_image_and_position can handle positions larger than the maximum integer for int8 and int16 images.

closes issue tier1::multiply_image_and_position_func() implicitly assumes that the position has the same type as the input. #287

for images of type int8, multiply_image_and_position was limited to positions < 256 (and for int16 to positions < 2^16), because the return type was the same as the image type. However int8 images can have positions larger than that because position indices are of type int32. This commit ensures that the return type is at least int32 so that multiply_image_and_position can handle positions larger than the maximum integer for int8 and int16 images.

closes issue tier1::multiply_image_and_position_func() implicitly assumes that the position has the same type as the input. #287
@thawn thawn requested a review from StRigaud April 28, 2024 14:15
@StRigaud
Copy link
Member

I don't know why the tests are failing as it does not look like your PR touched anything that could break them...

that way, the output type is well defined and we do not risk rounding errors in functions that have floating point input, such as center_of_mass()
@StRigaud
Copy link
Member

StRigaud commented May 1, 2024

Its good to merge with the exception that the CI/CD for the tests and coverage is dead.
I will see to fix this or find an alternative solution in the comming days

we now rely on multiply_image_and_position() to return FLOAT values
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 50.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 55.61%. Comparing base (953d400) to head (fb25f14).

Files Patch % Lines
clic/src/tier3/bounding_box.cpp 0.00% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #288      +/-   ##
==========================================
+ Coverage   55.60%   55.61%   +0.01%     
==========================================
  Files         232      232              
  Lines        3705     3704       -1     
  Branches     1473     1472       -1     
==========================================
  Hits         2060     2060              
  Misses        493      493              
+ Partials     1152     1151       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@StRigaud
Copy link
Member

StRigaud commented May 2, 2024

This can be merge :)
Thanks @thawn !

@thawn thawn merged commit 384f6c0 into master May 3, 2024
5 checks passed
@thawn thawn deleted the fix_multiply_image_and_position_return_type branch May 3, 2024 08:06
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.

None yet

3 participants