Freesurfer methods#

This module calls freesurfer methods.

src_rec.freesurfer.init_fs_paths(fs_path, anatomy_path)#

Runs freesurfer initialization steps. These are mandatory for successfull freesurfer exection.

Parameters:
  • fs_path (string) – Path to the freesurfer folder. Should contain the ‘bin’ folder, your license.txt, and sources.sh.

  • anatomy_path (string) – Path to the anatomy folder. This folder should contain a sub-folder for each subject, to be pupulated with the corresponding structural data.

src_rec.freesurfer.extract_mri_anatomy(anatomy_path, subj_name, t1_scan_file, fiducials_file=None, fiducials_path=None, overwrite=False)#

Extracts anatomical structures from an mri scan using freesurfer.

Parameters:
  • anatomy_path (string) – Path to the anatomy folder. This folder should contain a sub-folder for each subject, to be pupulated with the corresponding structural data.

  • subj_name (string) – Name of the subject.

  • t1_scan_file (string) – Name of the mri file.

  • fiducials_file (string) – Name of the fiducials file. If none is present, default fiducials are morphed from fs-average, defaults to None.

  • fiducials_path (string) – Path to the fiducials file. If none is present, default fiducials are morphed from fs-average, defaults to None.

  • overwrite (boolean) – Flag whether to overwrite the files of the respective subject folder already exists, defaults to False.

src_rec.freesurfer.copy_fsavg_anatomy(fs_path, anatomy_path, subj_name, overwrite=False)#

In case no mri scans are available for this subject, fs-average is used as a reference template.

Parameters:
  • fs_path (string) – Path to the freesurfer folder. Should contain the ‘bin’ folder, your license.txt, and sources.sh.

  • anatomy_path (string) – Path to the anatomy folder. This folder should contain a sub-folder for each subject, to be pupulated with the corresponding structural data.

  • subj_name (string) – Name of the subject.

  • overwrite (boolean) – Flag whether to overwrite the files of the respective subject folder already exists, defaults to False.

src_rec.freesurfer.extract_skull_skin(anatomy_path, subject_name, preflood_height=25, overwrite=False)#

Employs freesufers watershed algorithm to calculate skull and skin models.

Parameters:
  • anatomy_path (string) – Path to the anatomy folder. This folder should contain a sub-folder for each subject, to be pupulated with the corresponding structural data.

  • subject_name (string) – Subject name.

  • preflood_height (int) – Freesurfer parameter. May need adjusting if segmentation doesn’t work properly.

  • overwrite (boolean) – Flag to overwrite if files are already present. Defaults to False.

src_rec.freesurfer._create_fiducials(in_path, out_path, subj_name)#

Reads fiducials from fs-average and transforms them from fs-average space into subject space.

Parameters:
  • in_path (string) – Path to the src folder.

  • out_path (string) – Path to the tgt folder.

  • subj_name (string) – Name of the subject.

src_rec.freesurfer._format_fiducials(pre_mri_ref_pts)#

Transforms an mne-fiducials object into an dictionary containing the fiducials.

Parameters:

pre_mri_ref_pts (list of dict(), obtained via mne.io.read_fiducials) – MNE-formatted list of MRI fiducials.

Returns:

mri_ref_pts – MRI reference points for coregistration.

Return type:

dict(), (‘LPA’, ‘NASION’, ‘RPA’)