def test_image_loading(self): # order = c, z, t test_array = [[0, 0, 0], [0, 2, 0], [0, 2, 2], [1, 0, 0]] for i in test_array: c = str(i[0]) z = str(i[1]) t = str(i[2]) ref = Image.open("./tests/tiff/c" + c + "z" + z + "t" + t + ".tif") obj = LifFile("./tests/xyzt_test.lif").get_image(0) test = obj.get_frame(z=z, t=t, c=c) self.assertEqual(test.tobytes(), ref.tobytes())
def test_private_images_16bit(self): # These tests are for images that are not public. # These images will be pulled from a protected web address # during CI testing. if os.environ.get('READLIF_TEST_DL_PASSWD') is not None \ and os.environ.get('READLIF_TEST_DL_PASSWD') != "": downloadPrivateFile("16bit.lif") downloadPrivateFile("i1c0z2_16b.tif") # Note - readlif produces little endian files, # ImageJ makes big endian files for 16bit by default obj = LifFile("./tests/private/16bit.lif").get_image(1) self.assertEqual(obj.bit_depth[0], 12) ref = Image.open("./tests/private/i1c0z2_16b.tif") test = obj.get_frame(z=2, c=0) self.assertEqual(test.tobytes(), ref.tobytes()) else: print("\nSkipped private test for 16-bit images\n")
def test_private_images_mosaic(self): # These tests are for images that are not public. # These images will be pulled from a protected web address # during CI testing. if os.environ.get('READLIF_TEST_DL_PASSWD') is not None\ and os.environ.get('READLIF_TEST_DL_PASSWD') != "": downloadPrivateFile("tile_002.lif") downloadPrivateFile("i0c1m2z0.tif") obj = LifFile("./tests/private/tile_002.lif").get_image(0) self.assertEqual(obj.dims.m, 165) m_list = [i for i in obj.get_iter_m()] self.assertEqual(len(m_list), 165) ref = Image.open("./tests/private/i0c1m2z0.tif") test = obj.get_frame(c=1, m=2) self.assertEqual(test.tobytes(), ref.tobytes()) else: print("\nSkipped private test for mosaic images\n")