nifti_to_mesh
tit.tools.nifti_to_mesh ¶
Convert a NIfTI segmentation/mask to a surface mesh (.stl or .msh).
remove_small_components ¶
Remove connected components smaller than threshold * largest component.
Parameters¶
mask : ndarray Binary mask array threshold : float Minimum size threshold as fraction of largest component (0-1)
Returns¶
ndarray Cleaned binary mask
Source code in tit/tools/nifti_to_mesh.py
nifti_to_mesh ¶
Convert a NIfTI segmentation/mask to a surface mesh.
Parameters¶
input_file : str or Path Path to input NIfTI file output_file : str or Path, optional Path to output mesh file (.stl or .msh). If None, defaults to input_file with .stl extension clean_components : bool Whether to remove small disconnected components clean_threshold : float Minimum size threshold for component removal (as fraction of largest component)
Returns¶
dict Dictionary with mesh statistics: {'vertices': int, 'faces': int, 'output_file': str}
Source code in tit/tools/nifti_to_mesh.py
save_stl ¶
Save mesh as binary STL format.
Source code in tit/tools/nifti_to_mesh.py
save_gmsh ¶
Save mesh as Gmsh .msh format (v2.2 ASCII).
Source code in tit/tools/nifti_to_mesh.py
main ¶
Command-line interface for converting NIfTI files to meshes.