fsqc.fsqcUtils

This module provides various import/export functions as well as the ‘levelsetsTria’ function

fsqc.fsqcUtils.applyTransform(img_file, out_file, mat_file, interp)[source]

Apply a transformation to an image.

Parameters:
img_filestr

Input image file path.

out_filestr

Output transformed image file path.

mat_filestr

Transformation matrix file path (must be in xfm or lta format).

interp{‘nearest’, ‘cubic’}

Interpolation method to use.

Returns:
None

This function returns nothing.

fsqc.fsqcUtils.binarizeImage(img_file, out_file, match=None)[source]

Binarize an image and saves the result.

Parameters:
img_filestr

Path to the input image file.

out_filestr

Path to save the binarized image.

matcharray_like or None, optional

Values to consider as True. If None, non-zero values are considered True.

Returns:
None

This function returns nothing.

Notes

This function uses nibabel to load and save NIfTI images.

fsqc.fsqcUtils.importMGH(filename)[source]

A function to read Freesurfer MGH files.

Parameters:
filenamestr

Path to the MGH file.

Returns:
volnumpy.ndarray

3D array containing vol values.

Notes

Requires a valid MGH file. If not found, NaNs will be returned.

fsqc.fsqcUtils.levelsetsTria(v, t, p, levelsets)[source]

Generate intersections of triangles with level sets.

Parameters:
vnumpy.ndarray

Array of vertex coordinates with shape (n, 3).

tnumpy.ndarray

Array of triangles with vertex indices, shape (m, 3).

pnumpy.ndarray

Array of values corresponding to vertex points, shape (n,).

levelsetslist or numpy.ndarray

List or array of level set values.

Returns:
vLVLlist

List of interpolated vertices for each level set.

lLVLlist

List of triangle indices corresponding to the interpolated vertices for each level set.

iLVLlist

List of triangle indices that intersect with the level set.

fsqc.fsqcUtils.readLTA(file)[source]

It reads a LTA (Linear Transform Array) file and extracts transformation information.

Parameters:
filestr

Path to the LTA file.

Returns:
dict

A dictionary containing transformation information, including type, number of transforms, mean, sigma, and transformation matrices for source and destination volumes.

fsqc.fsqcUtils.returnFreeSurferColorLUT()[source]

Provide FreeSurfer color look-up table.

Returns:
numpy.ndarray

This function returns numpy array.