brainprint.surfaces

Utility module holding surface generation related functions.

brainprint.surfaces.create_aseg_surface(subject_dir, destination, indices)[source]

Generate a surface from the aseg and label files.

Parameters:
subject_dirPath

Path to the subject’s directory.

destinationPath

Path to the destination directory where the surface will be saved.

indiceslist[int]

List of label indices to include in the surface generation.

Returns:
Path

Path to the generated surface in VTK format.

brainprint.surfaces.create_aseg_surfaces(subject_dir, destination)[source]

Create surfaces from FreeSurfer aseg labels.

Parameters:
subject_dirPath

Path to the subject’s FreeSurfer directory.

destinationPath

Path to the destination directory for saving surfaces.

Returns:
dict[str, Path]

Dictionary of label names mapped to corresponding surface Path objects.

brainprint.surfaces.create_cortical_surfaces(subject_dir, destination)[source]

Create cortical surfaces from FreeSurfer labels.

Parameters:
subject_dirPath

Path to the subject’s FreeSurfer directory.

destinationPath

Path to the destination directory where the surfaces will be saved.

Returns:
dict[str, Path]

Dictionary mapping label names to associated surface Paths.

brainprint.surfaces.create_surfaces(subject_dir, destination, skip_cortex=False)[source]

Create surfaces based on FreeSurfer labels.

Parameters:
subject_dirPath

Path to the subject’s FreeSurfer directory.

destinationPath

Path to the destination directory where the surfaces will be saved.

skip_cortexbool, optional

If True, cortical surfaces will not be created (default is False).

Returns:
dict[str, Path]

Dict mapping label names to the corresponding Path objects of created surfaces.

brainprint.surfaces.read_vtk(path)[source]

Read a VTK file and return a triangular mesh.

Parameters:
pathPath

Path to the VTK file to be read.

Returns:
TriaMesh

A triangular mesh object representing the contents of the VTK file.

Raises:
RuntimeError

If there is an issue reading the VTK file or if the file is empty.

brainprint.surfaces.surf_to_vtk(source, destination)[source]

Converted a FreeSurfer .surf file to .vtk.

Parameters:
sourcePath

FreeSurfer .surf file.

destinationPath

Equivalent .vtk file.

Returns:
Path

Resulting .vtk file.