api

class BaseAdapter[source]

Bases: ABC

The purpose of the BaseAdapter class is to provide the framework to convert from any given input data type into the IPASC format. It can be used as a basis for extension for a custom Adapter.

To achieve this, one needs to inherit from BaseAdapter and implement the abstract methods:

class CustomAdapter(BaseAdapter):

    def __init__():
        # TODO do all of the loading etc here
        # Then call the __init__ of the BaseAdapter
        super(CustomAdapter, self).__init__()
        # TODO Add custom parameters after calling BaseAdapter.__init__

    def generate_binary_data(self):
        # TODO

    def generate_device_meta_data(self):
        # TODO

    def set_metadata_value(self, metadatum: MetaDatum):
        # TODO
add_custom_meta_datum_field(key: str, value: object)[source]

This method can be used to add a metadata field that is not reflected in the standard list of metadata of the IPASC format. Must be called after the __init__ method of the BaseAdapter was called. The custom meta data are stored in the AcquisitionMetadata dictionary.

Parameters:
  • key (str) – The unique name with which the value is stored in the dictionary.

  • value (object) – The value to store.

generate_acquisition_meta_data() dict[source]

Internal method

Return type:

dict

abstract generate_binary_data() ndarray[source]

The binary data is the raw time series data. It is internally stored as an N-dimensional numpy array. The binary data must be formatted the following way:

[detectors, samples, wavelengths, measurements]

Returns:

A numpy array containing the binary data

Return type:

np.ndarray

abstract generate_device_meta_data() dict[source]

Must be implemented to define a digital twin of the photoacoustic imaging device. This method can be implemented using the DeviceMetaDataCreator.

Returns:

A dictionary containing all key-value pair necessary to describe a digital twin of a photoacoustic device.

Return type:

dict

generate_pa_data() PAData[source]

Internal method

Return type:

PAData

abstract set_metadata_value(metadatum: MetaDatum) object[source]

This method must be implemented to yield appropriate data for all MetaDatum elements in the MetadataTags class.

You are given a certain meta datum nd have to return the appropriate information.

Parameters:

metadatum (MetaDatum) – The MetaDatum for which to return the correct data.

Returns:

The data corresponding to the given MetaDatum

Return type:

object