ConditionSwitch¶
Control the flow of execution (acting as a dispatcher) based on matching conditions.
The node has one input which receives the value to be tested from another node (this value can be of any type, i.e., string, number, array, Packet, etc.), and several outputs (named out1 through out5), which will each send a value of 1 (True) or 0 (False), depending on whether the value of their corresponding value1 through value5 property matches the input condition (i.e., out2 and out3 will be set to 1 if value2 and value3 match the input). There is also an out_default output which will be set to 1 if none of the other outputs match. Note that unlike the Switch node which only triggers the first matching output, this node will set all matching outputs to 1. A typical use case for this node is to wire the output(s) into the enabled port of one or more Passthrough nodes in order to turn those gates on or off (thereby enabling or disabling the execution of all nodes downstream of the Passthrough node) based on the input condition. Besides this, the outN ports can be wired to any other nodes that have a parameter that accepts a bool (True/False) in order to set that parameter at or during runtime based on some condition. You can also wire a ParameterPort node into the input of this node in order to set the value to be tested (i.e., session type, metric to compute, etc.) at runtime over the NeuroPype API and thereby control which branches of your pipeline are executed dynamically at launch or even while the pipeline is running. The Switch and ConditionSwitch nodes differ in their use in that the Switch node is used to control the execution of an upstream branch and return its result downstream, whereas the ConditionSwitch is used to control the execution of downstream nodes (usually by wiring it into the Passthrough node to "turn off" execution at a given point in the pipeline).
Version 1.0.0
Ports/Properties¶
input¶
Condition (can be of any type) to be evaluated.
- verbose name: Input
- default value: None
- port type: DataPort
- value type: object (can be None)
- data direction: IN
value1¶
Value to compare to. Must be of the same type as input.
- verbose name: Value1
- default value: None
- port type: Port
- value type: object (can be None)
out1¶
Set to True (1) if input matches value1 and False (0) otherwise.
- verbose name: Out1
- default value: None
- port type: DataPort
- value type: bool (can be None)
- data direction: OUT
value2¶
Value to compare to. Must be of the same type as input.
- verbose name: Value2
- default value: None
- port type: Port
- value type: object (can be None)
out2¶
Set to True (1) if input matches value2 and False (0) otherwise.
- verbose name: Out2
- default value: None
- port type: DataPort
- value type: bool (can be None)
- data direction: OUT
value3¶
Value to compare to. Must be of the same type as input.
- verbose name: Value3
- default value: None
- port type: Port
- value type: object (can be None)
out3¶
Set to True (1) if input matches value3 and False (0) otherwise.
- verbose name: Out3
- default value: None
- port type: DataPort
- value type: bool (can be None)
- data direction: OUT
value4¶
Value to compare to. Must be of the same type as input.
- verbose name: Value4
- default value: None
- port type: Port
- value type: object (can be None)
out4¶
Set to True (1) if input matches value4 and False (0) otherwise.
- verbose name: Out4
- default value: None
- port type: DataPort
- value type: bool (can be None)
- data direction: OUT
value5¶
Value to compare to. Must be of the same type as input.
- verbose name: Value5
- default value: None
- port type: Port
- value type: object (can be None)
out5¶
Set to True (1) if input matches value5 and False (0) otherwise.
- verbose name: Out5
- default value: None
- port type: DataPort
- value type: bool (can be None)
- data direction: OUT
out_default¶
Set to True (1) if input does not match any of value1 through value5 and and False (0) if there was a match.
- verbose name: Out Default
- default value: None
- port type: DataPort
- value type: bool (can be None)
- data direction: OUT
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
- verbose name: Set Breakpoint (Debug Only)
- default value: False
- port type: BoolPort
- value type: bool (can be None)
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.
- verbose name: Metadata
- default value: {}
- port type: DictPort
- value type: dict (can be None)