nipype icon indicating copy to clipboard operation
nipype copied to clipboard

Setting an input on a MapNode within a Workflow has no effect

Open fladd opened this issue 2 years ago • 0 comments

Summary

Setting a non iterated input field on a MapNode within a Workflow manually does not work correclty, while it does work with a normal Node.

Actual behavior

Setting an input on a Node within a workflow will set this field. Setting an input on a MapNode within a workflow leaves this field undefined.

Consider the following test script:

from nipype.pipeline import engine as pe
from nipype.interfaces import io, utility


wf1 = pe.Workflow(name="wf1")
inputspec1 = pe.Node(utility.IdentityInterface(fields=['a', 'b']),
                    name='inputspec1')
outputspec1 = pe.Node(utility.IdentityInterface(fields=['c', 'd']),
                     name="outputspec1")
wf1.connect(inputspec1, "a", outputspec1, "c")
wf1.connect(inputspec1, "b", outputspec1, "d")

wf2 = pe.Workflow(name="wf2")
inputspec2 = pe.MapNode(utility.IdentityInterface(fields=['a', 'b']),
                        iterfield=["a"], name='inputspec2')
outputspec2 = pe.Node(utility.IdentityInterface(fields=['c', 'd']),
                     name="outputspec2")
wf2.connect(inputspec2, "a", outputspec2, "c")
wf2.connect(inputspec2, "b", outputspec2, "d")


wf1.inputs.inputspec1.b = "test1"
print(wf1.inputs)
wf2.inputs.inputspec2.b = "test2"
print(wf2.inputs)

The output is:

inputspec1 = 
a = <undefined>
b = test1

outputspec1 = 




inputspec2 = 
a = <undefined>
b = <undefined>

outputspec2 = 

Expected behavior

The output should be:

inputspec1 = 
a = <undefined>
b = test1

outputspec1 = 




inputspec2 = 
a = <undefined>
b = test2

outputspec2 = 

How to replicate the behavior

See test script above.

Script/Workflow details

See above.

Platform details:

{'commit_hash': '<not found>',
 'commit_source': '(none found)',
 'networkx_version': '3.0',
 'nibabel_version': '5.0.0',
 'nipype_version': '1.8.5',
 'numpy_version': '1.24.1',
 'pkg_path': '/project/3013068.07/Analysis_Joelle/fawn_env/lib/python3.8/site-packages/nipype',
 'scipy_version': '1.10.0',
 'sys_executable': '/project/3013068.07/Analysis_Joelle/fawn_env/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.8.3 (default, Jul  2 2020, 16:21:59) \n[GCC 7.3.0]',
 'traits_version': '6.3.2'}

Execution environment

  • My python environment outside container

fladd avatar Mar 03 '23 15:03 fladd