DataStorage

DataStorage wrapper — Pythonic access to the MITK DataStorage.

class mitk_workbench_remote.storage.DataStorage(transport)

Bases: object

CRUD interface for DataNode objects.

Obtained from a Workbench instance via workbench.storage. Do not construct directly.

Parameters:

transport (RestTransport) – The REST transport used for all HTTP calls.

list(*, data_type=None, toplevel=False)

Return all nodes, optionally filtered.

Parameters:
  • data_type (str | None (default: None)) – If given, only return nodes whose MITK data type matches this string (e.g. "Image").

  • toplevel (bool (default: False)) – If True, only return root-level nodes (no parent).

Return type:

list[DataNode]

Returns:

List of DataNode objects.

filter(*, data_type=None, toplevel=False, parent_uid=None, properties=None, scope=PropertyScope.ALL, context=None)

Return nodes matching the given filters.

Parameters:
  • data_type (str | None (default: None)) – If given, only return nodes whose MITK data type matches this string (e.g. "Image").

  • toplevel (bool (default: False)) – If True, only return root-level nodes (no parent).

  • parent_uid (str | None (default: None)) – If given, only return direct children of this node.

  • properties (dict[str, Any] | None (default: None)) – If given, only return nodes whose properties match all entries. Values are serialized with the same rules as set_property(): simple types pass through, color is wrapped as a ColorProperty wire dict. Wildcard characters * and ? are supported for string values.

  • scope (PropertyScope (default: <PropertyScope.ALL: 'all'>)) – Property scope for the property filters ("all", "node", or "data"). Only used when properties is given.

  • context (str | None (default: None)) – Renderer context for the property filters. Only used when properties is given.

Return type:

list[DataNode]

Returns:

List of DataNode objects.

get(uid)

Fetch a single node by UID.

Parameters:

uid (str) – Node identifier.

Return type:

DataNode

Returns:

The matching DataNode.

Raises:

NodeNotFoundError – If no node with this UID exists.

create(name, *, parent=None)

Create a new empty node in the DataStorage.

Parameters:
  • name (str) – Display name for the new node.

  • parent (DataNode | str | None (default: None)) – Parent node (a DataNode instance or a UID string). When None the node is created at the top level.

Return type:

DataNode

Returns:

The newly created DataNode.