Hi,
I aim to create a workflow using Nipype and fsl interfaces. Due to the way the data has been given to me, the first step of my pipeline consists in merging two nii.gz files containing the b0 volumes to afterwards use topup on them. My problem is that the merge node I created expects a list with the two images to merge, but there is no way this list can be introduced. I tried with iterables, but with the case of 2 subjects the result is 4 files without merging. The code I used:
subjects=[‘hs01’,‘hs02’]
acquisitions=[‘1’,‘2’]
infosource=Node(IdentityInterface(fields=[‘subject_id’,‘acquisition_id’]), name=‘infosource’)
infosource.iterables=[(‘subject_id’, subjects), (‘acquisition_id’, acquisitions)]
templates={‘dti’:’/local/{subject_id}/dti{acquisition_id}.nii.gz’,
‘refdti’:’/local/{subject_id}/refdti{acquisition_id}.nii.gz’
selectfiles=Node(SelectFiles(templates, base_directory=experiment_dir, force_lists=[‘dti’,‘refdti’]), name=‘selectfiles’)
imagemerger_node=Node(Merge(dimension=‘t’), name='imagemerger)
datasink=Node(DataSink(base_directory=experiment_dir, container=output_folder),
name='datasink)
myworkflow=Workflow(name=‘pipeline’)
myworkflow.connect([(infosource,selectfiles,[(‘subject_id’,‘subject_id’), (‘acquisition_id’,‘acquisition_id’)]), (selectfiles, imagemerger_node,[(‘refdti’,‘in_files’)]), (imagemeger_node, datasink,[(‘merged_file’,‘mergedimages’)])])
I think the problem is in the way SelectFiles returns the output, since in the command line the fsl Merge line shows:
fslmerge -t ref_dti1_merged /local/hs01/refdti1
which means that is trying to merge an existent file (/local/hs01/refdti1) with ref_dti1_merged that does not exist
If someone has been able to use Merge after Selectfiles please show me how.
Thank you in advance!!