Skip to content

Do not round images on resample.#126

Merged
36000 merged 1 commit into
tractometry:mainfrom
arokem:no_round_on_resample
Dec 3, 2025
Merged

Do not round images on resample.#126
36000 merged 1 commit into
tractometry:mainfrom
arokem:no_round_on_resample

Conversation

@arokem

@arokem arokem commented Dec 2, 2025

Copy link
Copy Markdown
Member

Fixes #125.

Copilot AI review requested due to automatic review settings December 2, 2025 02:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #125 by removing rounding during image resampling operations, allowing interpolated image values to be preserved more accurately. The change affects the _resample_image helper function which is used when resampling images to match DWI data dimensions.

Key changes:

  • Removed np.round() from the resampling pipeline to preserve continuous interpolated values
  • Cleaned up trailing whitespace in docstrings for RoiImage and GQImage classes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@36000

36000 commented Dec 3, 2025

Copy link
Copy Markdown
Collaborator

LGTM!

@36000
36000 merged commit d1d1446 into tractometry:main Dec 3, 2025
14 of 15 checks passed
@arokem

arokem commented Dec 4, 2025

Copy link
Copy Markdown
Member Author

Do you happen to remember why that round was there in the first place?

@36000

36000 commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator

The blame says it was put in in 2022, when i first added the definitions file. It is possible I copied it over from whatever code was doing that previously. I am not sure why I initially added it.

My guess is that it was naively there to preserve either labels or binary images. In the case of labels, any input labels in the current code get converted to binary first. In the case of binary, arguably you don't want to round. So, I don't really see its use, and it is definitely wrong for any floating point image.

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.

Importing images from other derivative pipelines

3 participants