示例#1
0
文件: tests.py 项目: zwdai/PLEASE
 def test_16bitTiff(self):
     """Test LF.read_img() with 16bit TIFF."""
     dtype = self.dtypes[1]
     self.createImage(dtype, self.imtypes[0])
     files = glob.glob(os.path.join(self.test_data_path, "*.tif"))
     for fl in files:
         im = LF.read_img(os.path.join(self.test_data_path, fl))
         # NOTE: This should fail since read_img() uses .convert('L') which downscales to 8-bit
         self.assertTrue(im.dtype == dtype)
示例#2
0
文件: tests.py 项目: zwdai/PLEASE
    def test_8bit_images(self):
        """Test LF.read_img with 8bit images."""
        dtype = self.dtypes[0]
        for imtype in self.imtypes:
            self.createImage(dtype, imtype)

        files = glob.glob(os.path.join(self.test_data_path, "*.*"))
        for fl in files:
            im = LF.read_img(os.path.join(self.test_data_path, fl))
            self.assertTrue(im.dtype == dtype)
示例#3
0
文件: tests.py 项目: zwdai/PLEASE
    def test_read_images(self):
        """Use LF.read_img to read the images created by createImage()."""
        files = glob.glob(os.path.join(self.test_data_path, "*.*"))
        for fl in files:
            im = LF.read_img(os.path.join(self.test_data_path, fl))

            tmp = fl.split("_")
            dtype_from_image_name = None
            for typ in self.dtype_strings:
                if typ in tmp:
                    dtype_from_image_name = typ
            if not dtype_from_image_name:
                print("Error reading image dtype from file name")
                break
            idx = self.dtype_strings.index(dtype_from_image_name)
            dtype = self.dtypes[idx]
            print("Testing dtype from image {}".format(fl))
            print("\t" + str(im.dtype))
            print("\t" + str(dtype_from_image_name))
            self.assertTrue(im.dtype == dtype)