nipype / pydra

Pydra Dataflow Engine
https://nipype.github.io/pydra/
Other
119 stars 57 forks source link

On the fly lzin modifier ? #723

Open BastienCagna opened 7 months ago

BastienCagna commented 7 months ago

Hi there! I'm building a workflow that take as input some strings and want to use a modified version of those lazy inputs to set some inputs of a node.

For example, my workflow include a "subject_name" input which is a string giving the subject name and I wan to use this input for a node which have a "outputprefix" input to the subject name + "". Can I do this without creating a new node ...etc ?

wf = pydra.Workflow(
    "name of the workflow",
    input_spec=["subject_name",  ...] 
)

wf.add(some_node(
    name="Node name",
    output_prefix = wf.lzin.subject_name + "_" # <------- i want to get this: f"{subject_name}_"
))
satra commented 7 months ago

@BastienCagna - at present i don't believe LazyField's have any operators.

This may also be a good question in the context of output field templates. perhaps @tclose or @djarecka have thought of this.

tclose commented 7 months ago

I had been thinking of a feature like this for accessing properties of lazily accessed objects, whereby Pydra automatically inserts a new node behind the scenes to perform the access operation. This could be extended to handle operators or perhaps even lambdas too.

From my experience teaching people how to use Pydra, people intuitively expect these sort of operations are to be able to work so it would be good to support it