8000 DOC: First pass at SurfaceImage BIAP by effigies · Pull Request #1056 · nipy/nibabel · GitHub
[go: up one dir, main page]

Skip to content

DOC: First pass at SurfaceImage BIAP #1056

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

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cb7d7d3
DOC: First pass at SurfaceImage BIAP
effigies Sep 17, 2021
ea2a466
DOC: Address suggestions
effigies Sep 29, 2021
0f4fddc
DOC: Clarify use cases are motivating, not necessarily implementation…
effigies Oct 8, 2021
3b2b575
DOC: Small updates
effigies Oct 8, 2021
9ddbcc7
DOC: Update BIAP with a couple examples leading to further questions
effigies Oct 8, 2021
27fd6f4
DOC: Separate Geometry and Header objects
effigies Oct 8, 2021
3e89a50
DOC: Smoothing example, typo
effigies Oct 20, 2021
b51e7a0
ENH: First pass at surfaceimage template classes
effigies Oct 20, 2021
0f72055
TEST: Build HDF5/Numpy-based surface classes
effigies Oct 21, 2021
408a227
DOC: Add VolumeGeometry stub
effigies Nov 5, 2021
79a801e
DOC: Fix header formatting
effigies Nov 5, 2021
eabc77f
TEST: Example FreeSurfer subject (not fitting into class hierarchy)
effigies Nov 5, 2021
199547f
DOC: Add concatenable structure proposal
effigies Nov 5, 2021
efef027
ENH: Add structure collection API
effigies Nov 5, 2021
d88c7c6
TEST: Rewrite FreeSurferSubject as GeometryCollection
effigies Nov 5, 2021
25e6d52
ENH: Possible VolumeGeometry
effigies Nov 5, 2021
e6be497
STY: Geometry -> Pointset
effigies Nov 8, 2021
3f62a80
Rename SurfaceGeometry to TriangularMesh
effigies Nov 19, 2021
dcd2050
FIX: FreeSurfer example implementation
effigies Nov 19, 2021
ff19edc
ENH: Flesh out VolumeGeometry
effigies Nov 19, 2021
4af4897
BIAP: Add SurfaceHeader.get_geometry() method
effigies Nov 19, 2021
a3adfe7
Rename Geometry -> Pointset
effigies Jan 14, 2022
e278981
DOC: Commit current thinking on BIAP0009
effigies Feb 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename SurfaceGeometry to TriangularMesh
  • Loading branch information
effigies committed Nov 19, 2021
commit 3f62a80250fa2f6363bd678a6c16d71e002cdaed
4 changes: 2 additions & 2 deletions doc/source/devel/biaps/biap_0009.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ The basic API is as follows:
""" Nx3 array of coordinates in RAS+ space """


class SurfaceGeometry(Geometry):
class TriangularMesh(Geometry):
@property
def n_triangles(self):
""" Number of faces """
Expand All @@ -146,7 +146,7 @@ The basic API is as follows:
"""

def decimate(self, *, n_coords=None, ratio=None):
""" Return a SurfaceHeader with a smaller number of vertices that
""" Return a TriangularMesh with a smaller number of vertices that
preserves the geometry of the original """
# To be overridden when a format provides optimization opportunities

Expand Down
13 changes: 8 additions & 5 deletions nibabel/surfaceimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ def n_coords(self):
"""
return self.get_coords().shape[0]

class SurfaceGeometry(Pointset):

class TriangularMesh(Pointset):
""" A triangular mesh is a description of a surface tesselated into triangles """

def __init__(self, meshes=None):
""" Surface header objects have access to an internal
""" Triangular mesh objects have access to an internal
``_meshes`` dictionary that has keys that are mesh names.
The values may be any structure that permits the class to
provide coordinates and triangles on request.
Expand Down Expand Up @@ -73,7 +76,7 @@ def get_names(self):
return list(self._meshes.keys())

def decimate(self, *, ncoords=None, ratio=None):
""" Return a SurfaceHeader with a smaller number of vertices that
""" Return a TriangularMesh with a smaller number of vertices that
preserves the geometry of the original.

Please contribute a generic decimation algorithm at
Expand All @@ -93,7 +96,7 @@ def load_face_data(self, pathlike):
class SurfaceHeader(FileBasedHeader):
""" Template class to implement SurfaceHeader protocol """
def get_geometry(self):
""" Generate ``SurfaceGeometry`` object from header object
""" Generate ``TriangularMesh`` object from header object

If no default geometry can be provided, returns ``None``.
"""
Expand Down Expand Up @@ -157,7 +160,7 @@ def from_spec(klass, pathlike):
raise NotImplementedError


class GeometrySequence(GeometryCollection, Pointset):
class PointsetSequence(GeometryCollection, Pointset):
def __init__(self, structures=()):
super().__init__(structures)
self._indices = {}
Expand Down
7 changes: 2 additions & 5 deletions nibabel/tests/test_surfaceimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __slicer__(self, slicer):
return h5f[self.dataset_name][slicer]


class H5Geometry(SurfaceGeometry):
class H5Geometry(TriangularMesh):
"""Simple Geometry file structure that combines a single topology
with one or more coordinate sets
"""
Expand All @@ -57,7 +57,6 @@ def from_filename(klass, pathlike):
for name, coords in h5f['coordinates'].items():
meshes[name] = (coords, triangles)
return klass(meshes)


def to_filename(self, pathlike):
topology = None
Expand All @@ -75,14 +74,12 @@ def to_filename(self, pathlike):
for name, coord in coordinates.items():
h5f.create_dataset(f"/coordinates/{name}", coord)


def get_coords(self, name=None):
if name is None:
name = next(iter(self._meshes))
coords, _ = self._meshes[name]
return coords


def get_triangles(self, name=None):
if name is None:
name = next(iter(self._meshes))
Expand Down Expand Up @@ -163,7 +160,7 @@ def triangles(self):
return ap


class FreeSurferHemisphere(SurfaceGeometry):
class FreeSurferHemisphere(TriangularMesh):
@classmethod
def from_filename(klass, pathlike):
path = Path(pathlike)
Expand Down
0