Exemple #1
0
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.tmpdir = tempfile.mkdtemp()
        self.exp = ExporterTIFF(compress=9)

        self.datafile = _create_datafile()
Exemple #2
0
class TestExporterTIFF(unittest.TestCase):

    def setUp(self):
        unittest.TestCase.setUp(self)

        self.tmpdir = tempfile.mkdtemp()
        self.exp = ExporterTIFF(compress=9)

        self.datafile = _create_datafile()

    def tearDown(self):
        unittest.TestCase.tearDown(self)
        shutil.rmtree(self.tmpdir, ignore_errors=True)

    def testexport(self):
        self.exp.export(self.datafile, self.tmpdir)
        filepaths = self.exp.get()

        self.assertEqual(len(filepaths), len(_SUPPORTED_DTYPES))

        for filepath in filepaths:
            with tifffile.TiffFile(filepath) as tif:
                actual = tif.asarray()

            identifier = os.path.splitext(os.path.basename(filepath))[0].split('_')[1]
            expected = self.datafile.data[identifier]

            np.testing.assert_almost_equal(actual, expected.T, 4)
Exemple #3
0
class TestExporterTIFF(unittest.TestCase):
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.tmpdir = tempfile.mkdtemp()
        self.exp = ExporterTIFF(compress=9)

        self.datafile = _create_datafile()

    def tearDown(self):
        unittest.TestCase.tearDown(self)
        shutil.rmtree(self.tmpdir, ignore_errors=True)

    def testexport(self):
        self.exp.export(self.datafile, self.tmpdir)
        filepaths = self.exp.get()

        self.assertEqual(len(filepaths), len(_SUPPORTED_DTYPES))

        for filepath in filepaths:
            with tifffile.TiffFile(filepath) as tif:
                actual = tif.asarray()

            identifier = os.path.splitext(
                os.path.basename(filepath))[0].split('_')[1]
            expected = self.datafile.data[identifier]

            np.testing.assert_almost_equal(actual, expected.T, 4)
Exemple #4
0
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.tmpdir = tempfile.mkdtemp()
        self.exp = ExporterTIFF(compress=9)

        self.datafile = _create_datafile()