Skip to content

← programming package

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.

  • verbose name: Value
  • default value: None
  • port type: DataPort
  • value type: object (can be None)
  • data direction: OUT

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.

  • verbose name: Parameter Name
  • default value: data
  • port type: StringPort
  • value type: str (can be None)

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.)

  • verbose name: Default Value
  • default value:
  • port type: Port
  • value type: object (can be None)

value_type

Default value type of the port. This determines what type of port is generated for the enclosing node.

  • verbose name: Value Type
  • default value: str
  • port type: EnumPort
  • value type: str (can be None)

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: . The default expected location of this file is the 'resources' folder of the Neuropype installation.

  • verbose name: Domain
  • default value: None
  • port type: Port
  • value type: object (can be None)

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.

  • verbose name: Select
  • default value: none
  • port type: EnumPort
  • value type: str (can be None)

desc

Description of the port. This description may be shown in GUIs and auto-generated documentation.

  • verbose name: Description
  • default value:
  • port type: StringPort
  • value type: str (can be None)

port_category

Human-readable category under which the port falls.

  • verbose name: Port Category
  • default value:
  • port type: StringPort
  • value type: str (can be None)

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.

  • verbose name: Human-Readable Name (Optional)
  • default value: None
  • port type: StringPort
  • value type: str (can be None)

autocast

Whether to automatically cast values into the type of the port. For instance, when an integer is assigned to a float port.

  • verbose name: Auto-Cast To Value Type
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

canbenone

Whether assignments to this port can be None. Otherwise assigning None values to this port will give an error.

  • verbose name: Can Be None
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

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.

  • verbose name: Safe For Network Use
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

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).

  • verbose name: Is Filename
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

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 name: Send Signal Changed
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

verbose

Verbose output for port assignments.

  • verbose name: Verbose
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

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.

  • verbose name: Expert
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

is_visible

Whether the value of this parameter port is visible in a client application.

  • verbose name: Is Visible
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

editable

Whether the value of this parameter port is editable in a client application.

  • verbose name: Editable
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

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'.

  • verbose name: Relationships
  • default value: []
  • port type: ListPort
  • value type: list (can be None)

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)