cilissa.images - Image structures

Classes

class cilissa.images.Image(image: pathlib.Path | str | numpy.ndarray, name: str | None = None)[source]

np.ndarray wrapper, a core structure in CILISSA

as_data_uri()[source]
as_float()[source]

Converts the image to np.ndarray of floats

as_int()[source]

Converts the image to np.ndarray of ints

property channels_num[source]
check_if_on_image(x: int | None = None, y: int | None = None)[source]
convert_to_grayscale()[source]
copy()[source]

Copies and returns the image

crop(sl: Tuple[slice, slice])[source]
property dtype[source]
from_array(image_array: numpy.ndarray, at: Tuple[slice, slice] | None = None)[source]

Replaces the underlying image array with given np.ndarray

get_resized(width: int | None = None, height: int | None = None)[source]
get_scale_factor(width: int | None = None, height: int | None = None)[source]
property height[source]
im[source]
load(image_path: pathlib.Path | str)[source]

Loads the image from given path

Uses cv2.imdecode instead of cv2.imread to handle unicode characters in path

Parameters:

image_path (Path/str) – Path where the image is located.

name = [source]
path = [source]
save(save_path: pathlib.Path | str = '')[source]

Saves the image

Parameters:

save_path (Path/str) – Path to save the image at. Must contain the filename with extension. If empty string, then will save to the path the image was loaded from (if available)

show()[source]

Opens a CV2 window and displays the loaded image.

Exits when user presses ESCAPE or closes window manually.

property width[source]
class cilissa.images.ImagePair(im1: Image, im2: Image, roi: cilissa.roi.ROI | None = None, use_roi: bool = True)[source]

A pair of 2 cilissa.images.Image. Analysis is performed using this class.

If any of the attributes in the image pair are mismatched, the attribute of the reference image will be used if necessary.

as_floats()[source]

Returns a tuple with both images as np.ndarray of floats

clear_roi()[source]
copy()[source]
im1[source]

Reference image against which quality is measured

im2[source]

Image whose quality is to be measured

property matching_dtype[source]
property matching_shape[source]
roi[source]
set_roi(roi: cilissa.roi.ROI | None)[source]
swap()[source]

Swaps the reference and input images in place.

use_roi[source]
class cilissa.images.ImageCollection[source]

A collection of one or more cillisa.images.ImagePair.

Operations performed on cillisa.images.ImagePair can be applied to the whole collection.

set_use_roi(value: bool)[source]
use_roi = True[source]