SPM NewSegment - connect only some items from native_class_images to the next node

Hello everyone ;),

I’m trying to update a workflow from Segment to NewSegment.

NewSegment give me as output i.e. native_class_images, that is a list.

How can I connect only one or some item of this list to the next node?

Thanks in advance :slight_smile:

Hi @aorco - I’d recommend making an intermediate Function node which takes in the list of native_class_images from NewSegment and returns one / a subset of the items - which you can then pass to the next node.

Thanks @mgxd, it worked fine!

This is what I wrote for the future searches (actually spm NewSegment returns a list of lists):

def spm_tissues(in_list):
    return in_list[0][0], in_list[1][0], in_list[2][0]

spm_tissues_split = Node(
    Function(['in_list'], ['gm', 'wm', 'csf'], spm_tissues), name='spm_tissues_split')
1 Like