Hi all,
I’m writing a fixed-effects workflow that uses outputs from fmriprep. I started working from this example by @ChrisGorgolewski and re-wrote it as a Nipype workflow to make it easier to iterate over subjects and runs. As far as I could tell, the original example models a single run per session per subject; I’m having trouble adapting this code to model multiple runs per subject.
I’ve put my work so far in this repository. I’ve gotten as far as running model estimation for individual runs with FILM, but I’m not sure how to feed the outputs of FILM (filmgls
) to a fixed-effects workflow (fixedfx
). I built the first-level workflow so that it iterates over different runs from the start, so I think the next step is to merge the copes, varcopes, etc. across all runs of a single subject before feeding them into the fixed effects workflow.
I tried using a JoinNode (mergemodel
) between filmgls
and fixedfx
to do this. Here’s the relevant bit from block #44:
(mask, mergesource, [('out_file', 'mask')]),
(filmgls, mergesource, [('copes', 'copes'),
('varcopes', 'varcopes'),
('dof_file', 'dof_file')]),
(mergesource, mergemodel, [('mask', 'mask'),
('copes', 'copes'),
('varcopes', 'varcopes'),
('dof_file', 'dof_file')]),
(mergemodel, fixedfx, [(('mask', pickfirst), 'flameo.mask_file'),
(('copes', sort_copes), 'inputspec.copes'),
('dof_file', 'inputspec.dof_files'),
(('varcopes', sort_copes), 'inputspec.varcopes'),
(('copes', num_copes), 'l2model.num_copes')]),
However, I got this error:
[Node] Setting-up "l1.fixedfx.varcopemerge" in "/scratch/users/nvelez/swist_cache/l1_model/task-tomloc_model-localizer_sub-04/l1/fixedfx/_run_2/varcopemerge".
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-45-5b9f69c9be41> in <module>()
----> 1 l1_workflow.run()
/src/nipype/nipype/pipeline/engine/workflows.py in run(self, plugin, plugin_args, updatehash)
593 if str2bool(self.config['execution']['create_report']):
594 self._write_report_info(self.base_dir, self.name, execgraph)
--> 595 runner.run(execgraph, updatehash=updatehash, config=self.config)
596 datestr = datetime.utcnow().strftime('%Y%m%dT%H%M%S')
597 if str2bool(self.config['execution']['write_provenance']):
/src/nipype/nipype/pipeline/plugins/linear.py in run(self, graph, config, updatehash)
42 if self._status_callback:
43 self._status_callback(node, 'start')
---> 44 node.run(updatehash=updatehash)
45 if self._status_callback:
46 self._status_callback(node, 'end')
/src/nipype/nipype/pipeline/engine/nodes.py in run(self, updatehash)
415 # Check hash, check whether run should be enforced
416 logger.info('[Node] Setting-up "%s" in "%s".', self.fullname, outdir)
--> 417 cached, updated = self.is_cached()
418
419 # If the node is cached, check on pklz files and finish
/src/nipype/nipype/pipeline/engine/nodes.py in is_cached(self, rm_outdated)
301
302 # Update hash
--> 303 hashed_inputs, hashvalue = self._get_hashval()
304
305 # The output folder does not exist: not cached
/src/nipype/nipype/pipeline/engine/nodes.py in _get_hashval(self)
1052 return self._hashed_inputs, self._hashvalue
1053
-> 1054 self._check_iterfield()
1055 hashinputs = deepcopy(self._interface.inputs)
1056 for name in self.iterfield:
/src/nipype/nipype/pipeline/engine/nodes.py in _check_iterfield(self)
1218 if not isdefined(getattr(self.inputs, iterfield)):
1219 raise ValueError(("Input %s was not set but it is listed "
-> 1220 "in iterfields.") % iterfield)
1221 if len(self.iterfield) > 1:
1222 first_len = len(
ValueError: Input in_files was not set but it is listed in iterfields.
Any suggestions on how to debug this would be much appreciated! For reference, I’ve included a diagram of the workflow at the end of the notebook.
Thanks,
Natalia