cilissa.images - Image structures


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

np.ndarray wrapper, a core structure in CILISSA


Converts the image to np.ndarray of floats


Converts the image to np.ndarray of ints


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


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

save(self, save_path: Union[pathlib.Path, str] = '')[source]

Saves the image


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)


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.


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


Reference image against which quality is measured


Image whose quality is to be measured


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.