cilissa.images - Image structures

Classes

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

np.ndarray wrapper, a core structure in CILISSA

as_float(self)[source]

Converts the image to np.ndarray of floats

as_int(self)[source]

Converts the image to np.ndarray of ints

copy(self)[source]

Copies and returns the image

from_array(self, image_array: numpy.ndarray, at: Optional[Tuple[slice, slice]] = None)[source]

Replaces the underlying image array with given np.ndarray

load(self, image_path: Union[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.

save(self, save_path: Union[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(self)[source]

Opens a CV2 window and displays the loaded image.

Exits when user presses ESCAPE or closes window manually.

class cilissa.images.ImagePair(im1: Image, im2: Image, roi: Optional[cilissa.roi.ROI] = 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(self)[source]

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

im1[source]

Reference image against which quality is measured

im2[source]

Image whose quality is to be measured

swap(self)[source]

Swaps the reference and input images in place.

class cilissa.images.ImageCollection(items: List[Any] = [])[source]

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

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