nipy / nibabel

Python package to access a cacophony of neuro-imaging file formats
http://nipy.org/nibabel/
Other
649 stars 258 forks source link

ENH: Add TriangularMesh data structure [BIAP9] #1257

Open effigies opened 1 year ago

effigies commented 1 year ago

1251 Added Pointset and Grid. #1090 also proposes TriangularMesh, but with the refactoring seen in #1251, that seemed like a bit of extra work for minimal benefit to the transformations use-case. This PR re-adds triangular meshes.

Overall, the approach of multiple names feels clunky and pushes the concerns of surface families into pointsets. #1251 removed that, and this PR extends this by keeping TriangularMesh focused on the base data structure and moves TriangularMeshFamily logic into a CoordinateFamilyMixin class that permits swapping out coordinates with a .with_name() method (open to bikeshedding). Hence, we would change:

left_surfaces.get_coords(name='pial')

to:

left_surfaces.with_name('pial').get_coords()

It also follows the lead of Grid and gets rid of the omni-__init__ in favor of targeted factory classmethods.


Notes from previous discussion:

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02% :tada:

Comparison is base (4e7ad07) 92.19% compared to head (368c145) 92.22%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1257 +/- ## ========================================== + Coverage 92.19% 92.22% +0.02% ========================================== Files 99 99 Lines 12458 12496 +38 Branches 2560 2565 +5 ========================================== + Hits 11486 11524 +38 Misses 648 648 Partials 324 324 ``` | [Files Changed](https://app.codecov.io/gh/nipy/nibabel/pull/1257?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nipy) | Coverage Δ | | |---|---|---| | [nibabel/pointset.py](https://app.codecov.io/gh/nipy/nibabel/pull/1257?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nipy#diff-bmliYWJlbC9wb2ludHNldC5weQ==) | `99.16% <100.00%> (+0.38%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.