ParameterPort¶
Define an parameter for a pipeline that is exposed and can be easily set over the NeuroPype API.
This is particularly useful for defining and setting the specific node properties (parameters) that are frequently modified by users, or important for them to be aware of, and which you wish to expose to them through a client application, without overwhelming users with all parameters of all nodes in your pipeline. As an example, both the NeuroPype Control Panel (accessed through the "Run Pipeline..." Neuropype menu option), as well as the cloud-based NeuroScale dashboard, automatically display all the ParameterPort nodes of a selected pipeline, allowing users to set their values before running the pipeline. Parameters defined by a ParameterPort are rich objects, and include the name of the parameter, its type (e.g., integer, string, etc.), an optional help text, the default value if the parameter is not assigned, whether the parameter is a file path (which will be automatically normalized), and various other useful settings that govern how the parameter behaves in specific circumstances. Even if you're not exposing the ParameterPorts through a client application, ParameterPorts are also useful simply to define the configurable parameters of the pipeline, such as the input file path, event markers, key thresholds, variants of the pipeline (which may inform an If/Else construct in the pipeline), and so on. A user loading the pipeline in Pipeline Designer, for example, can easily identify all the configurable parameters of the pipeline. Technical deep dive: There is a close similarity between the features of a ParameterPort node, and of the Port objects, which are important properties of Nodes, and which are used to declare all the node's configurable parameters as well as data inputs and outputs. While Port objects are used in Python code to express the node's properties, the ParameterPort object is used in a flow graph to express parameters of the graph itself. Version 1.4.0
Ports/Properties¶
value¶
Value to be output.
portname¶
Name of the port. This is the identifier under which the parameter is exposed. If this pipeline is meant to be with a meta-node that uses pre-defined port names, make sure that your port name matches one of those.
default¶
Default value, of the type specified in value_type, that will be passed on to the node wired into the value port. (You can also set this value at runtime over the NeuroPype API.)
value_type¶
Default value type of the port. This determines what type of port is generated for the enclosing node.
domain¶
Defines the acceptable values for this port in the form of a list of two value bounds (for int or float), or a list of values (for int, float or string). Also takes a special case of a dictionary in the following format: {'set1':['value1', 'value2'], 'set2':['value1', 'value2'] ...} where 'set1' and 'set2' are possible values in another parameter port defined in the 'relationships' property of this node (in this format: 'domain.key:portname'), which allow a client application to dynamically determine which set of values are the acceptable values for this port. If 'relationships' specifies a 'domain.key', then this property must contain a dictionary, whose keys match the expected values from the node defined in 'relationships'. Note: The list or dictionary for this node can be loaded from a text file by specifying the filename here in the following format:
select¶
Whether a client application should present a list of values to be selected from in a single-, multi- or combo-select format. 'limits' can be used to identify the domain as a set of numeric limits which can be displayed as such in a client.
desc¶
Description of the port. This description may be shown in GUIs and auto-generated documentation.
port_category¶
Human-readable category under which the port falls.
verbose_name¶
Optionally the verbose (human-friendly) name of this port. Overriding this will override what is shown in the GUI (the default behavior is to derive the human-friendly name from the port name by replacing underscores with spaces, and capitalizing the first character.
autocast¶
Whether to automatically cast values into the type of the port. For instance, when an integer is assigned to a float port.
canbenone¶
Whether assignments to this port can be None. Otherwise assigning None values to this port will give an error.
safe¶
Whether allowing users to enter arbitrary values to this port is safe. Ports that could be used for script injection (e.g., in cloud environments) would be considered not safe. This only has an effect the when the value_type is object.
is_filename¶
Whether this port accepts file names. This has the consequence that strings will be properly path-normalized. This also applies to parameters that can be lists of file names (e.g., comma-separated).
send_signal_changed¶
Trigger a signal_changed flag for downstream nodes when the value of this node changes. On by default, but can be turned off if desired in certain situations (so the value can be changed without triggering signal_changed. The signal_changed flag will always be set when value_type changes.
verbose¶
Verbose output for port assignments.
expert¶
Whether this port is for use by experts. Some user interfaces may not show expert ports unless the interface is set to "expert" mode itself.
is_visible¶
Whether the value of this parameter port is visible in a client application.
editable¶
Whether the value of this parameter port is editable in a client application.
relationships¶
Defines relationships with other parameter ports in a pipeline, which may control elements of this port, such as the domain, visibility, or editability. At present, the following syntax is supported 'domain:portname' or 'editable:portname'.
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.