-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update voxel / world method #28
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #28 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 8 8
Lines 440 503 +63
=========================================
+ Hits 440 503 +63
|
Starting to review this but needs a merge from main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fundamentally looks good to me, just one suggested test if you have the inclination to figure it out
world_to_voxel(voxel_coord, nii_affine) | ||
|
||
|
||
class TestAfidVoxel2World: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add a round-trip test that confirms that going back and forth yields a value close to the original (I think numpy has some method for "floats approximately equal"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some tests for this, though really had to loosen the approximation for the world_to_voxel
round trip tests to pass. I think this is a combination of the rounding errors and also a lack of constraints on the affine matrix.
- Also rename strategies to following SearchStrategy convention
f29da5d
to
1aa990a
Compare
- renamed valid_coords() -> valid_position_coords() - added strategy for generating valid_voxel_coords() - constrained coords to be about 90mm (in either direction) or 200 voxels - added strategy for generating afid_voxels - removed obsolete world_coords strategy (replaced by afid_positions)
Note to self to check transformation methods (can refer to nibabel docs) |
Note: `world_to_voxel` round trip required very loose approximation, due to lack of constraints in generated transformation and rounding errors
fdbd218
to
9005dc3
Compare
Proposed changes
This updates the methods for transforming from world-to-voxel coordinates and also adds in method for voxel-to-world coordinates. Also updates to return either an AfidPosition or AfidVoxel as needed instead of a numpy array of values. This still retains using of NumPy, which is helpful for manipulating matrices.
I debated adding this as a method of either the AfidPosition or AfidVoxel class, but opted against it for now. Open for discussion on this though.
Types of changes
What types of changes does your code introduce? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you are unsure about any of the choices, don't hesitate to ask!poe quality
taskNotes
All PRs will undergo the unit testing before being reviewed. You may be requested to explain or make additional changes before the PR is accepted.