Skip to content

Commit

Permalink
Add -subsample option for sphere_mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennings Zhang authored and Jennings Zhang committed Jun 2, 2022
1 parent 3127c8b commit 6f0b0b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions civet/extraction/hemisphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class HemisphereMask(GenericMask['HemisphereMask']):
Represents a binary mask of a brain hemisphere (either left or right).
"""

def just_sphere_mesh(self, side: Optional[Side] = None) -> IrregularSurface:
def just_sphere_mesh(self, side: Optional[Side] = None, subsample: bool = False) -> IrregularSurface:
"""
Just run `sphere_mesh`, which produces a mesh with non-standard connectivity.
"""
model = self.get_model_for(side)
return self.prepare_for_sphere_mesh(model).sphere_mesh()
return self.prepare_for_sphere_mesh(model).sphere_mesh(subsample)

def smoothen_using_mincmorph(self, iterations: int = 5, lower: float = 2.5, upper: float = 4.5) -> 'HemisphereMask':
"""
Expand Down Expand Up @@ -96,9 +96,11 @@ class SphereMeshMask:
on a `SurfaceModel`.
"""

def sphere_mesh(self) -> IrregularSurface:
def sphere_mesh(self, subsample: bool = False) -> IrregularSurface:
class SphereMeshSurface(IrregularSurface):
def command(self, output: str | PathLike
) -> Sequence[str | PathLike | AbstractDataCommand]:
if subsample:
return 'sphere_mesh', self.input, output, '-subsample'
return 'sphere_mesh', self.input, output
return SphereMeshSurface(self.sphere_mesh_mask)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name='pycivet',
version='0.0.7',
version='0.0.8',
description='Object-oriented CIVET bindings for Python',
long_description=readme,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 6f0b0b3

Please sign in to comment.