Hi all,
I'm working from a FreeSurfer directory. Given a session SESS, there are a number of runs, each of which contains a raw functional, motion-corrected functional and a set of motion parameters.
Run directory: $FUNCTIONALS_DIR/$SESS/bold/???/
Raw functional: f.nii
Motion-corrected functional: fmc.nii.gz
Motion parameters: fmc.mcdat
Freesurfer uses 'mc-afni' to perform motion correction.
For the purposes of this post, let's assume that I have two functional runs: 004, and 005.
I would like to use rapidart to detect outliers; following is a slightly modified version of my workflow:
infosource = pe.Node(interface=util.IdentityInterface(fields=['session_id']), name='infosource')
infosource.iterables=('session_id', sessions_list)
ds = pe.Node(interface=nio.DataGrabber(
infields=['session_id'],
outfields=['functionals', 'motion_corrected', 'mcparams'],
base_directory=os.environ['FUNCTIONALS_DIR'],
template='%s/bold/???/%s',
template_args={'functionals': [['session_id', 'f.nii']],
'motion_corrected': [['session_id', 'fmc.nii.gz']],
'mcparams': [['session_id', 'fmc.mcdat']]},
sort_filelist=True), name='datasource')
afni_artdetect = pe.Node(
interface=ra.ArtifactDetect(parameter_source='AFNI',
mask_type='spm_global',
norm_threshold=1.0,
zintensity_threshold=3.0,
use_differences=[True, False]),
name='afni_artdetect')
sinker = pe.Node(nio.DataSink(base_directory='./nipype_test', parameterization=False), name='sinker')
multiworkflow = pe.Workflow(name='workflow')
multiworkflow.connect([
(infosource, ds, [('session_id', 'session_id')]),
(infosource, sinker, [('session_id', 'container')]),
(ds, sinker, [('motion_corrected', 'motion_corrected'),
('mcparams', 'mcparams')]),
(ds, afni_artdetect, [('motion_corrected', 'realigned_files'),
('mcparams', 'realignment_parameters')]),
(afni_artdetect, sinker,
[('plot_files','afni.plot_files')])
])
This results in the following directory structure:
./nipype_test/
$SESS/
afni/
plot_files/
plot.fmc.png
All runs are being processed, but the outputs are mapped to the same file name. What I would like is something like the following:
./nipype_test/
$SESS/
afni/
plot_files/
004/
plot.fmc.png
005/
plot.fmc.png
Sinker seems to have a DSL that would be useful for resolving this problem, but the documentation is completely opaque. Any assistance in differentiating file names would be helpful.
Chris