illumination_geometries

class DiskIlluminationGeometry(beam_radius_mm=None, device_position_mm=None, field_of_view_extent_mm=None)[source]

Bases: IlluminationGeometryBase

This class represents a disk illumination geometry. The device position is defined as the middle of the disk.

Parameters:
  • beam_radius_mm (int, float) – Radius of the disk in mm.

  • device_position_mm (ndarray) – Each device has an internal position which serves as origin for internal representations of illuminator positions.

  • field_of_view_extent_mm (ndarray) – Field of view which is defined as a numpy array of the shape [xs, xe, ys, ye, zs, ze], where x, y, and z denote the coordinate axes and s and e denote the start and end positions.

static deserialize(dictionary_to_deserialize)[source]
get_mcx_illuminator_definition(global_settings) dict[source]

IMPORTANT: This method creates a dictionary that contains tags as they are expected for the mcx simulation tool to represent the illumination geometry of this device.

Parameters:

global_settings (Settings) – The global_settings instance containing the simulation instructions.

Returns:

Dictionary that includes all parameters needed for mcx.

Return type:

dict

serialize() dict[source]
class GaussianBeamIlluminationGeometry(beam_radius_mm=None, focal_length_mm=None, device_position_mm=None, field_of_view_extent_mm=None)[source]

Bases: IlluminationGeometryBase

This class represents a Gaussian beam illumination geometry. The position is defined as the middle of the beam.

Parameters:

beam_radius_mm – Initial radius of the gaussian beam at half maximum (full width at half maximum (FWHM))

in mm. :type beam_radius_mm: int, float :param focal_length_mm: Focal length of the gaussian beam in mm. Can be positive (focussed beam), negative (cone-shaped beam) or None (collimated beam). :type focal_length_mm: int, float :param device_position_mm: Each device has an internal position which serves as origin for internal representations of illuminator positions. :type device_position_mm: ndarray :param field_of_view_extent_mm: Field of view which is defined as a numpy array of the shape [xs, xe, ys, ye, zs, ze], where x, y, and z denote the coordinate axes and s and e denote the start and end positions. :type field_of_view_extent_mm: ndarray

static deserialize(dictionary_to_deserialize)[source]
get_mcx_illuminator_definition(global_settings) dict[source]

IMPORTANT: This method creates a dictionary that contains tags as they are expected for the mcx simulation tool to represent the illumination geometry of this device.

Parameters:

global_settings (Settings) – The global_settings instance containing the simulation instructions.

Returns:

Dictionary that includes all parameters needed for mcx.

Return type:

dict

serialize() dict[source]
class IlluminationGeometryBase(device_position_mm=None, source_direction_vector=None, field_of_view_extent_mm=None)[source]

Bases: DigitalDeviceTwinBase

This class is the base class for representing all illumination geometries.

Parameters:
  • device_position_mm (ndarray) – Each device has an internal position which serves as origin for internal representations of illuminator positions.

  • source_direction_vector (ndarray) – Direction of the illumination source.

  • field_of_view_extent_mm (ndarray) – Field of view which is defined as a numpy array of the shape [xs, xe, ys, ye, zs, ze], where x, y, and z denote the coordinate axes and s and e denote the start and end positions.

check_settings_prerequisites(global_settings) bool[source]

It might be that certain device geometries need a certain dimensionality of the simulated PAI volume, or that it requires the existence of certain Tags in the global global_settings. To this end, a PAI device should use this method to inform the user about a mismatch of the desired device and throw a ValueError if that is the case.

Parameters:

global_settings (Settings) – Settings for the entire simulation pipeline.

Raises:

ValueError – raises a value error if the prerequisites are not matched.

Returns:

True if the prerequisites are met, False if they are not met, but no exception has been raised.

Return type:

bool

static deserialize(dictionary_to_deserialize)[source]
abstract get_mcx_illuminator_definition(global_settings) dict[source]

IMPORTANT: This method creates a dictionary that contains tags as they are expected for the mcx simulation tool to represent the illumination geometry of this device.

Parameters:

global_settings (Settings) – The global_settings instance containing the simulation instructions.

Returns:

Dictionary that includes all parameters needed for mcx.

Return type:

dict

serialize() dict[source]
update_settings_for_use_of_model_based_volume_creator(global_settings) Settings[source]

This method can be overwritten by a PA device if the device poses special constraints to the volume that should be considered by the model-based volume creator.

Parameters:

global_settings (Settings) – Settings for the entire simulation pipeline.

class MSOTAcuityIlluminationGeometry[source]

Bases: IlluminationGeometryBase

This class represents the illumination geometry of the MSOT Acuity (Echo) photoacoustic device. The position is defined as the middle of the illumination slit.

Initializes the illumination source.

static deserialize(dictionary_to_deserialize)[source]
get_mcx_illuminator_definition(global_settings: Settings)[source]

IMPORTANT: This method creates a dictionary that contains tags as they are expected for the mcx simulation tool to represent the illumination geometry of this device.

Parameters:

global_settings (Settings) – The global_settings instance containing the simulation instructions.

Returns:

Dictionary that includes all parameters needed for mcx.

Return type:

dict

serialize() dict[source]
class MSOTInVisionIlluminationGeometry(invision_position=None)[source]

Bases: IlluminationGeometryBase

This class represents the illumination geometry of the MSOT InVision photoacoustic device.

Parameters:
  • device_position_mm (ndarray) – Each device has an internal position which serves as origin for internal representations of illuminator positions.

  • source_direction_vector (ndarray) – Direction of the illumination source.

  • field_of_view_extent_mm (ndarray) – Field of view which is defined as a numpy array of the shape [xs, xe, ys, ye, zs, ze], where x, y, and z denote the coordinate axes and s and e denote the start and end positions.

static deserialize(dictionary_to_deserialize)[source]
get_mcx_illuminator_definition(global_settings)[source]

IMPORTANT: This method creates a dictionary that contains tags as they are expected for the mcx simulation tool to represent the illumination geometry of this device.

Parameters:

global_settings (Settings) – The global_settings instance containing the simulation instructions.

Returns:

Dictionary that includes all parameters needed for mcx.

Return type:

dict

serialize() dict[source]
class PencilArrayIlluminationGeometry(pitch_mm=0.5, number_illuminators_x=100, number_illuminators_y=100, device_position_mm=None, field_of_view_extent_mm=None)[source]

Bases: IlluminationGeometryBase

This class represents a pencil array illumination geometry. The device position is defined as the middle of the array.

Parameters:
  • pitch_mm (float) – Defines the x and y distance between the illumination positions

  • number_illuminators_x (int) – Defines the number of illuminators in the x direction

  • number_illuminators_y (int) – Defines the number of illuminators in the y direction

  • device_position_mm (ndarray) – Each device has an internal position which serves as origin for internal representations of illuminator positions.

  • field_of_view_extent_mm (ndarray) – Field of view which is defined as a numpy array of the shape [xs, xe, ys, ye, zs, ze], where x, y, and z denote the coordinate axes and s and e denote the start and end positions.

static deserialize(dictionary_to_deserialize)[source]
get_mcx_illuminator_definition(global_settings) dict[source]

IMPORTANT: This method creates a dictionary that contains tags as they are expected for the mcx simulation tool to represent the illumination geometry of this device.

Parameters:

global_settings (Settings) – The global_settings instance containing the simulation instructions.

Returns:

Dictionary that includes all parameters needed for mcx.

Return type:

dict

serialize() dict[source]
class PencilBeamIlluminationGeometry(device_position_mm=None, source_direction_vector=None, field_of_view_extent_mm=None)[source]

Bases: IlluminationGeometryBase

This class represents a pencil beam illumination geometry. The device position is defined as the exact position of the pencil beam.

Parameters:
  • device_position_mm (ndarray) – Each device has an internal position which serves as origin for internal representations of illuminator positions.

  • source_direction_vector (ndarray) – Direction of the illumination source.

  • field_of_view_extent_mm (ndarray) – Field of view which is defined as a numpy array of the shape [xs, xe, ys, ye, zs, ze], where x, y, and z denote the coordinate axes and s and e denote the start and end positions.

static deserialize(dictionary_to_deserialize)[source]
get_mcx_illuminator_definition(global_settings) dict[source]

IMPORTANT: This method creates a dictionary that contains tags as they are expected for the mcx simulation tool to represent the illumination geometry of this device.

Parameters:

global_settings (Settings) – The global_settings instance containing the simulation instructions.

Returns:

Dictionary that includes all parameters needed for mcx.

Return type:

dict

serialize() dict[source]
class RectangleIlluminationGeometry(length_mm: int = 10, width_mm: int = 10, device_position_mm: Optional[ndarray] = None, source_direction_vector: Optional[ndarray] = None, field_of_view_extent_mm: Optional[ndarray] = None)[source]

Bases: IlluminationGeometryBase

Defines a rectangle illumination geometry. The device position is defined as the UPPER LEFT CORNER of the rectangle.

Note: To create a global light which illuminates the entire tissue evenly (= creating a planar illumination geometry), create the following geometry using the tissue length and width:

>>> global_light = RectangleIlluminationGeometry(length_mm=tissue_length_mm, width_mm=tissue_width_mm)
Parameters:
  • length_mm – The length of the rectangle in mm.

  • width_mm – The width of the rectangle in mm.

  • device_position_mm – The device position in mm, the UPPER LEFT CORNER of the rectangle.

If None, the position is defined as [0, 0, 0]. :param source_direction_vector: Direction of the illumination source. If None, the direction is defined as [0, 0, 1]. :param field_of_view_extent_mm: Field of view which is defined as a numpy array of the shape [xs, xe, ys, ye, zs, ze], where x, y, and z denote the coordinate axes and s and e denote the start and end positions.

static deserialize(dictionary_to_deserialize: dict) SerializableSIMPAClass[source]

Deserializes the provided dict into an object of this type. :param dictionary_to_deserialize: The dictionary to deserialize.

Returns:

The deserialized object from the dictionary.

get_mcx_illuminator_definition(global_settings: Settings) dict[source]

Returns the illumination parameters for MCX simulations.

Parameters:

global_settings – The global settings.

Returns:

The illumination parameters as a dictionary.

serialize() dict[source]

Serializes the object into a dictionary.

Returns:

The dictionary representing the serialized object.

class RingIlluminationGeometry(outer_radius_in_mm: float = 1, inner_radius_in_mm: float = 0, lower_angular_bound: float = 0, upper_angular_bound: float = 0, device_position_mm: Optional[ndarray] = None, source_direction_vector: Optional[ndarray] = None, field_of_view_extent_mm: Optional[ndarray] = None)[source]

Bases: IlluminationGeometryBase

Defines a ring illumination geometry. The device position is defined as the center of the ring.

Note: To create a ring light which illuminates a square tissue with the same center and any inner radius r, create the following geometry using the tissue width:

>>> ring_light = RingIlluminationGeometry(inner_radius_in_mm=r,
                                          outer_radius_in_mm=tissue_width / 2.,
                                          device_position_mm=np.array([tissue_width / 2., tissue_width / 2., 0]))
Parameters:
  • outer_radius_in_mm – The outer radius of the ring in mm.

  • inner_radius_in_mm – The inner radius of the ring in mm. If 0, should match the disk illumination.

  • lower_angular_bound – The lower angular bound in radians. If both bounds are 0, than no bound is applied.

Note that the bound of 0 starts from the x-axis on the right side and is applied clockwise. :param upper_angular_bound: The upper angular bound in radians. If both bounds are 0, than no bound is applied. Note that the bound is applied clockwise in relation to the lower bound. :param device_position_mm: The device position in mm, the center of the ring. If None, the position is defined as [0, 0, 0]. :param source_direction_vector: Direction of the illumination source. If None, the direction is defined as [0, 0, 1]. :param field_of_view_extent_mm: Field of view which is defined as a numpy array of the shape [xs, xe, ys, ye, zs, ze], where x, y, and z denote the coordinate axes and s and e denote the start and end positions.

static deserialize(dictionary_to_deserialize: dict) SerializableSIMPAClass[source]

Deserializes the provided dict into an object of this type. :param dictionary_to_deserialize: The dictionary to deserialize. :return: The deserialized object from the dictionary.

get_mcx_illuminator_definition(global_settings: Settings) dict[source]

Returns the illumination parameters for MCX simulations. :param global_settings: The global settings. :return: The illumination parameters as a dictionary.

serialize() dict[source]

Serializes the object into a dictionary. :return: The dictionary representing the serialized object.

class SlitIlluminationGeometry(slit_vector_mm=None, direction_vector_mm=None, device_position_mm=None, field_of_view_extent_mm=None)[source]

Bases: IlluminationGeometryBase

This class represents a slit illumination geometry. The device position is defined as the middle of the slit.

Parameters:
  • slit_vector_mm (list) – Defines the slit in vector form. For example a slit along the x-axis with length 5mm would be defined as [5, 0, 0].

  • direction_vector_mm (list) – Direction vector in which the slit illuminates. Defined analogous to the slit vector.

  • device_position_mm (ndarray) – Each device has an internal position which serves as origin for internal representations of illuminator positions.

  • field_of_view_extent_mm (ndarray) – Field of view which is defined as a numpy array of the shape [xs, xe, ys, ye, zs, ze], where x, y, and z denote the coordinate axes and s and e denote the start and end positions.

static deserialize(dictionary_to_deserialize)[source]
get_mcx_illuminator_definition(global_settings) dict[source]

IMPORTANT: This method creates a dictionary that contains tags as they are expected for the mcx simulation tool to represent the illumination geometry of this device.

Parameters:

global_settings (Settings) – The global_settings instance containing the simulation instructions.

Returns:

Dictionary that includes all parameters needed for mcx.

Return type:

dict

serialize() dict[source]