brainprint.brainprint

Definition of the brainprint analysis execution functions..

brainprint.brainprint.apply_eigenvalues_options(eigenvalues, triangular_mesh, norm='none', reweight=False)[source]

Apply BrainPrint analysis configuration options to the ShapeDNA eigenvalues.

Parameters:
eigenvaluesnp.ndarray

ShapeDNA derived eigenvalues.

triangular_meshTriaMesh

Surface representation.

normstr, optional

Eigenvalues normalization method (default is “none”).

reweightbool, optional

Whether to reweight eigenvalues or not (default is False).

Returns:
np.ndarray

Fixed eigenvalues.

brainprint.brainprint.compute_brainprint(surfaces, keep_eigenvectors=False, num=50, norm='none', reweight=False, use_cholmod=False)[source]

Compute ShapeDNA descriptors over several surfaces.

Parameters:
surfacesdict[str, Path]

Dictionary mapping from labels to .vtk paths.

keep_eigenvectorsbool, optional

Whether to also return eigenvectors or not, by default False.

numint, optional

Number of eigenvalues to compute, by default 50.

normstr, optional

Eigenvalues normalization method, by default “none”.

reweightbool, optional

Whether to reweight eigenvalues or not, by default False.

use_cholmodbool, optional

If True, attempts to use the Cholesky decomposition for improved execution speed. Requires the scikit-sparse library. If it can not be found, an error will be thrown. If False, will use slower LU decomposition. This is the default.

Returns:
tuple[dict[str, np.ndarray], Union[dict[str, np.ndarray], None]]

Surface label to eigenvalues, surface label to eigenvectors (if keep_eigenvectors is True).

brainprint.brainprint.compute_surface_brainprint(path, return_eigenvectors=True, num=50, norm='none', reweight=False, use_cholmod=False)[source]

Compute BrainPrint eigenvalues and eigenvectors for the given surface.

Parameters:
pathPath

Path to the .vtk surface path.

return_eigenvectorsbool, optional

Whether to store eigenvectors in the result (default is True).

numint, optional

Number of eigenvalues to compute (default is 50).

normstr, optional

Eigenvalues normalization method (default is “none”).

reweightbool, optional

Whether to reweight eigenvalues or not (default is False).

use_cholmodbool, optional

If True, attempts to use the Cholesky decomposition for improved execution speed. Requires the scikit-sparse library. If it can not be found, an error will be thrown. If False, will use slower LU decomposition. This is the default.

Returns:
tuple[np.ndarray, Union[np.ndarray, None]]

Eigenvalues, eigenvectors (if returned).

brainprint.brainprint.run_brainprint(subjects_dir, subject_id, destination=None, num=50, skip_cortex=False, keep_eigenvectors=False, norm='none', reweight=False, asymmetry=False, asymmetry_distance='euc', keep_temp=False, use_cholmod=False)[source]

Run the BrainPrint analysis.

Parameters:
subjects_dirPath

FreeSurfer’s subjects directory.

subject_idstr

The subject identifier, as defined within the FreeSurfer’s subjects directory.

destinationPath, optional

If provided, will use this path as the results root directory, by default None.

numint, optional

Number of eigenvalues to compute, by default 50.

skip_cortexbool, optional

_description_, by default False.

keep_eigenvectorsbool, optional

Whether to also return eigenvectors or not, by default False.

normstr, optional

Eigenvalues normalization method, by default “none”.

reweightbool, optional

Whether to reweight eigenvalues or not, by default False.

asymmetrybool, optional

Whether to calculate asymmetry between lateral structures, by default False.

asymmetry_distancestr, optional

Distance measurement to use if asymmetry is set to True, by default “euc”.

keep_tempbool, optional

Whether to keep the temporary files directory or not, by default False.

use_cholmodbool, optional

If True, attempts to use the Cholesky decomposition for improved execution speed. Requires the scikit-sparse library. If it can not be found, an error will be thrown. If False, will use slower LU decomposition. This is the default.

Returns:
Tuple[Dict[str, np.ndarray], Union[Dict[str, np.ndarray], None], Union[Dict[str, float], None]]

A tuple containing dictionaries with BrainPrint analysis results. - Eigenvalues - Eigenvectors - Distances