Selecting one output from an iterable


#1

Hi guys:

I have used spm smoothing to smooth my data, setting the fwhm as an iterable using three different values for the kernel. The pipeline continues after that with masking, high pass filtering and finally with running ICA as implemented in fsl Melodic. I am quite satisfied with one output from the smoothing. Now, I want to regress bad components out of only one output of the three. I tried to use utility.select, but it works on all of the three branches.

Is there a way to continue the pipeline on only one output of the smoothing?

Thanks


#2

Hi

I have a function:

def get_first(in_file):
return in_file[0]

In your pipeline you call the helper function:

main.connect(smoothing, (‘smoothedfiles’,get_first), masking, ‘in_file’)


#3

Thank you, I tried it and it did not work. it returns an error:
ValueError: too many values to unpack

I think the problem is that I need the output to be in a list format and I believe that is not the case in my iterable.


#4

Please check your report.rst to get an idea of the output structure. My MapNode gives me a list of lists. I have to return in_file[0][0]