ImageBatch#

Methods

This are most important functions to be used for image classes

ImageBatch.project(coordinates[, crs_s, ...])

Calculate projection of 3d points into image.

ImageBatch.map_center_point([mapper, ...])

Map center point of image to 3d

ImageBatch.map_footprint([points_per_edge, ...])

Map footprint of images of batch to 3d

ImageBatch.add_images(images)

Add images to the batch.

class weitsicht.ImageBatch(images: dict[str, ImageBase], mapper: MappingBase | None = None)[source]#

Container for running operations on a set of named images.

Parameters:
__init__(images: dict[str, ImageBase], mapper: MappingBase | None = None)[source]#

Initialize an image batch.

Parameters:
  • images (dict[str, ImageBase]) – Dictionary of images.

  • mapper (MappingBase | None) – Optional default mapper assigned to images without a mapper, defaults to None.

add_images(images: dict[str, ImageBase])[source]#

Add images to the batch.

Parameters:

images (dict[str, ImageBase]) – Images to add.

Raises:

KeyError – If any keys already exist in the batch.

index(indices: int) ImageBase[source]#
index(indices: list[int] | tuple[int]) dict[str, ImageBase]

index get images by indices

Get the images by using indices. Will return the image at the indices of the image dict from ImageBatch.

Parameters:

indices (list[int] | tuple[int] | int) – The indices you want to get images for

Raises:
  • TypeError – Indices type not valid

  • IndexError – One of the indices is not valid

Returns:

return single image or dict of images for multiple indices

Return type:

ImageBase | dict[str, ImageBase]

map_center_point(mapper: MappingBase | None = None, transformer: CoordinateTransformer | None = None) dict[str, MappingResultSuccess | ResultFailure[Issue]][source]#

Map center point of image to 3d

Parameters:
  • mapper (MappingBase | None) – Specify Mapper to be used, can be different to the one assigned in the class

  • transformer (CoordinateTransformer | None) – A CoordinateTransfoer object which can be passed instead using crs_s

Returns:

MappingResult for all images

Raises:
Return type:

dict[str, MappingResultSuccess | ResultFailure[Issue]]

map_footprint(points_per_edge: int = 0, mapper: MappingBase | None = None, transformer: CoordinateTransformer | None = None) dict[str, MappingResultSuccess | ResultFailure[Issue]][source]#

Map footprint of images of batch to 3d

Parameters:
  • points_per_edge (int) – The number of points which should be inserted between corners. 0: only corner points are mapped

  • mapper (MappingBase | None) – Optional specify another Mapper to be used, can be different to the one assigned in the image class

  • transformer (CoordinateTransformer | None) – A CoordinateTransfoer object which can be passed instead using crs_s

Returns:

MappingResult for all images

Raises:
Return type:

dict[str, MappingResultSuccess | ResultFailure[Issue]]

project(coordinates: ndarray[tuple[Any, ...], dtype[_ScalarT]], crs_s: CRS | None = None, transformer: CoordinateTransformer | None = None, only_valid: bool = False) dict[str, ProjectionResultSuccess | ResultFailure[Issue]] | None[source]#

Calculate projection of 3d points into image. If points was outsize image size and to_distortion is true the undistorted projection will be returned

Parameters:
  • coordinates (ArrayNx3) – Array of (nx3) with the point positions

  • crs_s (CRS | None) – The coordinate system of the input coordinates

  • transformer (CoordinateTransformer | None) – A CoordinateTransfoer object which can be passed instead using crs_s

  • only_valid (bool) – If true only return images with valid projections.

Returns:

dict[ImageName, ProjectionResult] or None if for filtered (only_valid) no projections are valid

Raises:
Return type:

dict[str, ProjectionResultSuccess | ResultFailure[Issue]] | None