# cortex.freesurfer.flatten¶

cortex.freesurfer.flatten(fs_subject, hemi, patch, freesurfer_subject_dir=None, save_every=None)[source]

Perform flattening of a brain using freesurfer

Parameters
fs_subjectstr

Freesurfer subject ID

hemistr [‘lh’ | ‘rh’]

hemisphere to flatten

patchstr

name for freesurfer patch (used as name argument to format output of get_paths())

freesurfer_subject_dirstr

Freesurfer subjects directory location. None defaults to \$SUBJECTS_DIR

save_every: int

If not None, this saves a version of the mesh every save_every iterations of the flattening process. Useful for determining why a flattening fails.

Notes

To look into: link below shows how to give continuous output for a subprocess. There maybe indications that a flattening is going badly that we could detect in the stdout; perhaps even continuously update a visualization of the generated files using segment.show_surface() with the outputs (triggered to update once stdout shows that a flattening iteration has completed) https://stackoverflow.com/questions/4417546/constantly-print-subprocess-output-while-process-is-running