Skip to content

Commit c835089

Browse files
committed
sty: rest formatting
1 parent 4ff18c8 commit c835089

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/smri_antsregistration_build_template.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
for one scan session, and the mappings in the dictionary are for all the
6060
co-aligned images for that one scan session
6161
"""
62+
6263
ListOfImagesDictionaries=[
6364
{'T1':os.path.join(mydatadir,'01_T1_half.nii.gz'),'INV_T1':os.path.join(mydatadir,'01_T1_inv_half.nii.gz'),'LABEL_MAP':os.path.join(mydatadir,'01_T1_inv_half.nii.gz')},
6465
{'T1':os.path.join(mydatadir,'02_T1_half.nii.gz'),'INV_T1':os.path.join(mydatadir,'02_T1_inv_half.nii.gz'),'LABEL_MAP':os.path.join(mydatadir,'02_T1_inv_half.nii.gz')},
@@ -76,24 +77,28 @@
7677
will be passively resampled with the estimated transforms.
7778
['T1','T2']
7879
"""
80+
7981
registrationImageTypes=['T1']
8082

8183
"""
8284
interpolationMap - A map of image types to interpolation modes. If an
8385
image type is not listed, it will be linearly interpolated.
8486
{ 'labelmap':'NearestNeighbor', 'FLAIR':'WindowedSinc' }
8587
"""
88+
8689
interpolationMapping={'INV_T1':'LanczosWindowedSinc','LABEL_MAP':'NearestNeighbor','T1':'Linear'}
8790

8891
"""
8992
3. Define the workflow and its working directory
9093
"""
94+
9195
tbuilder=pe.Workflow(name="antsRegistrationTemplateBuilder")
9296
tbuilder.base_dir=requestedPath
9397

9498
"""
9599
4. Define data sources. In real life these would be replace by DataGrabbers
96100
"""
101+
97102
InitialTemplateInputs=[ mdict['T1'] for mdict in ListOfImagesDictionaries ]
98103

99104
datasource = pe.Node(interface=util.IdentityInterface(fields=
@@ -110,6 +115,7 @@
110115
5. Template is initialized by a simple average in this simple example,
111116
any reference image could be used (i.e. a previously created template)
112117
"""
118+
113119
initAvg = pe.Node(interface=ants.AverageImages(), name ='initAvg')
114120
initAvg.inputs.dimension = 3
115121
initAvg.inputs.normalize = True
@@ -121,16 +127,19 @@
121127
"""
122128

123129
buildTemplateIteration1=antsRegistrationTemplateBuildSingleIterationWF('iteration01')
130+
124131
"""
125132
Here we are fine tuning parameters of the SGE job (memory limit, numebr of cores etc.)
126133
"""
134+
127135
BeginANTS = buildTemplateIteration1.get_node("BeginANTS")
128136
BeginANTS.plugin_args={'qsub_args': '-S /bin/bash -pe smp1 8-12 -l mem_free=6000M -o /dev/null -e /dev/null queue_name', 'overwrite': True}
129137

130138
tbuilder.connect(initAvg, 'output_average_image', buildTemplateIteration1, 'inputspec.fixed_image')
131139
tbuilder.connect(datasource, 'ListOfImagesDictionaries', buildTemplateIteration1, 'inputspec.ListOfImagesDictionaries')
132140
tbuilder.connect(datasource, 'registrationImageTypes', buildTemplateIteration1, 'inputspec.registrationImageTypes')
133141
tbuilder.connect(datasource, 'interpolationMapping', buildTemplateIteration1, 'inputspec.interpolationMapping')
142+
134143
"""
135144
7. Define the second iteration of template building
136145
"""
@@ -155,7 +164,7 @@
155164
tbuilder.connect(initAvg, 'output_average_image', datasink,'PreRegisterAverage')
156165

157166
"""
158-
8. Run the workflow
167+
9. Run the workflow
159168
"""
160169

161170
tbuilder.run(plugin="SGE")

0 commit comments

Comments
 (0)