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: Compute origin using largest possible region #1072

Merged
merged 4 commits into from
Mar 5, 2024
Merged

fix: Compute origin using largest possible region #1072

merged 4 commits into from
Mar 5, 2024

Conversation

ramonemiliani93
Copy link

Fixes #1065.

@ramonemiliani93 ramonemiliani93 marked this pull request as draft February 27, 2024 18:38
@ramonemiliani93
Copy link
Author

@thewtex I have a couple of questions before tackling the negative indices issue:

  1. Would it be okay to always compute the origin using the index of the largest possible region? Or would this be sub-optimal in terms of performance?
  2. Could you guide me on how to add a test? 😬 I'm a bit new to this, so any references or guides on best practices and how to proceed would be greatly appreciated! 🙌

@thewtex
Copy link
Member

thewtex commented Feb 27, 2024

@ramonemiliani93 thank you! 🙏

Would it be okay to always compute the origin using the index of the largest possible region? Or would this be sub-optimal in terms of performance?

Yes, the patch looks great. There should not be a significant performance impact.

Could you guide me on how to add a test? 😬 I'm a bit new to this, so any references or guides on best practices and how to proceed would be greatly appreciated! 🙌

Yes, you could add a test similar to this:

https://github.com/InsightSoftwareConsortium/itk-wasm/blob/main/test/itkWasmImageInterfaceTest.cxx

which is configured in the build here:

https://github.com/InsightSoftwareConsortium/itk-wasm/blob/50bbd4f21970c4b881ac68375b2399065648f885/test/CMakeLists.txt#L101-L108

You could add a pad filter in the new test and check that the origin of the output is expected. ITK's test driver has --compare functionality that checks metadata in addition to the pixel data. The baseline image content link would be added here:

https://github.com/InsightSoftwareConsortium/itk-wasm/tree/main/test/Baseline

To generate a content link, use https://content-link-upload.itk.org/

More information on how the data is handled can be found here: https://docs.itk.org/en/latest/contributing/data.html

🙌

@thewtex thewtex marked this pull request as ready for review February 27, 2024 21:03
@thewtex thewtex marked this pull request as draft February 27, 2024 21:03
@ramonemiliani93
Copy link
Author

@thewtex Thanks a lot 🙌 I'll take a look and update the PR 💪

@ramonemiliani93
Copy link
Author

@thewtex Added the test with the files and updated the testings deps 🙌 Let me know if I have to update things to follow the contributing guidelines or any naming convention 💪

@thewtex
Copy link
Member

thewtex commented Mar 4, 2024

@ramonemiliani93 looks excellent!

One minor tweak: the file:

DATA{Input/negative_idx_padded.mha}

could be moved to:

DATA{Baseline/negative_idx_padded.mha}

since it is a baseline, i.e. expected output, test image.

@ramonemiliani93 ramonemiliani93 marked this pull request as ready for review March 4, 2024 19:07
Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

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

@ramonemiliani93 well done! 👏

Failing native Python CI builds are unrelated.

I will update the docker images in another PR.

@thewtex thewtex merged commit 51a93b5 into InsightSoftwareConsortium:main Mar 5, 2024
113 of 125 checks passed
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.

Handling negative indices on WebAssembly memory IO
2 participants