MRIConvert and aparc_aseg file conversion in workflow

Hello all,

I would like to create a workflow to get the freesurfer recon-all outputs and covert them to nifti. I am create individual nodes for every conversion (T1, WM, etc); however, I am running into problems with aparc_aseg output in nipype. As it is, aparc_aseg is a list of the 3 segmentation files but and MRIConvert wont do all three. Is there a way to incorporate a node to do all three or add three nodes and properly specify each file in the workflow?

Right now I have the following (see below). I could add a node called mr_convertaparc_aseg and add it to the workflow but it will fail because the output of each parcellation is not specified within nipype as differenct files.

mr_convertT1=Node(MRIConvert(out_type=u’niigz’),
name=“mr_convertT1”)
mr_convertaseg=Node(MRIConvert(out_type=u’niigz’),
name=“mr_convertaseg”)
mr_convertbrainmask=Node(MRIConvert(out_type=u’niigz’),
name=“mr_convertbrainmask”)
mr_convertwmparc=Node(MRIConvert(out_type=u’niigz’),
name=“mr_convertwmparc”)
mr_convertwm=Node(MRIConvert(out_type=u’niigz’),
name=“mr_convertwm”)

preproc.connect([(infosource, selectfiles, [(‘subject_id’,‘subject_id’)]),
(selectfiles, recon_all, [(‘t1’, ‘T1_files’)]),
(recon_all, mr_convertT1,[(‘T1’, ‘in_file’)]),
(recon_all, mr_convertaseg,[(‘aseg’,‘in_file’)]),
(recon_all, mr_convertbrainmask,[(‘brainmask’,‘in_file’)]),
(recon_all, mr_convertwmparc,[(‘wmparc’,‘in_file’)]),
(recon_all, mr_convertwm,[(‘wm’,‘in_file’)]),
(mr_convertT1, datasink,[(‘out_file’,‘preproc.@T1’)]),
(mr_convertaseg, datasink,[(‘out_file’,‘preproc.@aseg’)]),
(mr_convertbrainmask, datasink,[(‘out_file’,‘preproc.@brainmask’)]),
(mr_convertwmparc, datasink,[(‘out_file’,‘preproc.@wmparc’)]),
(mr_convertwm, datasink,[(‘out_file’,‘preproc.@wm’)]),
])

Hello Luis,

Have you considered a MapNode? A MapNode takes a list of inputs, runs the specified interface on each element of the list and returns the results again as a list. If you want to convert all three aparc_aseg segmentation files, this is probably your best approach.

Cheers,
Michael

Awesome! MapNode is the solution! Thanks