I was looking through this code and wondered how you can replace it with a DataGrabber. I hope somebody can help. Especially the dictionary ListOfImagesDicitonaries. The code can be found here http://nipype.readthedocs.io/en/latest/users/examples/smri_antsregistration_build_template.html
ListOfImagesDictionaries = [
{'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')},
{'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')},
{'T1': os.path.join(mydatadir, '03_T1_half.nii.gz'), 'INV_T1': os.path.join(mydatadir, '03_T1_inv_half.nii.gz'), 'LABEL_MAP': os.path.join(mydatadir, '03_T1_inv_half.nii.gz')}
]
input_passive_images = [
{'INV_T1': os.path.join(mydatadir, '01_T1_inv_half.nii.gz')},
{'INV_T1': os.path.join(mydatadir, '02_T1_inv_half.nii.gz')},
{'INV_T1': os.path.join(mydatadir, '03_T1_inv_half.nii.gz')}
]
"""
registrationImageTypes - A list of the image types to be used actively during
the estimation process of registration, any image type not in this list
will be passively resampled with the estimated transforms.
['T1','T2']
"""
registrationImageTypes = ['T1']
"""
interpolationMap - A map of image types to interpolation modes. If an
image type is not listed, it will be linearly interpolated.
{ 'labelmap':'NearestNeighbor', 'FLAIR':'WindowedSinc' }
"""
interpolationMapping = {'INV_T1': 'LanczosWindowedSinc', 'LABEL_MAP': 'NearestNeighbor', 'T1': 'Linear'}
"""
3. Define the workflow and its working directory
"""
tbuilder = pe.Workflow(name="antsRegistrationTemplateBuilder")
tbuilder.base_dir = requestedPath
"""
4. Define data sources. In real life these would be replace by DataGrabbers
"""
InitialTemplateInputs = [mdict['T1'] for mdict in ListOfImagesDictionaries]
datasource = pe.Node(interface=util.IdentityInterface(fields=['InitialTemplateInputs', 'ListOfImagesDictionaries',
'registrationImageTypes', 'interpolationMapping']),
run_without_submitting=True,
name='InputImages')
datasource.inputs.InitialTemplateInputs = InitialTemplateInputs
datasource.inputs.ListOfImagesDictionaries = ListOfImagesDictionaries
datasource.inputs.registrationImageTypes = registrationImageTypes
datasource.inputs.interpolationMapping = interpolationMapping
datasource.inputs.sort_filelist = True