Images

class pumpia.image_handling.image_structures.BaseImageSet

Abstract base class for images that can be shown.

tag
Type:

str

id_string
Type:

str

menu_options
Type:

list[tuple[str, Callable[[], None]]]

class pumpia.image_handling.image_structures.ArrayImage(shape: tuple[int, int, int, int], num_samples: int = 1, mode: str | None = None)
class pumpia.image_handling.image_structures.ArrayImage(shape: tuple[int, int, int], num_samples: int = 1, mode: str | None = None)
class pumpia.image_handling.image_structures.ArrayImage(shape: tuple[int, int], num_samples: int = 1, mode: str | None = None)
class pumpia.image_handling.image_structures.ArrayImage(shape: tuple[int, ...], num_samples: int = 1, mode: str | None = None)

Represents an image based on an array. Has the same attributes and methods as BaseImageSet unless stated below.

Parameters:
  • shape (tuple[int, ...]) – The shape of the image.

  • num_samples (int) – Number of samples in the image, >1 for colour images, e.g. RGB is 3 (default is 1).

  • mode (str | None) – Mode of the image e.g. RGB (default is None)

x

The x location of the image on a Viewer.

Type:

float

y

The y location of the image on a Viewer.

Type:

float

zoom

The zoom level of the image on a Viewer.

Type:

float

rotation

The rotation of the image on a Viewer.

Type:

float

shape

The shape of the image.

Type:

tuple[int, …]

num_samples

Number of samples in the image, >1 for colour images (e.g. RGB is 3)

Type:

int

mode

Mode of the image for viewing e.g. RGB (see Pillow modes for more)

Type:

str | None

is_multisample
Type:

bool

is_rgb
Type:

bool

current_slice
Type:

int

location
Type:

tuple[float, float]

num_slices
Type:

int

array
Type:

np.ndarray

current_slice_array
Type:

np.ndarray

vmax
Type:

float | None

vmin
Type:

float | None

window
Type:

float | None

level
Type:

float | None

rois
Type:

set[‘BaseROI’]

roi_names
Type:

list[str]

user_window
Type:

float | None

user_level
Type:

float | None

pixel_size
Type:

tuple[float, float, float]

aspect
Type:

float

z_profile
Type:

np.ndarray

get_rois(slice_num: int | Literal['All'] | None = None) set['BaseROI']

Returns the set of ROIs in the image.

add_roi(roi: 'BaseROI', replace: bool = True)

Adds an ROI to the image.

remove_roi(roi: 'BaseROI')

Removes an ROI from the image.

change_slice(amount: int = 1) None

Changes the current slice by the given amount.

reset()

Resets the image properties to their default values.

class pumpia.image_handling.image_structures.FileImageSet(shape: tuple[int, int, int, int], filepath: Path, num_samples: int = 1, mode: str | None = None)
class pumpia.image_handling.image_structures.FileImageSet(shape: tuple[int, int, int], filepath: Path, num_samples: int = 1, mode: str | None = None)
class pumpia.image_handling.image_structures.FileImageSet(shape: tuple[int, int], filepath: Path, num_samples: int = 1, mode: str | None = None)

Represents an ArrayImage built from a file. Has the same attributes and methods as ArrayImage unless stated below.

Parameters:
  • shape (tuple[int, ...]) – The shape of the image.

  • filepath (Path) – The file path of the image.

  • num_samples (int) – Number of samples in the image (default is 1).

  • mode (str | None) – Mode of the image e.g. RGB (default is None)

filepath

The file path of the image.

Type:

Path

class pumpia.image_handling.image_structures.ImageCollection(shape: tuple[int, int, int, int], num_samples: int = 1, mode: str | None = None)
class pumpia.image_handling.image_structures.ImageCollection(shape: tuple[int, int, int], num_samples: int = 1, mode: str | None = None)
class pumpia.image_handling.image_structures.ImageCollection(shape: tuple[int, int], num_samples: int = 1, mode: str | None = None)

Represents a collection of ArrayImage objects. Has the same attributes and methods as ArrayImage unless stated below.

Parameters:
  • shape (tuple[int, ...]) – The shape of the image.

  • num_samples (int) – Number of samples in the image (default is 1).

  • mode (str | None) – Mode of the image e.g. RGB (default is None)

image_set

The list of images in the collection.

Type:

list[ArrayImage]

current_image

The current image object.

Type:

ArrayImage

add_image(image: ArrayImage)

Adds an image to the collection.