|
59 | 59 | for one scan session, and the mappings in the dictionary are for all the
|
60 | 60 | co-aligned images for that one scan session
|
61 | 61 | """
|
| 62 | + |
62 | 63 | ListOfImagesDictionaries=[
|
63 | 64 | {'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')},
|
64 | 65 | {'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 | 77 | will be passively resampled with the estimated transforms.
|
77 | 78 | ['T1','T2']
|
78 | 79 | """
|
| 80 | + |
79 | 81 | registrationImageTypes=['T1']
|
80 | 82 |
|
81 | 83 | """
|
82 | 84 | interpolationMap - A map of image types to interpolation modes. If an
|
83 | 85 | image type is not listed, it will be linearly interpolated.
|
84 | 86 | { 'labelmap':'NearestNeighbor', 'FLAIR':'WindowedSinc' }
|
85 | 87 | """
|
| 88 | + |
86 | 89 | interpolationMapping={'INV_T1':'LanczosWindowedSinc','LABEL_MAP':'NearestNeighbor','T1':'Linear'}
|
87 | 90 |
|
88 | 91 | """
|
89 | 92 | 3. Define the workflow and its working directory
|
90 | 93 | """
|
| 94 | + |
91 | 95 | tbuilder=pe.Workflow(name="antsRegistrationTemplateBuilder")
|
92 | 96 | tbuilder.base_dir=requestedPath
|
93 | 97 |
|
94 | 98 | """
|
95 | 99 | 4. Define data sources. In real life these would be replace by DataGrabbers
|
96 | 100 | """
|
| 101 | + |
97 | 102 | InitialTemplateInputs=[ mdict['T1'] for mdict in ListOfImagesDictionaries ]
|
98 | 103 |
|
99 | 104 | datasource = pe.Node(interface=util.IdentityInterface(fields=
|
|
110 | 115 | 5. Template is initialized by a simple average in this simple example,
|
111 | 116 | any reference image could be used (i.e. a previously created template)
|
112 | 117 | """
|
| 118 | + |
113 | 119 | initAvg = pe.Node(interface=ants.AverageImages(), name ='initAvg')
|
114 | 120 | initAvg.inputs.dimension = 3
|
115 | 121 | initAvg.inputs.normalize = True
|
|
121 | 127 | """
|
122 | 128 |
|
123 | 129 | buildTemplateIteration1=antsRegistrationTemplateBuildSingleIterationWF('iteration01')
|
| 130 | + |
124 | 131 | """
|
125 | 132 | Here we are fine tuning parameters of the SGE job (memory limit, numebr of cores etc.)
|
126 | 133 | """
|
| 134 | + |
127 | 135 | BeginANTS = buildTemplateIteration1.get_node("BeginANTS")
|
128 | 136 | 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}
|
129 | 137 |
|
130 | 138 | tbuilder.connect(initAvg, 'output_average_image', buildTemplateIteration1, 'inputspec.fixed_image')
|
131 | 139 | tbuilder.connect(datasource, 'ListOfImagesDictionaries', buildTemplateIteration1, 'inputspec.ListOfImagesDictionaries')
|
132 | 140 | tbuilder.connect(datasource, 'registrationImageTypes', buildTemplateIteration1, 'inputspec.registrationImageTypes')
|
133 | 141 | tbuilder.connect(datasource, 'interpolationMapping', buildTemplateIteration1, 'inputspec.interpolationMapping')
|
| 142 | + |
134 | 143 | """
|
135 | 144 | 7. Define the second iteration of template building
|
136 | 145 | """
|
|
155 | 164 | tbuilder.connect(initAvg, 'output_average_image', datasink,'PreRegisterAverage')
|
156 | 165 |
|
157 | 166 | """
|
158 |
| -8. Run the workflow |
| 167 | +9. Run the workflow |
159 | 168 | """
|
160 | 169 |
|
161 | 170 | tbuilder.run(plugin="SGE")
|
0 commit comments