navigate.model.features.feature_container.DataNode
- class navigate.model.features.feature_container.DataNode(feature_name, func_dict, *, node_type='one-step', device_related=False, need_response=False, **kwargs)
Bases:
TreeNode
DataNode class for representing a data-processing node in a control sequence tree.
This class represents a data-processing node in a control sequence tree used for controlling the behavior of a microscope or similar device. It inherits from the TreeNode class and adds data processing capabilities.
Notes:
This class is used to represent data-processing nodes in a control sequence tree where each node corresponds to a data processing step in the control sequence.
The node_funcs attribute contains a dictionary of functions associated with this node, which are executed during different data processing steps.
The node_type attribute specifies whether the node is a ‘one-step’ node or a ‘multi-step’ node.
The device_related attribute indicates whether the node is related to device control.
The need_response attribute indicates whether a response is expected from this node when it is executed.
The is_marked attribute can be used to mark the node for special handling or to indicate its status.
- __init__(feature_name, func_dict, *, node_type='one-step', device_related=False, need_response=False, **kwargs)
Initialize the DataNode object.
Parameters:
- feature_namestr
The name or identifier of the feature associated with this node.
- func_dictdict
A dictionary containing functions associated with this node. The dictionary should include keys for different data processing steps and corresponding function references to be executed during those steps.
- node_typestr, optional
The type of the node, which can be ‘one-step’ or ‘multi-step’. Default is ‘one-step’.
- device_relatedbool, optional
A boolean indicating whether the node is related to device control. Default is False.
- need_responsebool, optional
A boolean indicating whether a response is needed from this node. Default is False.
- is_markedbool, optional
A boolean indicating whether the node is marked. Default is False.
Methods
__init__
(feature_name, func_dict, *[, ...])Initialize the DataNode object.
run
(*args)Execute the data processing functions associated with this node.
set_property
(**kwargs)Set the properties of the TreeNode object using keyword arguments.
Attributes
A boolean indicating whether the node is marked.
- run(*args)
Execute the data processing functions associated with this node.
This method is used to execute the data processing functions associated with this node during the control sequence. It initializes the node if not already initialized and determines whether the current frame meets the criteria to execute the main data processing function.
Parameters:
- *argsany
Additional arguments to pass to the data processing functions.
Returns:
- tuple
A tuple containing the result of executing the main data processing function and a boolean indicating whether the node execution is complete (True if complete, otherwise False).
- set_property(**kwargs)
Set the properties of the TreeNode object using keyword arguments.
This method allows setting or updating the properties of the TreeNode object using keyword arguments. The method iterates through the provided keyword- argument pairs and updates the corresponding attributes of the TreeNode object.
Parameters:
- **kwargsdict
Keyword arguments with attribute names as keys and values to set as values.
- device_related
A boolean indicating whether the node is related to device control.
- Type:
bool
- is_initialized
A boolean indicating whether the node has been initialized.
- Type:
bool
- is_marked
A boolean indicating whether the node is marked.
- Type:
bool
- need_response
A boolean indicating whether a response is needed from this node.
- Type:
bool
- node_funcs
A dictionary containing functions associated with this node.
- Type:
dict
- node_name
The name or identifier of the feature associated with this node.
- Type:
str
- node_type
The type of the node, which can be ‘one-step’ or ‘multi-step’.
- Type:
str