77=============================================
88
99A growing number of datasets are available on `OpenfMRI <http://openfmri.org>`_.
10- This script demonstrates how to use nipype to analyze a data set.
10+ This script demonstrates how to use nipype to analyze a data set::
1111
1212 python fmri_ants_openfmri.py --datasetdir ds107
1313"""
@@ -47,19 +47,16 @@ def create_reg_workflow(name='registration'):
4747
4848 Parameters
4949 ----------
50-
51- ::
52-
5350 name : name of workflow (default: 'registration')
5451
55- Inputs::
52+ Inputs:
5653
5754 inputspec.source_files : files (filename or list of filenames to register)
5855 inputspec.mean_image : reference image to use
5956 inputspec.anatomical_image : anatomical image to coregister to
6057 inputspec.target_image : registration target
6158
62- Outputs::
59+ Outputs:
6360
6461 outputspec.func2anat_transform : FLIRT transform
6562 outputspec.anat2target_transform : FLIRT+FNIRT transform
@@ -68,7 +65,6 @@ def create_reg_workflow(name='registration'):
6865
6966 Example
7067 -------
71-
7268 """
7369
7470 register = pe .Workflow (name = name )
@@ -130,6 +126,7 @@ def create_reg_workflow(name='registration'):
130126 register .connect (inputnode , 'anatomical_image' , mean2anatbbr , 'reference' )
131127 register .connect (mean2anat , 'out_matrix_file' ,
132128 mean2anatbbr , 'in_matrix_file' )
129+
133130 """
134131 Convert the BBRegister transformation to ANTS ITK format
135132 """
@@ -197,6 +194,7 @@ def create_reg_workflow(name='registration'):
197194 """
198195 Transform the mean image. First to anatomical and then to target
199196 """
197+
200198 warpmean = pe .Node (ants .ApplyTransforms (),
201199 name = 'warpmean' )
202200 warpmean .inputs .input_image_type = 3
@@ -238,6 +236,10 @@ def create_reg_workflow(name='registration'):
238236
239237 return register
240238
239+ """
240+ Get info for a given subject
241+ """
242+
241243def get_subjectinfo (subject_id , base_dir , task_id , model_id ):
242244 """Get info for a given subject
243245
@@ -291,6 +293,9 @@ def get_subjectinfo(subject_id, base_dir, task_id, model_id):
291293 TR = np .genfromtxt (os .path .join (base_dir , 'scan_key.txt' ))[1 ]
292294 return run_ids [task_id - 1 ], conds [task_id - 1 ], TR
293295
296+ """
297+ Analyzes an open fmri dataset
298+ """
294299
295300def analyze_openfmri_dataset (data_dir , subject = None , model_id = None ,
296301 task_id = None , output_dir = None , subj_prefix = '*' ,
@@ -621,6 +626,7 @@ def get_subs(subject_id, conds, model_id, task_id):
621626 """
622627 Set processing parameters
623628 """
629+
624630 preproc .inputs .inputspec .fwhm = fwhm
625631 gethighpass .inputs .hpcutoff = hpcutoff
626632 modelspec .inputs .high_pass_filter_cutoff = hpcutoff
@@ -634,6 +640,10 @@ def get_subs(subject_id, conds, model_id, task_id):
634640 datasink .inputs .base_directory = output_dir
635641 return wf
636642
643+ """
644+ The following functions run the whole workflow.
645+ """
646+
637647if __name__ == '__main__' :
638648 import argparse
639649 defstr = ' (default %(default)s)'
0 commit comments