Add round() when loading NIfTI for atlas building#14
Open
anniegbryant wants to merge 2 commits into
Open
Conversation
Simple update to round data when loading in a NIfTI volume, in the case where segment indices are stored as floats rather than ints per voxel (could either be in raw data itself or introduced as part of interpolation)
…tlas This commit adds a test script to specifically check subcortical atlas building functionality that uses the proposed round() addition to account for float imprecision during conversion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @teanijarv and collaborators, thank you for sharing this amazing package! So useful and exceptionally well-documented, with a straightforward user interface and high-quality renderings 😊
While noodling around with the
build_subcortical_atlasfunction across a variety of subcortical atlases, I found that no meshes were created for one atlas. Upon inspection, at least when loaded withnibabel, the voxel index values were floats instead of integers (e.g., 2.99999 when the index should just be 3). I believe this arises from issues with float format and precision.As a proposed fix for that case (which other volumes may also encounter), I've added a
.round()function call when loading in the NIfTI volume inbuild_subcortical_atlas. This change is in line 292 ofatlas_builder.py. I also added a new testing scripttests/test_atlas_builder.pyand confirmed all tests passed withuvon my end.Hope this is helpful, and I'm very happy to tweak if needed.
Cheers,
Annie 😊