From 9df73cf3ac3f22c50cacdda52a46a5ab6a9cd2d6 Mon Sep 17 00:00:00 2001 From: Jiao Lin Date: Thu, 4 Oct 2018 09:30:12 -0400 Subject: [PATCH] Refs #114. added a test for the new hack for autocrop --- tests/imars3d/test_autocrop.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/imars3d/test_autocrop.py b/tests/imars3d/test_autocrop.py index 0bc66434..59ede033 100755 --- a/tests/imars3d/test_autocrop.py +++ b/tests/imars3d/test_autocrop.py @@ -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 @@ -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 @@ -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), @@ -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 @@ -64,6 +76,7 @@ def main(): test2() test2a() test3() + test4() return