Problems with Nipype JoinNode output (getting list of lists)

57 views
Skip to first unread message

at.s...@gmail.com

unread,
Jun 11, 2014, 11:59:48 AM6/11/14
to nipy...@googlegroups.com, demian.w...@inria.fr
Hello,

I am following the last JoinNode example in http://www.mit.edu/~satra/nipype-nightly/users/joinnode_and_itersource.html, and using it in my workflow. Same as this example I have two iterables, lets say the first is the list of subjects and the second one is a selected feauture of them. Doing so, as in this example we join everything in node E. What I like to do is to be able to have two join nodes to get a list per feature per subject, rather than a mix. For example, I will have E1 for D13 and D14, and E2 for D25 and D26. The problem with having only node E is that I get a list of lists and I cannot seperate them correspondingly. How can I do this? can I have a iterable in JoinNode itself, or I have to seperate it in two, and if so how I distinguish between diffrent lists of my iterables?

Thank you so much for helping me, it is certainly appreciated :).



thomas.nickson

unread,
Jun 16, 2014, 7:43:11 AM6/16/14
to nipy...@googlegroups.com, demian.w...@inria.fr
I'm not sure that I fully get what you're trying to do but I had a similar problem where I got lists of lists but I wanted lists after I had joined and separated in to groups. I ended up just writing a function that collapses the lists:

def collapseList(icaList):
    return [item for elem in icaList for item in elem]

and then use like

connections.connect(merge, ('out1', collapseList), groupA, 'in_files')

you can separate the nodes using the split interface

http://nipy.sourceforge.net/nipype/interfaces/generated/nipype.interfaces.utility.html#split

If you want something more fine grained than that then it's going to have to be custom functions I think. best to just know the order of the initial list and work from there.

Hopefully some of this is useful.

Reply all
Reply to author
Forward
0 new messages