API Reference¶
API Object¶
- class nion.typeshed.API_1_0.API¶
An interface to Nion Swift.
This class cannot be instantiated directly. Use
api_broker.get_api(version)
to get access an instance of this class.- property application: Application¶
Return the application object.
Added in version 1.0.
Scriptable: Yes
- create_calibration(offset: float = None, scale: float = None, units: str = None) Calibration ¶
Create a calibration object with offset, scale, and units.
- Parameters:
offset – The offset of the calibration.
scale – The scale of the calibration.
units – The units of the calibration as a string.
- Returns:
The calibration object.
Added in version 1.0.
Scriptable: Yes
- Calibrated units and uncalibrated units have the following relationship:
calibrated_value = offset + value * scale
- create_data_and_metadata(data: ndarray, intensity_calibration: Calibration = None, dimensional_calibrations: List[Calibration] = None, metadata: dict = None, timestamp: str = None, data_descriptor: DataDescriptor = None) DataAndMetadata ¶
Create a data_and_metadata object from data.
- Parameters:
data – an ndarray of data.
intensity_calibration – An optional calibration object.
dimensional_calibrations – An optional list of calibration objects.
metadata – A dict of metadata.
timestamp – A datetime object.
data_descriptor – A data descriptor describing the dimensions.
Added in version 1.0.
Scriptable: Yes
- create_data_and_metadata_from_data(data: ndarray, intensity_calibration: Calibration = None, dimensional_calibrations: List[Calibration] = None, metadata: dict = None, timestamp: str = None) DataAndMetadata ¶
Create a data_and_metadata object from data.
Added in version 1.0.
Deprecated since version 1.1: Use
create_data_and_metadata()
instead.Scriptable: No
- create_data_and_metadata_io_handler(io_handler_delegate)¶
Create an I/O handler that reads and writes a single data_and_metadata.
- Parameters:
io_handler_delegate – A delegate object
DataAndMetadataIOHandlerInterface
Added in version 1.0.
Scriptable: No
- create_data_descriptor(is_sequence: bool, collection_dimension_count: int, datum_dimension_count: int) DataDescriptor ¶
Create a data descriptor.
- Parameters:
is_sequence – whether the descriptor describes a sequence of data.
collection_dimension_count – the number of collection dimensions represented by the descriptor.
datum_dimension_count – the number of datum dimensions represented by the descriptor.
Added in version 1.0.
Scriptable: Yes
- create_panel(panel_delegate)¶
Create a utility panel that can be attached to a window.
Added in version 1.0.
Scriptable: No
- The panel_delegate should respond to the following:
(property, read-only) panel_id (property, read-only) panel_name (property, read-only) panel_positions (a list from “top”, “bottom”, “left”, “right”, “all”) (property, read-only) panel_position (from “top”, “bottom”, “left”, “right”, “none”) (method, required) create_panel_widget(ui), returns a widget (method, optional) close()
- get_hardware_source_by_id(hardware_source_id: str, version: str)¶
Return the hardware source API matching the hardware_source_id and version.
Added in version 1.0.
Scriptable: Yes
Application¶
- class nion.typeshed.API_1_0.Application¶
- property document_controllers: List[DocumentWindow]¶
Return the document controllers.
Added in version 1.0.
Deprecated since version 1.1: Use
document_windows
instead.Scriptable: Yes
- property document_windows: List[DocumentWindow]¶
Return the document windows.
Added in version 1.0.
Scriptable: Yes
DataGroup¶
- class nion.typeshed.API_1_0.DataGroup¶
- add_data_item(data_item: DataItem) None ¶
Add a data item to the group.
- Parameters:
data_item – The
nion.swift.Facade.DataItem
object to add.
Added in version 1.0.
Scriptable: Yes
- property uuid: UUID¶
Return the uuid of this object.
Added in version 1.0.
Scriptable: Yes
DataItem¶
- class nion.typeshed.API_1_0.DataItem¶
- add_point_region(y: float, x: float) Graphic ¶
Add a point graphic to the data item.
- Parameters:
x – The x coordinate, in relative units [0.0, 1.0]
y – The y coordinate, in relative units [0.0, 1.0]
- Returns:
The
nion.swift.Facade.Graphic
object that was added.
Added in version 1.0.
Scriptable: Yes
- property created: datetime¶
Return the created timestamp (UTC) as a datetime object.
Added in version 1.0.
Scriptable: Yes
- property data: ndarray¶
Return the data as a numpy ndarray.
Added in version 1.0.
Scriptable: Yes
- property data_and_metadata: DataAndMetadata¶
Return the extended data.
Added in version 1.0.
Deprecated since version 1.1: Use
xdata
instead.Scriptable: Yes
- delete_metadata_value(key: str) None ¶
Delete the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other applications. Please consult reference documentation for valid keys.
If using a custom key, we recommend structuring your keys in the ‘<dotted>.<group>.<attribute>’ format followed by the predefined keys. e.g. ‘stem.session.instrument’ or ‘stm.camera.binning’.
Also note that some predefined keys map to the metadata
dict
but others do not. For this reason, prefer using themetadata_value
methods over directly accessingmetadata
.Added in version 1.0.
Scriptable: Yes
- property dimensional_calibrations: List[Calibration]¶
Return a copy of the list of dimensional calibrations.
Added in version 1.0.
Scriptable: Yes
- property display_xdata: DataAndMetadata¶
Return the extended data of this data item display.
Display data will always be 1d or 2d and either int, float, or RGB data type.
Added in version 1.0.
Scriptable: Yes
- get_metadata_value(key: str) Any ¶
Get the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other applications. Please consult reference documentation for valid keys.
If using a custom key, we recommend structuring your keys in the ‘<group>.<attribute>’ format followed by the predefined keys. e.g. ‘session.instrument’ or ‘camera.binning’.
Also note that some predefined keys map to the metadata
dict
but others do not. For this reason, prefer using themetadata_value
methods over directly accessingmetadata
.Added in version 1.0.
Scriptable: Yes
- property graphics: List[Graphic]¶
Return the graphics attached to this data item.
Added in version 1.0.
Scriptable: Yes
- has_metadata_value(key: str) bool ¶
Return whether the metadata value for the given key exists.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other applications. Please consult reference documentation for valid keys.
If using a custom key, we recommend structuring your keys in the ‘<group>.<attribute>’ format followed by the predefined keys. e.g. ‘session.instrument’ or ‘camera.binning’.
Also note that some predefined keys map to the metadata
dict
but others do not. For this reason, prefer using themetadata_value
methods over directly accessingmetadata
.Added in version 1.0.
Scriptable: Yes
- property intensity_calibration: Calibration¶
Return a copy of the intensity calibration.
Added in version 1.0.
Scriptable: Yes
- mask_xdata() DataAndMetadata ¶
Return the mask by combining any mask graphics on this data item as extended data.
Added in version 1.0.
Scriptable: Yes
- property metadata: dict¶
Return a copy of the metadata as a dict.
For best future compatibility, prefer using the
get_metadata_value
andset_metadata_value
methods over directly accessingmetadata
.Added in version 1.0.
Scriptable: Yes
- property modified: datetime¶
Return the modified timestamp (UTC) as a datetime object.
Added in version 1.0.
Scriptable: Yes
- property regions: List[Graphic]¶
Return the graphics attached to this data item.
Added in version 1.0.
Deprecated since version 1.1: Use
graphics
instead.Scriptable: Yes
- set_data(data: ndarray) None ¶
Set the data.
- Parameters:
data – A numpy ndarray.
Added in version 1.0.
Scriptable: Yes
- set_data_and_metadata(data_and_metadata: DataAndMetadata) None ¶
Set the data and metadata.
- Parameters:
data_and_metadata – The data and metadata.
Added in version 1.0.
Scriptable: Yes
- set_dimensional_calibrations(dimensional_calibrations: List[Calibration]) None ¶
Set the dimensional calibrations.
- Parameters:
dimensional_calibrations – A list of calibrations, must match the dimensions of the data.
Added in version 1.0.
Scriptable: Yes
- set_intensity_calibration(intensity_calibration: Calibration) None ¶
Set the intensity calibration.
- Parameters:
intensity_calibration – The intensity calibration.
Added in version 1.0.
Scriptable: Yes
- set_metadata(metadata: dict) None ¶
Set the metadata dict.
- Parameters:
metadata – The metadata dict.
The metadata dict must be convertible to JSON, e.g.
json.dumps(metadata)
must succeed.For best future compatibility, prefer using the
get_metadata_value
andset_metadata_value
methods over directly accessingmetadata
.Added in version 1.0.
Scriptable: Yes
- set_metadata_value(key: str, value: Any) None ¶
Set the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other applications. Please consult reference documentation for valid keys.
If using a custom key, we recommend structuring your keys in the ‘<group>.<attribute>’ format followed by the predefined keys. e.g. ‘session.instrument’ or ‘camera.binning’.
Also note that some predefined keys map to the metadata
dict
but others do not. For this reason, prefer using themetadata_value
methods over directly accessingmetadata
.Added in version 1.0.
Scriptable: Yes
- property title: str¶
Return the title as a string.
Added in version 1.0.
Scriptable: Yes
- property uuid: UUID¶
Return the uuid of this object.
Added in version 1.0.
Scriptable: Yes
- property xdata: DataAndMetadata¶
Return the extended data of this data item.
Added in version 1.0.
Scriptable: Yes
DisplayPanel¶
- class nion.typeshed.API_1_0.DisplayPanel¶
- property data_item: DataItem¶
Return the data item associated with this display panel.
Added in version 1.0.
Scriptable: Yes
- set_data_item(data_item: DataItem) None ¶
Set the data item associated with this display panel.
- Parameters:
data_item – The
nion.swift.Facade.DataItem
object to add.
This will replace whatever data item, browser, or controller is currently in the display panel with the single data item.
Added in version 1.0.
Scriptable: Yes
DocumentWindow¶
- class nion.typeshed.API_1_0.DocumentWindow¶
- add_data(data: ndarray, title: str = None) DataItem ¶
Create a data item in the library from data.
Added in version 1.0.
Deprecated since version 1.1: Use
create_data_item_from_data()
instead.Scriptable: No
- property all_display_panels: List[DisplayPanel]¶
Return the list of display panels currently visible.
Added in version 1.0.
Scriptable: Yes
- create_data_item_from_data(data: ndarray, title: str = None) DataItem ¶
Create a data item in the library from data.
Added in version 1.0.
Deprecated since version 1.1: Use
create_data_item_from_data()
instead.Scriptable: No
- create_data_item_from_data_and_metadata(data_and_metadata: DataAndMetadata, title: str = None) DataItem ¶
Create a data item in the library from the data and metadata.
Added in version 1.0.
Deprecated since version 1.1: Use
create_data_item_from_data_and_metadata()
instead.Scriptable: No
- display_data_item(data_item: DataItem, source_display_panel=None, source_data_item=None)¶
Display a new data item and gives it keyboard focus. Uses existing display if it is already displayed.
Added in version 1.0.
Status: Provisional Scriptable: Yes
- get_display_panel_by_id(identifier: str) DisplayPanel ¶
Return display panel with the identifier.
Added in version 1.0.
Status: Provisional Scriptable: Yes
- get_or_create_data_group(title: str) DataGroup ¶
Get (or create) a data group.
Added in version 1.0.
Deprecated since version 1.1: Use
create_data_item_from_data()
instead.Scriptable: No
- show_get_string_message_box(caption: str, text: str, accepted_fn, rejected_fn=None, accepted_text: str = None, rejected_text: str = None) None ¶
Show a dialog box and ask for a string.
Caption describes the user prompt. Text is the initial/default string.
Accepted function must be a function taking one argument which is the resulting text if the user accepts the message dialog. It will only be called if the user clicks OK.
Rejected function can be a function taking no arguments, called if the user clicks Cancel.
Added in version 1.0.
Scriptable: No
Graphic¶
- class nion.typeshed.API_1_0.Graphic¶
- property angle: float¶
Return the angle (radians) property.
- property bounds: Tuple[Tuple[float, float], Tuple[float, float]]¶
Return the bounds property in relative coordinates.
Bounds is a tuple ((top, left), (height, width))
- property center: Tuple[float, float]¶
Return the center property in relative coordinates.
Center is a tuple (y, x).
- property end: float | Tuple[float, float]¶
Return the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line.
- property graphic_id: str¶
Return the graphic identifier.
Added in version 1.0.
Scriptable: Yes
- property graphic_type: str¶
Return the type of this graphic.
Added in version 1.0.
Scriptable: Yes
- property interval: Tuple[float, float]¶
Return the interval property in relative coordinates.
Interval is a tuple of floats (start, end).
- property label: str¶
Return the graphic label.
Added in version 1.0.
Scriptable: Yes
- mask_xdata_with_shape(shape: Sequence[int]) DataAndMetadata ¶
Return the mask created by this graphic as extended data.
Added in version 1.0.
Scriptable: Yes
- property position: Tuple[float, float]¶
Return the position property in relative coordinates.
Position is a tuple of floats (y, x).
- property size: Tuple[float, float]¶
Return the size property in relative coordinates.
Size is a tuple of floats (height, width).
- property start: float | Tuple[float, float]¶
Return the start property in relative coordinates.
Start may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line.
- property type: str¶
Return the region type property.
The region type is different from the preferred ‘graphic_type’ in that it is backwards compatible with older versions.
Added in version 1.0.
Scriptable: Yes
- property uuid: UUID¶
Return the uuid of this object.
Added in version 1.0.
Scriptable: Yes
- property vector: Tuple[Tuple[float, float], Tuple[float, float]]¶
Return the vector property in relative coordinates.
Vector will be a tuple of tuples ((y_start, x_start), (y_end, x_end)).
HardwareSource¶
- class nion.typeshed.HardwareSource_1_0.HardwareSource¶
- create_record_task(frame_parameters: dict = None, channels_enabled: List[bool] = None) RecordTask ¶
Create a record task for this hardware source.
Added in version 1.0.
- Parameters:
frame_parameters (
FrameParameters
) – The frame parameters for the record. Pass None for defaults.channels_enabled (List of booleans.) – The enabled channels for the record. Pass None for defaults.
- Returns:
The
RecordTask
object.- Return type:
RecordTask
Callers should call close on the returned task when finished.
See
RecordTask
for examples of how to use.
- create_view_task(frame_parameters: dict = None, channels_enabled: List[bool] = None, buffer_size: int = 1) ViewTask ¶
Create a view task for this hardware source.
Added in version 1.0.
- Parameters:
frame_parameters (
FrameParameters
) – The frame parameters for the view. Pass None for defaults.channels_enabled (List of booleans.) – The enabled channels for the view. Pass None for defaults.
buffer_size (int) – The buffer size if using the grab_earliest method. Default is 1.
- Returns:
The
ViewTask
object.- Return type:
ViewTask
Callers should call close on the returned task when finished.
See
ViewTask
for examples of how to use.
- grab_next_to_finish(timeout: float = None) List[DataAndMetadata] ¶
Grabs the next frame to finish and returns it as data and metadata.
Added in version 1.0.
- Parameters:
timeout – The timeout in seconds. Pass None to use default.
- Returns:
The list of data and metadata items that were read.
- Return type:
list of
DataAndMetadata
If the view is not already started, it will be started automatically.
Scriptable: Yes
- record(frame_parameters: dict = None, channels_enabled: List[bool] = None, timeout: float = None) List[DataAndMetadata] ¶
Record data and return a list of data_and_metadata objects.
Added in version 1.0.
- Parameters:
frame_parameters (
FrameParameters
) – The frame parameters for the record. Pass None for defaults.channels_enabled (List of booleans.) – The enabled channels for the record. Pass None for defaults.
timeout – The timeout in seconds. Pass None to use default.
- Returns:
The list of data and metadata items that were read.
- Return type:
list of
DataAndMetadata
Instrument¶
- class nion.typeshed.HardwareSource_1_0.Instrument¶
Represents an instrument with controls and properties.
A control is part of a network of dependent properties where the output is the weighted sum of inputs with an added value.
A property is a simple value with a specific type that can be set or read.
The instrument class provides the ability to have temporary states where changes to the instrument are recorded and restored when finished. Calls to begin/end temporary state should be matched.
The class also provides the ability to group a set of operations and have them be applied together. Calls to begin/end transaction should be matched.
- get_control_output(name: str) float ¶
Return the value of a control.
- Returns:
The control value.
Raises exception if control with name doesn’t exist.
Added in version 1.0.
Scriptable: Yes
- get_property_as_float(name: str) float ¶
Return the value of a float property.
- Returns:
The property value (float).
Raises exception if property with name doesn’t exist.
Added in version 1.0.
Scriptable: Yes
- set_control_output(name: str, value: float, *, options: dict = None) None ¶
Set the value of a control asynchronously.
- Parameters:
name – The name of the control (string).
value – The control value (float).
options – A dict of custom options to pass to the instrument for setting the value.
- Options are:
value_type: local, delta, output. output is default. confirm, confirm_tolerance_factor, confirm_timeout: confirm value gets set. inform: True to keep dependent control outputs constant by adjusting their internal values. False is default.
Default value of confirm is False.
Default confirm_tolerance_factor is 1.0. A value of 1.0 is the nominal tolerance for that control. Passing a higher tolerance factor (for example 1.5) will increase the permitted error margin and passing lower tolerance factor (for example 0.5) will decrease the permitted error margin and consequently make a timeout more likely. The tolerance factor value 0.0 is a special value which removes all checking and only waits for any change at all and then returns.
Default confirm_timeout is 16.0 (seconds).
Raises exception if control with name doesn’t exist.
Raises TimeoutException if confirm is True and timeout occurs.
Added in version 1.0.
Scriptable: Yes
- set_property_as_float(name: str, value: float) None ¶
Set the value of a float property.
- Parameters:
name – The name of the property (string).
value – The property value (float).
Raises exception if property with name doesn’t exist.
Added in version 1.0.
Scriptable: Yes
Library¶
- class nion.typeshed.API_1_0.Library¶
- copy_data_item(data_item: DataItem) DataItem ¶
Copy a data item.
Added in version 1.0.
Scriptable: No
- create_data_item(title: str = None) DataItem ¶
Create an empty data item in the library.
- Parameters:
title – The title of the data item (optional).
- Returns:
The new
nion.swift.Facade.DataItem
object.- Return type:
nion.swift.Facade.DataItem
Added in version 1.0.
Scriptable: Yes
- create_data_item_from_data(data: ndarray, title: str = None) DataItem ¶
Create a data item in the library from an ndarray.
The data for the data item will be written to disk immediately and unloaded from memory. If you wish to delay writing to disk and keep using the data, create an empty data item and use the data item methods to modify the data.
- Parameters:
data – The data (ndarray).
title – The title of the data item (optional).
- Returns:
The new
nion.swift.Facade.DataItem
object.- Return type:
nion.swift.Facade.DataItem
Added in version 1.0.
Scriptable: Yes
- create_data_item_from_data_and_metadata(data_and_metadata: DataAndMetadata, title: str = None) DataItem ¶
Create a data item in the library from a data and metadata object.
The data for the data item will be written to disk immediately and unloaded from memory. If you wish to delay writing to disk and keep using the data, create an empty data item and use the data item methods to modify the data.
- Parameters:
data_and_metadata – The data and metadata.
title – The title of the data item (optional).
- Returns:
The new
nion.swift.Facade.DataItem
object.- Return type:
nion.swift.Facade.DataItem
Added in version 1.0.
Scriptable: Yes
- property data_item_count: int¶
Return the data item count.
- Returns:
The number of data items.
Added in version 1.0.
Scriptable: Yes
- property data_items: List[DataItem]¶
Return the list of data items.
- Returns:
The list of
nion.swift.Facade.DataItem
objects.
Added in version 1.0.
Scriptable: Yes
- delete_library_value(key: str) None ¶
Delete the library value for the given key.
Please consult the developer documentation for a list of valid keys.
Added in version 1.0.
Scriptable: Yes
- property display_items: List[Display]¶
Return the list of display items.
- Returns:
The list of
nion.swift.Facade.Display
objects.
Added in version 1.0.
Scriptable: Yes
- get_data_item_by_uuid(data_item_uuid: UUID) DataItem ¶
Get the data item with the given UUID.
Added in version 1.0.
Status: Provisional Scriptable: Yes
- get_data_item_for_hardware_source(hardware_source, channel_id: str = None, processor_id: str = None, create_if_needed: bool = False, large_format: bool = False) DataItem ¶
Get the data item associated with hardware source and (optional) channel id and processor_id. Optionally create if missing.
- Parameters:
hardware_source – The hardware_source.
channel_id – The (optional) channel id.
processor_id – The (optional) processor id for the channel.
create_if_needed – Whether to create a new data item if none is found.
- Returns:
The associated data item. May be None.
Added in version 1.0.
Status: Provisional Scriptable: Yes
- get_data_item_for_reference_key(data_item_reference_key: str = None, create_if_needed: bool = False, large_format: bool = False) DataItem ¶
Get the data item associated with data item reference key. Optionally create if missing.
- Parameters:
data_item_reference_key – The data item reference key.
create_if_needed – Whether to create a new data item if none is found.
- Returns:
The associated data item. May be None.
Added in version 1.0.
Status: Provisional Scriptable: Yes
- get_dependent_data_items(data_item: DataItem) List[DataItem] ¶
Return the dependent data items the data item argument.
- Returns:
The list of
nion.swift.Facade.DataItem
objects.
Added in version 1.0.
Scriptable: Yes
- get_graphic_by_uuid(graphic_uuid: UUID) Graphic ¶
Get the graphic with the given UUID.
Added in version 1.0.
Status: Provisional Scriptable: Yes
- get_library_value(key: str) Any ¶
Get the library value for the given key.
Please consult the developer documentation for a list of valid keys.
Added in version 1.0.
Scriptable: Yes
- get_or_create_data_group(title: str) DataGroup ¶
Get (or create) a data group.
- Parameters:
title – The title of the data group.
- Returns:
The new
nion.swift.Facade.DataGroup
object.- Return type:
nion.swift.Facade.DataGroup
Added in version 1.0.
Scriptable: Yes
- get_source_data_items(data_item: DataItem) List[DataItem] ¶
Return the list of data items that are data sources for the data item.
- Returns:
The list of
nion.swift.Facade.DataItem
objects.
Added in version 1.0.
Scriptable: Yes
- has_library_value(key: str) bool ¶
Return whether the library value for the given key exists.
Please consult the developer documentation for a list of valid keys.
Added in version 1.0.
Scriptable: Yes
- set_library_value(key: str, value: Any) None ¶
Set the library value for the given key.
Please consult the developer documentation for a list of valid keys.
Added in version 1.0.
Scriptable: Yes
- snapshot_data_item(data_item: DataItem) DataItem ¶
Snapshot a data item. Similar to copy but with a data snapshot.
Added in version 1.0.
Scriptable: No
- property uuid: UUID¶
Return the uuid of this object.
Added in version 1.0.
Scriptable: Yes
RecordTask¶
- class nion.swift.Facade.RecordTask(hardware_source: HardwareSourceLike, frame_parameters: Mapping[str, Any] | None, channels_enabled: Sequence[bool] | None)¶
- close() None ¶
Close the task.
Added in version 1.0.
This method must be called when the task is no longer needed.
- grab() Sequence[DataAndMetadata | None] ¶
Grab list of data/metadata from the task.
Added in version 1.0.
This method will wait until the task finishes.
- Returns:
The list of data and metadata items that were read.
- Return type:
list of
DataAndMetadata
- property is_finished: bool¶
Return a boolean indicating whether the task is finished.
Added in version 1.0.
ViewTask¶
- class nion.swift.Facade.ViewTask(view_task: ViewTaskLike)¶
- close() None ¶
Close the task.
Added in version 1.0.
This method must be called when the task is no longer needed.
- grab_earliest() Sequence[DataAndMetadata] ¶
Grab list of data/metadata from the task.
Added in version 1.0.
This method will return the earliest item in the buffer or wait for the next one to finish.
- Returns:
The list of data and metadata items that were read.
- Return type:
list of
DataAndMetadata
- grab_immediate() Sequence[DataAndMetadata] ¶
Grab list of data/metadata from the task.
Added in version 1.0.
This method will return immediately if data is available.
- Returns:
The list of data and metadata items that were read.
- Return type:
list of
DataAndMetadata
- grab_next_to_finish() Sequence[DataAndMetadata] ¶
Grab list of data/metadata from the task.
Added in version 1.0.
This method will wait until the current frame completes.
- Returns:
The list of data and metadata items that were read.
- Return type:
list of
DataAndMetadata
- grab_next_to_start() Sequence[DataAndMetadata] ¶
Grab list of data/metadata from the task.
Added in version 1.0.
This method will wait until the current frame completes and the next one finishes.
- Returns:
The list of data and metadata items that were read.
- Return type:
list of
DataAndMetadata
DataAndMetadataIOHandlerInterface¶
- class nion.swift.Facade.DataAndMetadataIOHandlerInterface¶
An interface for an IO handler delegate. Implement each of the methods and properties, as required.
- can_write_data_and_metadata(data_metadata: DataMetadata, extension: Sequence[str]) bool ¶
Return whether the data_and_metadata can be written to a file with the given extension.
Added in version 1.0.
- Parameters:
data_and_metadata (
DataAndMetadata
) – The data to write.extension – The extension of the file, e.g. “tif”.
- Returns:
Whether the file can be written.
- Return type:
boolean
Implementers should not ask for data from the data_and_metadata object as this may affect performance.
- property io_handler_extensions: Sequence[str]¶
List of extensions handled by the IO handler.
- Return type:
list of str
Added in version 1.0.
- property io_handler_id: str¶
Unique identifier of the IO handler. This will be used to uniquely identify this IO handler.
An example identifier might be “my.company.example.1”.
- Return type:
str
Added in version 1.0.
- property io_handler_name: str¶
Name of the IO handler. This will appear to the user.
- Return type:
str
Added in version 1.0.
- read_data_and_metadata(extension: str, file_path: str) DataAndMetadata ¶
Read data from the file_path and return it in a data_and_metadata object.
Added in version 1.0.
- Parameters:
extension – The extension of the file_path, e.g. “tif”.
file_path – The path to the file.
- Returns:
The data and metadata that was read.
- Return type:
DataAndMetadata
- write_data_and_metadata(data_and_metadata: DataAndMetadata, file_path: str, extension: str) None ¶
Write the data_and_metadata to the file_path with the given extension.
Added in version 1.0.
- Parameters:
data_and_metadata – A
DataAndMetadata
object.file_path – The path to the file.
extension – The extension of the file, e.g. “tif”.