zea.interface¶
Convenience interface for loading and displaying ultrasound data.
Example usage¶
>>> import zea
>>> from zea.internal.setup_zea import setup_config
>>> config = setup_config("hf://zeahub/configs/config_camus.yaml")
>>> interface = zea.Interface(config)
>>> interface.run(plot=True)
Classes
|
Interface for selecting / loading / processing single ultrasound images. |
- class zea.interface.Interface(config=None, verbose=True, validate_file=True)[source]¶
Bases:
objectInterface for selecting / loading / processing single ultrasound images.
Useful for inspecting datasets and single ultrasound images.
# TODO: maybe we can refactor such that it is clear what needs to be in config.
Initialize Interface.
- Parameters:
config (
Config) – Configuration object.verbose (
bool) – Whether to print verbose output.validate_file (
bool) – Whether to validate the file.
- property data_root¶
Root path to data file.
- property dataset_folder¶
Path to dataset folder.
- property dtype¶
Data type of data when loaded from file.
- property file_path¶
Path to data file.
- property frame_no¶
Frame number to display.
- get_data()[source]¶
Get data. Chosen datafile should be listed in the dataset.
Using either file specified in config or if None, the ui window.
- Returns:
data array of shape (n_tx, n_el, n_ax, N_ch)
- Return type:
data (np.ndarray)
- plot(data=None, save=False, block=True)[source]¶
Plot image using matplotlib or opencv.
- Parameters:
save (
bool) – whether to save the image to disk.block (
bool) – whether to block the UI while plotting.
- Returns:
plotted image (grabbed from figure).
- Return type:
image (np.ndarray)
- save_image(fig, path=None)[source]¶
Save image to disk.
- Parameters:
fig (fig object) – figure.
path (str, optional) – path to save image to. Defaults to None.
- save_video(images, path=None)[source]¶
Save video to disk.
- Parameters:
images (list) – list of images.
path (str, optional) – path to save image to. Defaults to None.
- property to_dtype¶
Data type to convert to for display.