workflows.smri.freesurfer.recon¶
create_reconall_workflow()
¶
Creates the ReconAll workflow in Nipype. This workflow is designed to run the same commands as FreeSurfer’s reconall script but with the added features that a Nipype workflow provides. Before running this workflow, it is necessary to have the FREESURFER_HOME environmental variable set to the directory containing the version of FreeSurfer to be used in this workflow.
Example¶
>>> from nipype.workflows.smri.freesurfer import create_reconall_workflow
>>> recon_all = create_reconall_workflow()
>>> recon_all.inputs.inputspec.subject_id = 'subj1'
>>> recon_all.inputs.inputspec.subjects_dir = '.'
>>> recon_all.inputs.inputspec.T1_files = 'T1.nii.gz'
>>> recon_flow.run()
- Inputs::
- inputspec.subjects_dir : subjects directory (mandatory) inputspec.subject_id : name of subject (mandatory) inputspec.T1_files : T1 files (mandatory) inputspec.T2_file : T2 file (optional) inputspec.FLAIR_file : FLAIR file (optional) inputspec.cw256 : Conform inputs to 256 FOV (optional) inputspec.num_threads: Number of threads on nodes that utilize OpenMP (default=1) plugin_args : Dictionary of plugin args to set to nodes that utilize OpenMP (optional)
- Outpus::
- postdatasink_outputspec.subject_id : name of the datasinked output folder in the subjects directory
Note: The input subject_id is not passed to the commands in the workflow. Commands that require subject_id are reading implicit inputs from {SUBJECTS_DIR}/{subject_id}. For those commands the subject_id is set to the default value and SUBJECTS_DIR is set to the node directory. The implicit inputs are then copied to the node directory in order to mimic a SUBJECTS_DIR structure. For example, if the command implicitly reads in brainmask.mgz, the interface would copy that input file to {node_dir}/{subject_id}/mri/brainmask.mgz and set SUBJECTS_DIR to node_dir. The workflow only uses the input subject_id to datasink the outputs to {subjects_dir}/{subject_id}.
Graph¶
create_skullstripped_recon_flow()
¶
Performs recon-all on voulmes that are already skull stripped. FreeSurfer failes to perform skullstrippig on some volumes (especially MP2RAGE). This can be avoided by doing skullstripping before runnig recon-all (using for example SPECTRE algorithm)
Example¶
>>> from nipype.workflows.smri.freesurfer import create_skullstripped_recon_flow
>>> recon_flow = create_skullstripped_recon_flow()
>>> recon_flow.inputs.inputspec.subject_id = 'subj1'
>>> recon_flow.inputs.inputspec.T1_files = 'T1.nii.gz'
>>> recon_flow.run()
- Inputs::
- inputspec.T1_files : skullstripped T1_files (mandatory) inputspec.subject_id : freesurfer subject id (optional) inputspec.subjects_dir : freesurfer subjects directory (optional)
Outputs:
outputspec.subject_id : freesurfer subject id
outputspec.subjects_dir : freesurfer subjects directory