civet.obj

Defines types related to surface meshes (.obj file format).

 1"""
 2Defines types related to surface meshes (`.obj` file format).
 3"""
 4from civet.xfm import TransformableMixin
 5from civet.minc import GenericMask
 6from typing import TypeVar, Generic, ClassVar
 7from dataclasses import dataclass
 8
 9_S = TypeVar('_S', bound='GenericSurface')
10_M = TypeVar('_M', bound=GenericMask)
11
12
13@dataclass(frozen=True)
14class GenericSurface(TransformableMixin[_S], Generic[_S]):
15    preferred_suffix: ClassVar[str] = '.obj'
16    transform_program: ClassVar[str] = 'transform_objects'
17
18    def surface_mask2(self, in_volume: _M) -> _M:
19        def command(output):
20            return 'surface_mask2', in_volume, self, output
21        return in_volume.create_command(command)
22
23    def adapt_object_mesh(self, target_points: int, n_iterations: int, n_adapt: int, n_adapt_smooth: int) -> _S:
24        def command(output):
25            return 'adapt_object_mesh', self, output, \
26                str(target_points), str(n_iterations), str(n_adapt), str(n_adapt_smooth)
27        return self.create_command(command)
28
29
30class Surface(GenericSurface['Surface']):
31    """
32    Represents a polygonal mesh of a brain surface in `.obj` file format.
33    """
34    pass
@dataclass(frozen=True)
class GenericSurface(civet.xfm.TransformableMixin[~_S], typing.Generic[~_S]):
14@dataclass(frozen=True)
15class GenericSurface(TransformableMixin[_S], Generic[_S]):
16    preferred_suffix: ClassVar[str] = '.obj'
17    transform_program: ClassVar[str] = 'transform_objects'
18
19    def surface_mask2(self, in_volume: _M) -> _M:
20        def command(output):
21            return 'surface_mask2', in_volume, self, output
22        return in_volume.create_command(command)
23
24    def adapt_object_mesh(self, target_points: int, n_iterations: int, n_adapt: int, n_adapt_smooth: int) -> _S:
25        def command(output):
26            return 'adapt_object_mesh', self, output, \
27                str(target_points), str(n_iterations), str(n_adapt), str(n_adapt_smooth)
28        return self.create_command(command)
GenericSurface(input: str | os.PathLike | civet.abstract_data.AbstractDataCommand)
preferred_suffix: ClassVar[str] = '.obj'

Preferred output path suffix for this command.

transform_program: ClassVar[str] = 'transform_objects'

Specifies which program is used to transform objects of this type.

def surface_mask2(self, in_volume: ~_M) -> ~_M:
19    def surface_mask2(self, in_volume: _M) -> _M:
20        def command(output):
21            return 'surface_mask2', in_volume, self, output
22        return in_volume.create_command(command)
def adapt_object_mesh( self, target_points: int, n_iterations: int, n_adapt: int, n_adapt_smooth: int) -> ~_S:
24    def adapt_object_mesh(self, target_points: int, n_iterations: int, n_adapt: int, n_adapt_smooth: int) -> _S:
25        def command(output):
26            return 'adapt_object_mesh', self, output, \
27                str(target_points), str(n_iterations), str(n_adapt), str(n_adapt_smooth)
28        return self.create_command(command)
31class Surface(GenericSurface['Surface']):
32    """
33    Represents a polygonal mesh of a brain surface in `.obj` file format.
34    """
35    pass

Represents a polygonal mesh of a brain surface in .obj file format.