def test_twoDimensionalImages(self): image = np.ndarray([2, 2], dtype=np.uint8) image[0, 0] = 255 image[0, 1] = 0 image[1, 0] = 0 image[1, 1] = 255 self.writer.save(image) reader = DefaultReader(self.file) loaded_image = reader.data.T self.assertTrue(np.array_equal(image, loaded_image))
def test_threeDimensionalImages(self): image = np.zeros([1, 2, 2], dtype=np.uint8) image[0, 0, 0] = 255 image[0, 0, 1] = 0 image[0, 1, 0] = 0 image[0, 1, 1] = 255 self.writer.save(image) reader = DefaultReader(self.file) all_channels = reader.data.T channel_r = all_channels[0, :, :] channel_g = all_channels[1, :, :] channel_b = all_channels[2, :, :] self.assertTrue(np.array_equal(channel_r, channel_g) and np.array_equal(channel_g, channel_b) and np.array_equal(channel_r, image[0, :, :]))
def test_pngSaveImageComparison(self): self.writer.save_slice(self.image.astype("uint8"), z=1, c=2, t=3) reader = DefaultReader(self.file) output_image = reader.data.T self.assertTrue(np.array_equal(self.image, output_image))
def test_pngSaveComparison(self): self.writer.save(self.image.astype('uint8')) reader = DefaultReader(self.file) output_image = reader.data.T self.assertTrue(np.array_equal(self.image, output_image))