Skip to content

Commit

Permalink
Refs #114. added a test for the new hack for autocrop
Browse files Browse the repository at this point in the history
  • Loading branch information
yxqd committed Oct 4, 2018
1 parent 4908d8d commit 9df73cf
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tests/imars3d/test_autocrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test():
series = io.ImageFileSeries(os.path.join(dir, "normalized_%07.3f.*"), angles, decimal_mark_replacement='.')
assert np.allclose(
autocrop.calculateCropWindow(series),
(0, 2047, 30, 2047)
(0, 2047, 33, 2047)
)
return

Expand All @@ -24,9 +24,9 @@ def test2():
dir = os.path.abspath(dir)
angles = np.arange(0., 10, 0.85)
series = io.ImageFileSeries(os.path.join(dir, "20180704_Transmission_CT_%s_0080.*"), ['0010'])
# print autocrop.calculateCropWindow(series)
# print autocrop.calculateCropWindow(series, normalize=True)
assert np.allclose(
autocrop.calculateCropWindow(series),
autocrop.calculateCropWindow(series, normalize=True),
(627, 1442, 648, 1468)
)
return
Expand All @@ -40,6 +40,7 @@ def test2a():
[300.300],
decimal_mark_replacement='.',
)
# print autocrop.calculateCropWindow(series)
assert np.allclose(
autocrop.calculateCropWindow(series),
(767, 1309, 566, 1163),
Expand All @@ -54,7 +55,18 @@ def test3():
# print autocrop.calculateCropWindow(series)
assert np.allclose(
autocrop.calculateCropWindow(series),
(0, 2047, 1163, 2047)
(0, 2047, 1166, 2047)
)
return


def test4():
dir = os.path.join(here, "..", "iMars3D_data_set", "autocrop")
dir = os.path.abspath(dir)
series = io.ImageFileSeries(os.path.join(dir, "bright_stripe_bottom_left%s.tiff"), [''])
assert np.allclose(
autocrop.calculateCropWindow(series),
(689, 1318, 28, 2047)
)
return

Expand All @@ -64,6 +76,7 @@ def main():
test2()
test2a()
test3()
test4()
return


Expand Down

0 comments on commit 9df73cf

Please sign in to comment.