Opposite of a MapNode: is there an easy way?

Suppose I don’t want to use a chain of MapNodes (it is a bit too long of a story to go into here) and so the first step in my workflow is to setup an node that iterates over all the sessions I am processing. However, I now need to run a tool that normalizes my datasets to a population average, so I need the inverse of a MapNode (maybe you could call it a ReduceNode), i.e. something that implicitly creates many-to-one-to-many nodes instead of one-to-many-to-one nodes.

So my question is, is there an clean way to do this with NiPype? The many-to-one part can be done easily with a JoinNode but it is the expanding back out to many and connecting with along side other inputs that haven’t been through the “reduce node” that I am unsure about. I am thinking that I will need to create a custom interface that takes the original iterable I started with and the list output of the “reduced” node and selects the corresponding element from the list. But this seems a bit hacky. Would this be the recommended way to do it?

Hi, I just wanted to let you know, that we are planning to include ReduceNode in the future version of nipype. But it’s not there yet.

Hi Dorota,

Thanks, I think I have a way to work around it for now, but that would make it a lot simpler.



What did you end up doing?
This might be something usefull for a future pipeline of ours.