def __init__(self, slide_path: str): self.slide_path = slide_path reader = CziFile(slide_path) if not reader.is_mosaic(): raise NotImplementedError( 'This class has only been defined for mosaic czi files. ' 'You should be able to simply convert the non-mosaic czi-file ' 'into a format that can be opened with openslide.' ) self.bboxes = np.array(reader.mosaic_scene_bounding_boxes()) self.data_mask = self._get_data_mask(self.bboxes) self.shape = reader.read_mosaic_size() self.dimensions = self.shape[2:] self.region_mask = self._get_region_mask(self.shape)
def test_mosaic_subblock_rect(data_dir, fname, s_index, m_index, expected): with open(data_dir / fname, 'rb') as fp: czi = CziFile(czi_filename=fp) data = czi.mosaic_scene_bounding_boxes(s_index) assert data == expected