NIPY logo
Home · Quickstart · Documentation · Citation · NiPy
Loading

Table Of Contents

Versions

ReleaseDevel
0.9.11.0-dev
Download Github

Links

interfaces.freesurfer.preprocess

ApplyVolTransform

Link to code

Wraps command mri_vol2vol

Use FreeSurfer mri_vol2vol to apply a transform.

Examples

>>> from nipype.interfaces.freesurfer import ApplyVolTransform
>>> applyreg = ApplyVolTransform()
>>> applyreg.inputs.source_file = 'structural.nii'
>>> applyreg.inputs.reg_file = 'register.dat'
>>> applyreg.inputs.transformed_file = 'struct_warped.nii'
>>> applyreg.inputs.fs_target = True
>>> applyreg.cmdline
'mri_vol2vol --fstarg --reg register.dat --mov structural.nii --o struct_warped.nii'

Inputs:

[Mandatory]
fs_target: (a boolean)
        use orig.mgz from subject in regfile as target
        mutually_exclusive: target_file, tal, fs_target
        requires: reg_file
fsl_reg_file: (an existing file name)
        fslRAS-to-fslRAS matrix (FSL format)
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject
reg_file: (an existing file name)
        tkRAS-to-tkRAS matrix (tkregister2 format)
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject
reg_header: (a boolean)
        ScannerRAS-to-ScannerRAS matrix = identity
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject
source_file: (an existing file name)
        Input volume you wish to transform
subject: (a string)
        set matrix = identity and use subject for any templates
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject
tal: (a boolean)
        map to a sub FOV of MNI305 (with --reg only)
        mutually_exclusive: target_file, tal, fs_target
target_file: (an existing file name)
        Output template volume
        mutually_exclusive: target_file, tal, fs_target
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
xfm_reg_file: (an existing file name)
        ScannerRAS-to-ScannerRAS matrix (MNI format)
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject

[Optional]
args: (a string)
        Additional parameters to the command
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
fs_target: (a boolean)
        use orig.mgz from subject in regfile as target
        mutually_exclusive: target_file, tal, fs_target
        requires: reg_file
fsl_reg_file: (an existing file name)
        fslRAS-to-fslRAS matrix (FSL format)
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
interp: ('trilin' or 'nearest' or 'cubic')
        Interpolation method (<trilin> or nearest)
inverse: (a boolean)
        sample from target to source
invert_morph: (a boolean)
        Compute and use the inverse of the non-linear morph to resample the
        input volume. To be used by --m3z.
        requires: m3z_file
m3z_file: (a file name)
        This is the morph to be applied to the volume. Unless the morph is
        in mri/transforms (eg.: for talairach.m3z computed by reconall), you
        will need to specify the full path to this morph and use the
        --noDefM3zPath flag.
no_ded_m3z_path: (a boolean)
        To be used with the m3z flag. Instructs the code not to look for
        them3z morph in the default location
        (SUBJECTS_DIR/subj/mri/transforms), but instead just use the path
        indicated in --m3z.
        requires: m3z_file
no_resample: (a boolean)
        Do not resample; just change vox2ras matrix
reg_file: (an existing file name)
        tkRAS-to-tkRAS matrix (tkregister2 format)
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject
reg_header: (a boolean)
        ScannerRAS-to-ScannerRAS matrix = identity
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject
source_file: (an existing file name)
        Input volume you wish to transform
subject: (a string)
        set matrix = identity and use subject for any templates
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject
subjects_dir: (an existing directory name)
        subjects directory
tal: (a boolean)
        map to a sub FOV of MNI305 (with --reg only)
        mutually_exclusive: target_file, tal, fs_target
tal_resolution: (a float)
        Resolution to sample when using tal
target_file: (an existing file name)
        Output template volume
        mutually_exclusive: target_file, tal, fs_target
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
transformed_file: (a file name)
        Output volume
xfm_reg_file: (an existing file name)
        ScannerRAS-to-ScannerRAS matrix (MNI format)
        mutually_exclusive: reg_file, fsl_reg_file, xfm_reg_file,
         reg_header, subject

Outputs:

transformed_file: (an existing file name)
        Path to output file if used normally

BBRegister

Link to code

Wraps command bbregister

Use FreeSurfer bbregister to register a volume to the Freesurfer anatomical.

This program performs within-subject, cross-modal registration using a boundary-based cost function. The registration is constrained to be 6 DOF (rigid). It is required that you have an anatomical scan of the subject that has already been recon-all-ed using freesurfer.

Examples

>>> from nipype.interfaces.freesurfer import BBRegister
>>> bbreg = BBRegister(subject_id='me', source_file='structural.nii', init='header', contrast_type='t2')
>>> bbreg.cmdline
'bbregister --t2 --init-header --reg structural_bbreg_me.dat --mov structural.nii --s me'

Inputs:

[Mandatory]
contrast_type: ('t1' or 't2')
        contrast type of image
init: ('spm' or 'fsl' or 'header')
        initialize registration spm, fsl, header
        mutually_exclusive: init_reg_file
init_reg_file: (an existing file name)
        existing registration file
        mutually_exclusive: init
source_file: (a file name)
        source file to be registered
subject_id: (a string)
        freesurfer subject id
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

[Optional]
args: (a string)
        Additional parameters to the command
contrast_type: ('t1' or 't2')
        contrast type of image
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
epi_mask: (a boolean)
        mask out B0 regions in stages 1 and 2
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
init: ('spm' or 'fsl' or 'header')
        initialize registration spm, fsl, header
        mutually_exclusive: init_reg_file
init_reg_file: (an existing file name)
        existing registration file
        mutually_exclusive: init
intermediate_file: (an existing file name)
        Intermediate image, e.g. in case of partial FOV
out_fsl_file: (a boolean or a file name)
        write the transformation matrix in FSL FLIRT format
out_reg_file: (a file name)
        output registration file
reg_frame: (an integer)
        0-based frame index for 4D source file
        mutually_exclusive: reg_middle_frame
reg_middle_frame: (a boolean)
        Register middle frame of 4D source file
        mutually_exclusive: reg_frame
registered_file: (a boolean or a file name)
        output warped sourcefile either True or filename
source_file: (a file name)
        source file to be registered
spm_nifti: (a boolean)
        force use of nifti rather than analyze with SPM
subject_id: (a string)
        freesurfer subject id
subjects_dir: (an existing directory name)
        subjects directory
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

Outputs:

min_cost_file: (an existing file name)
        Output registration minimum cost file
out_fsl_file: (a file name)
        Output FLIRT-style registration file
out_reg_file: (an existing file name)
        Output registration file
registered_file: (a file name)
        Registered and resampled source file

DICOMConvert

Link to code

Wraps command mri_convert

use fs mri_convert to convert dicom files

Examples

>>> from nipype.interfaces.freesurfer import DICOMConvert
>>> cvt = DICOMConvert()
>>> cvt.inputs.dicom_dir = 'dicomdir'
>>> cvt.inputs.file_mapping = [('nifti', '*.nii'), ('info', 'dicom*.txt'), ('dti', '*dti.bv*')]

Inputs:

[Mandatory]
base_output_dir: (a directory name)
        directory in which subject directories are created
dicom_dir: (an existing directory name)
        dicom directory from which to convert dicom files
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

[Optional]
args: (a string)
        Additional parameters to the command
base_output_dir: (a directory name)
        directory in which subject directories are created
dicom_dir: (an existing directory name)
        dicom directory from which to convert dicom files
dicom_info: (an existing file name)
        File containing summary information from mri_parse_sdcmdir
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
file_mapping: (a list of items which are a tuple of the form: (a
         string, a string))
        defines the output fields of interface
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
ignore_single_slice: (a boolean)
        ignore volumes containing a single slice
        requires: dicom_info
out_type: ('cor' or 'mgh' or 'mgz' or 'minc' or 'analyze' or
         'analyze4d' or 'spm' or 'afni' or 'brik' or 'bshort' or 'bfloat' or
         'sdt' or 'outline' or 'otl' or 'gdf' or 'nifti1' or 'nii' or
         'niigz', nipype default value: niigz)
        defines the type of output file produced
seq_list: (a list of items which are a string)
        list of pulse sequence names to be converted.
        requires: dicom_info
subject_dir_template: (a string, nipype default value: S.%04d)
        template for subject directory name
subject_id
        subject identifier to insert into template
subjects_dir: (an existing directory name)
        subjects directory
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

Outputs:

None

FitMSParams

Link to code

Wraps command mri_ms_fitparms

Estimate tissue paramaters from a set of FLASH images.

Examples

>>> from nipype.interfaces.freesurfer import FitMSParams
>>> msfit = FitMSParams()
>>> msfit.inputs.in_files = ['flash_05.mgz', 'flash_30.mgz']
>>> msfit.inputs.out_dir = 'flash_parameters'
>>> msfit.cmdline
'mri_ms_fitparms  flash_05.mgz flash_30.mgz flash_parameters'

Inputs:

[Mandatory]
in_files: (a list of items which are an existing file name)
        list of FLASH images (must be in mgh format)
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

[Optional]
args: (a string)
        Additional parameters to the command
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
flip_list: (a list of items which are an integer)
        list of flip angles of the input files
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
in_files: (a list of items which are an existing file name)
        list of FLASH images (must be in mgh format)
out_dir: (a directory name)
        directory to store output in
subjects_dir: (an existing directory name)
        subjects directory
te_list: (a list of items which are a float)
        list of TEs of the input files (in msec)
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
tr_list: (a list of items which are an integer)
        list of TRs of the input files (in msec)
xfm_list: (a list of items which are an existing file name)
        list of transform files to apply to each FLASH image

Outputs:

pd_image: (an existing file name)
        image of estimated proton density values
t1_image: (an existing file name)
        image of estimated T1 relaxation values
t2star_image: (an existing file name)
        image of estimated T2* values

MRIConvert

Link to code

Wraps command mri_convert

use fs mri_convert to manipulate files

Note

Adds niigz as an output type option

Examples

>>> mc = MRIConvert()
>>> mc.inputs.in_file = 'structural.nii'
>>> mc.inputs.out_file = 'outfile.mgz'
>>> mc.inputs.out_type = 'mgz'
>>> mc.cmdline
'mri_convert --out_type mgz --input_volume structural.nii --output_volume outfile.mgz'

Inputs:

[Mandatory]
in_file: (an existing file name)
        File to read/convert
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

[Optional]
apply_inv_transform: (an existing file name)
        apply inverse transformation xfm file
apply_transform: (an existing file name)
        apply xfm file
args: (a string)
        Additional parameters to the command
ascii: (a boolean)
        save output as ascii col>row>slice>frame
autoalign_matrix: (an existing file name)
        text file with autoalign matrix
color_file: (an existing file name)
        color file
conform: (a boolean)
        conform to 256^3
conform_min: (a boolean)
        conform to smallest size
conform_size: (a float)
        conform to size_in_mm
crop_center: (a tuple of the form: (an integer, an integer, an
         integer))
        <x> <y> <z> crop to 256 around center (x, y, z)
crop_gdf: (a boolean)
        apply GDF cropping
crop_size: (a tuple of the form: (an integer, an integer, an
         integer))
        <dx> <dy> <dz> crop to size <dx, dy, dz>
cut_ends: (an integer)
        remove ncut slices from the ends
devolve_transform: (a string)
        subject id
drop_n: (an integer)
        drop the last n frames
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
fill_parcellation: (a boolean)
        fill parcellation
force_ras: (a boolean)
        use default when orientation info absent
frame: (an integer)
        keep only 0-based frame number
frame_subsample: (a tuple of the form: (an integer, an integer, an
         integer))
        start delta end : frame subsampling (end = -1 for end)
fwhm: (a float)
        smooth input volume by fwhm mm
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
in_center: (a list of at most 3 items which are a float)
        <R coordinate> <A coordinate> <S coordinate>
in_file: (an existing file name)
        File to read/convert
in_i_dir: (a tuple of the form: (a float, a float, a float))
        <R direction> <A direction> <S direction>
in_i_size: (an integer)
        input i size
in_info: (a boolean)
        display input info
in_j_dir: (a tuple of the form: (a float, a float, a float))
        <R direction> <A direction> <S direction>
in_j_size: (an integer)
        input j size
in_k_dir: (a tuple of the form: (a float, a float, a float))
        <R direction> <A direction> <S direction>
in_k_size: (an integer)
        input k size
in_like: (an existing file name)
        input looks like
in_matrix: (a boolean)
        display input matrix
in_orientation: ('LAI' or 'LIA' or 'ALI' or 'AIL' or 'ILA' or 'IAL'
         or 'LAS' or 'LSA' or 'ALS' or 'ASL' or 'SLA' or 'SAL' or 'LPI' or
         'LIP' or 'PLI' or 'PIL' or 'ILP' or 'IPL' or 'LPS' or 'LSP' or
         'PLS' or 'PSL' or 'SLP' or 'SPL' or 'RAI' or 'RIA' or 'ARI' or
         'AIR' or 'IRA' or 'IAR' or 'RAS' or 'RSA' or 'ARS' or 'ASR' or
         'SRA' or 'SAR' or 'RPI' or 'RIP' or 'PRI' or 'PIR' or 'IRP' or
         'IPR' or 'RPS' or 'RSP' or 'PRS' or 'PSR' or 'SRP' or 'SPR')
        specify the input orientation
in_scale: (a float)
        input intensity scale factor
in_stats: (a boolean)
        display input stats
in_type: ('cor' or 'mgh' or 'mgz' or 'minc' or 'analyze' or
         'analyze4d' or 'spm' or 'afni' or 'brik' or 'bshort' or 'bfloat' or
         'sdt' or 'outline' or 'otl' or 'gdf' or 'nifti1' or 'nii' or
         'niigz' or 'ge' or 'gelx' or 'lx' or 'ximg' or 'siemens' or 'dicom'
         or 'siemens_dicom')
        input file type
invert_contrast: (a float)
        threshold for inversting contrast
midframe: (a boolean)
        keep only the middle frame
no_change: (a boolean)
        don't change type of input to that of template
no_scale: (a boolean)
        dont rescale values for COR
no_translate: (a boolean)
        ~~~
no_write: (a boolean)
        do not write output
out_center: (a tuple of the form: (a float, a float, a float))
        <R coordinate> <A coordinate> <S coordinate>
out_datatype: ('uchar' or 'short' or 'int' or 'float')
        output data type <uchar|short|int|float>
out_file: (a file name)
        output filename or True to generate one
out_i_count: (an integer)
        some count ?? in i direction
out_i_dir: (a tuple of the form: (a float, a float, a float))
        <R direction> <A direction> <S direction>
out_i_size: (an integer)
        output i size
out_info: (a boolean)
        display output info
out_j_count: (an integer)
        some count ?? in j direction
out_j_dir: (a tuple of the form: (a float, a float, a float))
        <R direction> <A direction> <S direction>
out_j_size: (an integer)
        output j size
out_k_count: (an integer)
        some count ?? in k direction
out_k_dir: (a tuple of the form: (a float, a float, a float))
        <R direction> <A direction> <S direction>
out_k_size: (an integer)
        output k size
out_matrix: (a boolean)
        display output matrix
out_orientation: ('LAI' or 'LIA' or 'ALI' or 'AIL' or 'ILA' or 'IAL'
         or 'LAS' or 'LSA' or 'ALS' or 'ASL' or 'SLA' or 'SAL' or 'LPI' or
         'LIP' or 'PLI' or 'PIL' or 'ILP' or 'IPL' or 'LPS' or 'LSP' or
         'PLS' or 'PSL' or 'SLP' or 'SPL' or 'RAI' or 'RIA' or 'ARI' or
         'AIR' or 'IRA' or 'IAR' or 'RAS' or 'RSA' or 'ARS' or 'ASR' or
         'SRA' or 'SAR' or 'RPI' or 'RIP' or 'PRI' or 'PIR' or 'IRP' or
         'IPR' or 'RPS' or 'RSP' or 'PRS' or 'PSR' or 'SRP' or 'SPR')
        specify the output orientation
out_scale: (a float)
        output intensity scale factor
out_stats: (a boolean)
        display output stats
out_type: ('cor' or 'mgh' or 'mgz' or 'minc' or 'analyze' or
         'analyze4d' or 'spm' or 'afni' or 'brik' or 'bshort' or 'bfloat' or
         'sdt' or 'outline' or 'otl' or 'gdf' or 'nifti1' or 'nii' or
         'niigz')
        output file type
parse_only: (a boolean)
        parse input only
read_only: (a boolean)
        read the input volume
reorder: (a tuple of the form: (an integer, an integer, an integer))
        olddim1 olddim2 olddim3
resample_type: ('interpolate' or 'weighted' or 'nearest' or 'sinc' or
         'cubic')
        <interpolate|weighted|nearest|sinc|cubic> (default is interpolate)
reslice_like: (an existing file name)
        reslice output to match file
sdcm_list: (an existing file name)
        list of DICOM files for conversion
skip_n: (an integer)
        skip the first n frames
slice_bias: (a float)
        apply half-cosine bias field
slice_crop: (a tuple of the form: (an integer, an integer))
        s_start s_end : keep slices s_start to s_end
slice_reverse: (a boolean)
        reverse order of slices, update vox2ras
smooth_parcellation: (a boolean)
        smooth parcellation
sphinx: (a boolean)
        change orientation info to sphinx
split: (a boolean)
        split output frames into separate output files.
status_file: (a file name)
        status file for DICOM conversion
subject_name: (a string)
        subject name ???
subjects_dir: (an existing directory name)
        subjects directory
template_info: (a boolean)
        dump info about template
template_type: ('cor' or 'mgh' or 'mgz' or 'minc' or 'analyze' or
         'analyze4d' or 'spm' or 'afni' or 'brik' or 'bshort' or 'bfloat' or
         'sdt' or 'outline' or 'otl' or 'gdf' or 'nifti1' or 'nii' or
         'niigz' or 'ge' or 'gelx' or 'lx' or 'ximg' or 'siemens' or 'dicom'
         or 'siemens_dicom')
        template file type
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
unwarp_gradient: (a boolean)
        unwarp gradient nonlinearity
vox_size: (a tuple of the form: (a float, a float, a float))
        <size_x> <size_y> <size_z> specify the size (mm) - useful for
        upsampling or downsampling
zero_ge_z_offset: (a boolean)
        zero ge z offset ???
zero_outlines: (a boolean)
        zero outlines

Outputs:

out_file: (an existing file name)
        converted output file

ParseDICOMDir

Link to code

Wraps command mri_parse_sdcmdir

Uses mri_parse_sdcmdir to get information from dicom directories

Examples

>>> from nipype.interfaces.freesurfer import ParseDICOMDir
>>> dcminfo = ParseDICOMDir()
>>> dcminfo.inputs.dicom_dir = '.'
>>> dcminfo.inputs.sortbyrun = True
>>> dcminfo.inputs.summarize = True
>>> dcminfo.cmdline
'mri_parse_sdcmdir --d . --o dicominfo.txt --sortbyrun --summarize'

Inputs:

[Mandatory]
dicom_dir: (an existing directory name)
        path to siemens dicom directory
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

[Optional]
args: (a string)
        Additional parameters to the command
dicom_dir: (an existing directory name)
        path to siemens dicom directory
dicom_info_file: (a file name, nipype default value: dicominfo.txt)
        file to which results are written
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
sortbyrun: (a boolean)
        assign run numbers
subjects_dir: (an existing directory name)
        subjects directory
summarize: (a boolean)
        only print out info for run leaders
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

Outputs:

dicom_info_file: (an existing file name)
        text file containing dicom information

ReconAll

Link to code

Wraps command recon-all

Uses recon-all to generate surfaces and parcellations of structural data from anatomical images of a subject.

Examples

>>> from nipype.interfaces.freesurfer import ReconAll
>>> reconall = ReconAll()
>>> reconall.inputs.subject_id = 'foo'
>>> reconall.inputs.directive = 'all'
>>> reconall.inputs.subjects_dir = '.'
>>> reconall.inputs.T1_files = 'structural.nii'
>>> reconall.cmdline
'recon-all -all -i structural.nii -subjid foo -sd .'

Inputs:

[Mandatory]
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

[Optional]
T1_files: (an existing file name)
        name of T1 file to process
T2_file: (an existing file name)
        Use a T2 image to refine the cortical surface
args: (a string)
        Additional parameters to the command
directive: ('all' or 'autorecon1' or 'autorecon2' or 'autorecon2-cp'
         or 'autorecon2-wm' or 'autorecon2-inflate1' or 'autorecon2-perhemi'
         or 'autorecon3' or 'localGI' or 'qcache', nipype default value:
         all)
        process directive
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
flags: (a string)
        additional parameters
hemi: ('lh' or 'rh')
        hemisphere to process
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
openmp: (an integer)
        Number of processors to use in parallel
subject_id: (a string, nipype default value: recon_all)
        subject name
subjects_dir: (an existing directory name)
        path to subjects directory
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

Outputs:

BA_stats: (an existing file name)
        Brodmann Area statistics files
T1: (an existing file name)
        Intensity normalized whole-head volume
annot: (an existing file name)
        Surface annotation files
aparc_a2009s_stats: (an existing file name)
        Aparc a2009s parcellation statistics files
aparc_aseg: (an existing file name)
        Aparc parcellation projected into aseg volume
aparc_stats: (an existing file name)
        Aparc parcellation statistics files
aseg: (an existing file name)
        Volumetric map of regions from automatic segmentation
aseg_stats: (an existing file name)
        Automated segmentation statistics file
brain: (an existing file name)
        Intensity normalized brain-only volume
brainmask: (an existing file name)
        Skull-stripped (brain-only) volume
curv: (an existing file name)
        Maps of surface curvature
curv_stats: (an existing file name)
        Curvature statistics files
entorhinal_exvivo_stats: (an existing file name)
        Entorhinal exvivo statistics files
filled: (an existing file name)
        Subcortical mass volume
inflated: (an existing file name)
        Inflated surface meshes
label: (an existing file name)
        Volume and surface label files
norm: (an existing file name)
        Normalized skull-stripped volume
nu: (an existing file name)
        Non-uniformity corrected whole-head volume
orig: (an existing file name)
        Base image conformed to Freesurfer space
pial: (an existing file name)
        Gray matter/pia mater surface meshes
rawavg: (an existing file name)
        Volume formed by averaging input images
ribbon: (an existing file name)
        Volumetric maps of cortical ribbons
smoothwm: (an existing file name)
        Smoothed original surface meshes
sphere: (an existing file name)
        Spherical surface meshes
sphere_reg: (an existing file name)
        Spherical registration file
subject_id: (a string)
        Subject name for whom to retrieve data
subjects_dir: (an existing directory name)
        Freesurfer subjects directory.
sulc: (an existing file name)
        Surface maps of sulcal depth
thickness: (an existing file name)
        Surface maps of cortical thickness
volume: (an existing file name)
        Surface maps of cortical volume
white: (an existing file name)
        White/gray matter surface meshes
wm: (an existing file name)
        Segmented white-matter volume
wmparc: (an existing file name)
        Aparc parcellation projected into subcortical white matter
wmparc_stats: (an existing file name)
        White matter parcellation statistics file

Resample

Link to code

Wraps command mri_convert

Use FreeSurfer mri_convert to up or down-sample image files

Examples

>>> from nipype.interfaces import freesurfer
>>> resampler = freesurfer.Resample()
>>> resampler.inputs.in_file = 'structural.nii'
>>> resampler.inputs.resampled_file = 'resampled.nii'
>>> resampler.inputs.voxel_size = (2.1, 2.1, 2.1)
>>> resampler.cmdline
'mri_convert -vs 2.10 2.10 2.10 -i structural.nii -o resampled.nii'

Inputs:

[Mandatory]
in_file: (an existing file name)
        file to resample
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
voxel_size: (a tuple of the form: (a float, a float, a float))
        triplet of output voxel sizes

[Optional]
args: (a string)
        Additional parameters to the command
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
in_file: (an existing file name)
        file to resample
resampled_file: (a file name)
        output filename
subjects_dir: (an existing directory name)
        subjects directory
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
voxel_size: (a tuple of the form: (a float, a float, a float))
        triplet of output voxel sizes

Outputs:

resampled_file: (an existing file name)
        output filename

RobustRegister

Link to code

Wraps command mri_robust_register

Perform intramodal linear registration (translation and rotation) using robust statistics.

Examples

>>> from nipype.interfaces.freesurfer import RobustRegister
>>> reg = RobustRegister()
>>> reg.inputs.source_file = 'structural.nii'
>>> reg.inputs.target_file = 'T1.nii'
>>> reg.inputs.auto_sens = True
>>> reg.inputs.init_orient = True
>>> reg.cmdline
'mri_robust_register --satit --initorient --lta structural_robustreg.lta --mov structural.nii --dst T1.nii'

References

Reuter, M, Rosas, HD, and Fischl, B, (2010). Highly Accurate Inverse Consistent Registration: A Robust Approach. Neuroimage 53(4) 1181-96.

Inputs:

[Mandatory]
auto_sens: (a boolean)
        auto-detect good sensitivity
        mutually_exclusive: outlier_sens
outlier_sens: (a float)
        set outlier sensitivity explicitly
        mutually_exclusive: auto_sens
source_file: (a file name)
        volume to be registered
target_file: (a file name)
        target volume for the registration
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

[Optional]
args: (a string)
        Additional parameters to the command
auto_sens: (a boolean)
        auto-detect good sensitivity
        mutually_exclusive: outlier_sens
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
est_int_scale: (a boolean)
        estimate intensity scale (recommended for unnormalized images)
force_double: (a boolean)
        use double-precision intensities
force_float: (a boolean)
        use float intensities
half_source: (a boolean or a file name)
        write source volume mapped to halfway space
half_source_xfm: (a boolean or a file name)
        write transform from source to halfway space
half_targ: (a boolean or a file name)
        write target volume mapped to halfway space
half_targ_xfm: (a boolean or a file name)
        write transform from target to halfway space
half_weights: (a boolean or a file name)
        write weights volume mapped to halfway space
high_iterations: (an integer)
        max # of times on highest resolution
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
in_xfm_file: (an existing file name)
        use initial transform on source
init_orient: (a boolean)
        use moments for initial orient (recommended for stripped brains)
iteration_thresh: (a float)
        stop iterations when below threshold
least_squares: (a boolean)
        use least squares instead of robust estimator
mask_source: (an existing file name)
        image to mask source volume with
mask_target: (an existing file name)
        image to mask target volume with
max_iterations: (an integer)
        maximum # of times on each resolution
no_init: (a boolean)
        skip transform init
no_multi: (a boolean)
        work on highest resolution
out_reg_file: (a file name)
        registration file to write
outlier_limit: (a float)
        set maximal outlier limit in satit
outlier_sens: (a float)
        set outlier sensitivity explicitly
        mutually_exclusive: auto_sens
registered_file: (a boolean or a file name)
        registered image; either True or filename
source_file: (a file name)
        volume to be registered
subjects_dir: (an existing directory name)
        subjects directory
subsample_thresh: (an integer)
        subsample if dimension is above threshold size
target_file: (a file name)
        target volume for the registration
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
trans_only: (a boolean)
        find 3 parameter translation only
weights_file: (a boolean or a file name)
        weights image to write; either True or filename
write_vo2vox: (a boolean)
        output vox2vox matrix (default is RAS2RAS)

Outputs:

half_source: (a file name)
        source image mapped to halfway space
half_source_xfm: (a file name)
        transform file to map source image to halfway space
half_targ: (a file name)
        target image mapped to halfway space
half_targ_xfm: (a file name)
        transform file to map target image to halfway space
half_weights: (a file name)
        weights image mapped to halfway space
out_reg_file: (an existing file name)
        output registration file
registered_file: (a file name)
        output image with registration applied
weights_file: (a file name)
        image of weights used

Smooth

Link to code

Wraps command mris_volsmooth

Use FreeSurfer mris_volsmooth to smooth a volume

This function smoothes cortical regions on a surface and non-cortical regions in volume.

Note

Cortical voxels are mapped to the surface (3D->2D) and then the smoothed values from the surface are put back into the volume to fill the cortical ribbon. If data is smoothed with this algorithm, one has to be careful about how further processing is interpreted.

Examples

>>> from nipype.interfaces.freesurfer import Smooth
>>> smoothvol = Smooth(in_file='functional.nii', smoothed_file = 'foo_out.nii', reg_file='register.dat', surface_fwhm=10, vol_fwhm=6)
>>> smoothvol.cmdline
'mris_volsmooth --i functional.nii --reg register.dat --o foo_out.nii --fwhm 10.000000 --vol-fwhm 6.000000'

Inputs:

[Mandatory]
in_file: (an existing file name)
        source volume
num_iters: (an integer >= 1)
        number of iterations instead of fwhm
        mutually_exclusive: surface_fwhm
reg_file: (an existing file name)
        registers volume to surface anatomical
surface_fwhm: (a floating point number >= 0.0)
        surface FWHM in mm
        mutually_exclusive: num_iters
        requires: reg_file
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

[Optional]
args: (a string)
        Additional parameters to the command
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
in_file: (an existing file name)
        source volume
num_iters: (an integer >= 1)
        number of iterations instead of fwhm
        mutually_exclusive: surface_fwhm
proj_frac: (a float)
        project frac of thickness a long surface normal
        mutually_exclusive: proj_frac_avg
proj_frac_avg: (a tuple of the form: (a float, a float, a float))
        average a long normal min max delta
        mutually_exclusive: proj_frac
reg_file: (an existing file name)
        registers volume to surface anatomical
smoothed_file: (a file name)
        output volume
subjects_dir: (an existing directory name)
        subjects directory
surface_fwhm: (a floating point number >= 0.0)
        surface FWHM in mm
        mutually_exclusive: num_iters
        requires: reg_file
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
vol_fwhm: (a floating point number >= 0.0)
        volume smoothing outside of surface

Outputs:

smoothed_file: (an existing file name)
        smoothed input volume

SynthesizeFLASH

Link to code

Wraps command mri_synthesize

Synthesize a FLASH acquisition from T1 and proton density maps.

Examples

>>> from nipype.interfaces.freesurfer import SynthesizeFLASH
>>> syn = SynthesizeFLASH(tr=20, te=3, flip_angle=30)
>>> syn.inputs.t1_image = 'T1.mgz'
>>> syn.inputs.pd_image = 'PD.mgz'
>>> syn.inputs.out_file = 'flash_30syn.mgz'
>>> syn.cmdline
'mri_synthesize 20.00 30.00 3.000 T1.mgz PD.mgz flash_30syn.mgz'

Inputs:

[Mandatory]
flip_angle: (a float)
        flip angle (in degrees)
pd_image: (an existing file name)
        image of proton density values
t1_image: (an existing file name)
        image of T1 values
te: (a float)
        echo time (in msec)
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
tr: (a float)
        repetition time (in msec)

[Optional]
args: (a string)
        Additional parameters to the command
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
fixed_weighting: (a boolean)
        use a fixed weighting to generate optimal gray/white contrast
flip_angle: (a float)
        flip angle (in degrees)
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
out_file: (a file name)
        image to write
pd_image: (an existing file name)
        image of proton density values
subjects_dir: (an existing directory name)
        subjects directory
t1_image: (an existing file name)
        image of T1 values
te: (a float)
        echo time (in msec)
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored
tr: (a float)
        repetition time (in msec)

Outputs:

out_file: (an existing file name)
        synthesized FLASH acquisition

UnpackSDICOMDir

Link to code

Wraps command unpacksdcmdir

Use unpacksdcmdir to convert dicom files

Call unpacksdcmdir -help from the command line to see more information on using this command.

Examples

>>> from nipype.interfaces.freesurfer import UnpackSDICOMDir
>>> unpack = UnpackSDICOMDir()
>>> unpack.inputs.source_dir = '.'
>>> unpack.inputs.output_dir = '.'
>>> unpack.inputs.run_info = (5, 'mprage', 'nii', 'struct')
>>> unpack.inputs.dir_structure = 'generic'
>>> unpack.cmdline
'unpacksdcmdir -generic -targ . -run 5 mprage nii struct -src .'

Inputs:

[Mandatory]
config: (an existing file name)
        specify unpacking rules in file
        mutually_exclusive: run_info, config, seq_config
run_info: (a tuple of the form: (an integer, a string, a string, a
         string))
        runno subdir format name : spec unpacking rules on cmdline
        mutually_exclusive: run_info, config, seq_config
seq_config: (an existing file name)
        specify unpacking rules based on sequence
        mutually_exclusive: run_info, config, seq_config
source_dir: (an existing directory name)
        directory with the DICOM files
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

[Optional]
args: (a string)
        Additional parameters to the command
config: (an existing file name)
        specify unpacking rules in file
        mutually_exclusive: run_info, config, seq_config
dir_structure: ('fsfast' or 'generic')
        unpack to specified directory structures
environ: (a dictionary with keys which are a value of type 'str' and
         with values which are a value of type 'str', nipype default value:
         {})
        Environment variables
ignore_exception: (a boolean, nipype default value: False)
        Print an error message instead of throwing an exception in case the
        interface fails to run
log_file: (an existing file name)
        explicilty set log file
no_info_dump: (a boolean)
        do not create infodump file
no_unpack_err: (a boolean)
        do not try to unpack runs with errors
output_dir: (a directory name)
        top directory into which the files will be unpacked
run_info: (a tuple of the form: (an integer, a string, a string, a
         string))
        runno subdir format name : spec unpacking rules on cmdline
        mutually_exclusive: run_info, config, seq_config
scan_only: (an existing file name)
        only scan the directory and put result in file
seq_config: (an existing file name)
        specify unpacking rules based on sequence
        mutually_exclusive: run_info, config, seq_config
source_dir: (an existing directory name)
        directory with the DICOM files
spm_zeropad: (an integer)
        set frame number zero padding width for SPM
subjects_dir: (an existing directory name)
        subjects directory
terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
        Control terminal output: `stream` - displays to terminal
        immediately, `allatonce` - waits till command is finished to display
        output, `file` - writes output to file, `none` - output is ignored

Outputs:

None