[Neuroimaging] nipype node, execution and original inputs difference?

Ian Malone ibmalone at gmail.com
Tue Dec 12 08:26:00 EST 2017


Thanks, that's a really helpful step to know. It's not a nipype
problem then, I was able to track it down to an error in the wrapped
function from outside nipype. (On an error condition it threw away one
of the data sets, popping them off the input list in the process,
which I suppose is how they came to disappear from the execution
inputs list. The original author decided a printed error message would
be sufficient warning for this circumstance.)

Thanks again for your help,
Ian

On 12 December 2017 at 12:50, Satrajit Ghosh <satra at mit.edu> wrote:
> hi ian,
>
> that's very surprising. one scenario would be if this node was set as a
> MapNode, but it doesn't look like it.
>
> a way to debug this would be to:
>
> import os
> from nipype.utils.filemanip import loadpkl
>
> node_wd = '/path/to/node/wd'
> node = loadpkl(os.path.join(node_wd, '_node.pklz')
> print(node.inputs)
> node.base_dir = '/somepath' # otherwise it will overwrite node_wd
> result = node.run()
>
> there is also an _inputs.pklz in node_wd which shows the inputs to the node.
>
> feel free to open an issue on github where this can be tracked.
>
> cheers,
>
> satra
>
> On Tue, Dec 12, 2017 at 6:28 AM, Ian Malone <ibmalone at gmail.com> wrote:
>>
>> Hi,
>>
>> I'm trying to debug a nipype problem with the inputs to a function
>> node and wondered if anyone could help.
>>
>> The function is meant to merge two diffusion datasets together, so
>> takes lists of b vector and value files and the images themselves. If
>> there's only one set of inputs it just passes them through. So far so
>> good. Under every circumstance up to now it's worked as expected, but
>> I've run in a case where with two inputs it behaves as if there's only
>> one set.
>>
>> The report.rst file for the node tells me that's exactly what's happening:
>>
>> Original Inputs
>> ---------------
>> <snip>
>> * in_bvals :
>> ['/var/drc/research/tess/dtipipeline/01-0335-08-03-MR00/ep2ddiffFREE681p2FAD25mmiABCD.bval',
>>
>> '/var/drc/research/tess/dtipipeline/01-0335-08-03-MR00/ep2ddiffFREE681p2FAD25mmi.bval']
>> * in_bvecs :
>> ['/var/drc/research/tess/dtipipeline/01-0335-08-03-MR00/ep2ddiffFREE681p2FAD25mmiABCD.bvec',
>>
>> '/var/drc/research/tess/dtipipeline/01-0335-08-03-MR00/ep2ddiffFREE681p2FAD25mmi.bvec']
>> * in_dwis :
>> ['/var/drc/research/tess/dtipipeline/01-0335-08-03-MR00/ep2ddiffFREE681p2FAD25mmiABCD.nii.gz',
>>
>> '/var/drc/research/tess/dtipipeline/01-0335-08-03-MR00/ep2ddiffFREE681p2FAD25mmi.nii.gz']
>>
>>
>> Execution Inputs
>> ----------------
>> <snip>
>> * in_bvals :
>> ['/var/drc/research/tess/dtipipeline/01-0335-08-03-MR00/ep2ddiffFREE681p2FAD25mmi.bval']
>> * in_bvecs :
>> ['/var/drc/research/tess/dtipipeline/01-0335-08-03-MR00/ep2ddiffFREE681p2FAD25mmi.bvec']
>> * in_dwis :
>> ['/var/drc/research/tess/dtipipeline/01-0335-08-03-MR00/ep2ddiffFREE681p2FAD25mmi.nii.gz']
>>
>>
>> It appears the node inputs are set correctly, but are getting stripped
>> or truncated before execution. The same pipeline behaving normally
>> doesn't do this:
>>
>>
>> Original Inputs
>> ---------------
>> <snip>
>> * in_bvals : ['/var/lib/midas/data/lha1946/images/nii/original/3033.bval',
>> '/var/lib/midas/data/lha1946/images/nii/original/3024.bval']
>> * in_bvecs : ['/var/lib/midas/data/lha1946/images/nii/original/3033.bvec',
>> '/var/lib/midas/data/lha1946/images/nii/original/3024.bvec']
>> * in_dwis :
>> ['/var/lib/midas/data/lha1946/images/nii/original/3033.nii.gz',
>> '/var/lib/midas/data/lha1946/images/nii/original/3024.nii.gz']
>>
>>
>> Execution Inputs
>> ----------------
>> <snip>
>> * in_bvals : ['/var/lib/midas/data/lha1946/images/nii/original/3033.bval',
>> '/var/lib/midas/data/lha1946/images/nii/original/3024.bval']
>> * in_bvecs : ['/var/lib/midas/data/lha1946/images/nii/original/3033.bvec',
>> '/var/lib/midas/data/lha1946/images/nii/original/3024.bvec']
>> * in_dwis :
>> ['/var/lib/midas/data/lha1946/images/nii/original/3033.nii.gz',
>> '/var/lib/midas/data/lha1946/images/nii/original/3024.nii.gz']
>>
>>
>> I don't know what can cause the execution inputs to differ from the
>> initial inputs. The node and its input connections are just defined
>> like this:
>>
>> merge_initial_dwis = pe.Node(interface=niu.Function(
>>     input_names=['in_dwis', 'in_bvals', 'in_bvecs'],
>>     output_names=['out_dwis', 'out_bvals', 'out_bvecs', 'out_orig_file',
>>                   'out_orig_ind'],
>>     function=merge_dwi_function), name='merge_initial_dwis')
>>
>> merge_initial_dwis.inputs.in_dwis = [os.path.abspath(f) for f in
>> args.dwis]
>> merge_initial_dwis.inputs.in_bvals = [os.path.abspath(f) for f in
>> args.bvals]
>> merge_initial_dwis.inputs.in_bvecs = [os.path.abspath(f) for f in
>> args.bvecs]
>>
>> Any suggestions how I could try to find the cause?
>>
>>
>> --
>> imalone
>> _______________________________________________
>> Neuroimaging mailing list
>> Neuroimaging at python.org
>> https://mail.python.org/mailman/listinfo/neuroimaging
>
>
>
> _______________________________________________
> Neuroimaging mailing list
> Neuroimaging at python.org
> https://mail.python.org/mailman/listinfo/neuroimaging
>



-- 
imalone
http://ibmalone.blogspot.co.uk


More information about the Neuroimaging mailing list