def test_process(self): """Processed image series""" is_a = make_array_ims() is_p = process.ProcessedImageSeries(is_a, []) diff = compare(is_a, is_p) msg = "processed image series failed to reproduce original" self.assertAlmostEqual(diff, 0., msg)
def _runfliptest(self, a, flip, aflip): is_a = imageseries.open(None, 'array', data=a) ops = [('flip', flip)] is_p = process.ProcessedImageSeries(is_a, ops) is_aflip = imageseries.open(None, 'array', data=aflip) diff = compare(is_aflip, is_p) msg = "flipped [%s] image series failed" % flip self.assertAlmostEqual(diff, 0., msg=msg)
def test_process_shape(self): a = make_array() is_a = imageseries.open(None, 'array', data=a) ops = [] is_p = process.ProcessedImageSeries(is_a, ops) pshape = is_p.shape fshape = is_p[0].shape for i in range(2): self.assertEqual(fshape[i], pshape[i])
def test_process_framelist(self): a = make_array() is_a = imageseries.open(None, 'array', data=a) ops = [] frames = [0, 2] is_p = process.ProcessedImageSeries(is_a, ops, frame_list=frames) is_a2 = imageseries.open(None, 'array', data=a[tuple(frames), ...]) diff = compare(is_a2, is_p) self.assertAlmostEqual(diff, 0., msg="frame list failed")
def test_process_dark(self): """Processed image series: dark image""" a = make_array() dark = np.ones_like(a[0]) is_a = imageseries.open(None, 'array', data=a) apos = np.where(a >= 1, a - 1, 0) is_a1 = imageseries.open(None, 'array', data=apos) ops = [('dark', dark)] is_p = process.ProcessedImageSeries(is_a, ops) diff = compare(is_a1, is_p) self.assertAlmostEqual(diff, 0., msg="dark image failed")
def test_process_dtype(self): a = make_array() is_a = imageseries.open(None, 'array', data=a) ops = [] is_p = process.ProcessedImageSeries(is_a, ops) self.assertEqual(is_p.dtype, is_p[0].dtype)