Skip to content

Add round() when loading NIfTI for atlas building#14

Open
anniegbryant wants to merge 2 commits into
teanijarv:mainfrom
anniegbryant:main
Open

Add round() when loading NIfTI for atlas building#14
anniegbryant wants to merge 2 commits into
teanijarv:mainfrom
anniegbryant:main

Conversation

@anniegbryant
Copy link
Copy Markdown

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_atlas function across a variety of subcortical atlases, I found that no meshes were created for one atlas. Upon inspection, at least when loaded with nibabel, 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 in build_subcortical_atlas. This change is in line 292 of atlas_builder.py. I also added a new testing script tests/test_atlas_builder.py and confirmed all tests passed with uv on my end.

Hope this is helpful, and I'm very happy to tweak if needed.

Cheers,
Annie 😊

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
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.

1 participant