cortex.segment.init_subject(subject, filenames, do_import_subject=False, **kwargs)[source]

Run the first initial segmentation for a subject’s anatomy (in Freesurfer).

This function creates a Freesurfer subject and runs autorecon-all, then (optionally) imports the subject into the pycortex database.

NOTE: This function requires a functional Freesurfer install! Also, still can’t handle T2 weighted anatomical volume input. Please use Freesurfer directly (and then import) for advanced recon-all input options; this is just a convenience function.


The name of the subject (this subject is created in the Freesurfer SUBJECTS_DIR)

filenamesstr or list

Freesurfer-compatible filename(s) for the anatomical image(s). This can be the first dicom file of a series of dicoms, a nifti file, an mgz file, etc.


Whether to import the Freesurfer-processed subject (without further) editing) into pycortex. False by default, since we recommend editing (or at least inspecting) the brain mask and white matter segmentations prior to importing into pycortex.

kwargskeyword arguments passed to cortex.freesurfer.autorecon()

useful ones: parallel=True, n_cores=4 (or more, if you have them)