brain_deer.infrastructure.io.mesh¶
Load cortical / anatomical surface meshes for 3D display (GIfTI, OBJ, STL, VTK, FreeSurfer ASCII).
Functions¶
|
Map mesh vertices from NIfTI world mm into BrainDeer centred scene mm. |
|
Normalize a NIfTI image or explicit shape/spacing/affine into a scene reference. |
|
Load a surface mesh into |
Module Contents¶
- brain_deer.infrastructure.io.mesh.apply_mesh_to_reference_space(poly: vtk.vtkPolyData, *, reference_shape: tuple[int, int, int], reference_spacing: tuple[float, float, float], reference_affine: numpy.ndarray) vtk.vtkPolyData¶
Map mesh vertices from NIfTI world mm into BrainDeer centred scene mm.
- brain_deer.infrastructure.io.mesh.resolve_mesh_reference(*, reference_nifti: Any = None, reference_shape: tuple[int, int, int] | None = None, reference_spacing: tuple[float, float, float] | None = None, reference_affine: Any = None) tuple[tuple[int, int, int], tuple[float, float, float], numpy.ndarray] | None¶
Normalize a NIfTI image or explicit shape/spacing/affine into a scene reference.
- brain_deer.infrastructure.io.mesh.load_mesh_for_3d(path: str, *, center: bool = False, reference_nifti: Any = None, reference_shape: tuple[int, int, int] | None = None, reference_spacing: tuple[float, float, float] | None = None, reference_affine: Any = None, bake_reference_transform: bool = True) MeshLoadResult¶
Load a surface mesh into
vtkPolyDatafor Simple3DPlanes.Vertices are treated as RAS+ world millimetres (same convention as NIfTI affines / FreeSurfer / GIfTI). When a reference is provided and
bake_reference_transformis True, they are mapped into the centred VTK scene frame used by slice planes. Prefer leaving vertices in world mm and applyingSimple3DPlanes.world_to_scene_user_matrix()on the actor when the reference volume may change.