From b81326291c6061d57fa332a248cb9d15d9f957eb Mon Sep 17 00:00:00 2001 From: Gemma Fardell <47746591+gfardell@users.noreply.github.com> Date: Fri, 18 Jun 2021 18:14:48 +0100 Subject: [PATCH] Centre of rotation finder More points evaluated (#911) --- Wrappers/Python/cil/processors/CofR_image_sharpness.py | 7 ++++--- Wrappers/Python/test/test_DataProcessor.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Wrappers/Python/cil/processors/CofR_image_sharpness.py b/Wrappers/Python/cil/processors/CofR_image_sharpness.py index 7abe0d3e57..6b432c8a24 100644 --- a/Wrappers/Python/cil/processors/CofR_image_sharpness.py +++ b/Wrappers/Python/cil/processors/CofR_image_sharpness.py @@ -206,7 +206,7 @@ def process(self, out=None): self.search_range = width //4 if self.initial_binning is None: - self.initial_binning = int(np.ceil(width / 128)) + self.initial_binning = min(int(np.ceil(width / 128)),16) logger.debug("Initial search:") logger.debug("search range is %d", self.search_range) @@ -242,8 +242,9 @@ def process(self, out=None): ig = data_processed.geometry.get_ImageGeometry() #binned grid search - vox_rad = self.search_range //self.initial_binning - offsets = np.linspace(-vox_rad, vox_rad, int(2*vox_rad + 1)) * ig.voxel_size_x + vox_rad = np.ceil(self.search_range /self.initial_binning) + steps = int(4*vox_rad + 1) + offsets = np.linspace(-vox_rad, vox_rad, steps) * ig.voxel_size_x obj_vals = [] for offset in offsets: diff --git a/Wrappers/Python/test/test_DataProcessor.py b/Wrappers/Python/test/test_DataProcessor.py index 0f882f12f6..cb4b16ee51 100755 --- a/Wrappers/Python/test/test_DataProcessor.py +++ b/Wrappers/Python/test/test_DataProcessor.py @@ -758,7 +758,7 @@ def test_CofR_image_sharpness_astra(self): corr = CofR_image_sharpness(search_range=20, FBP=AstraFBP) corr.set_input(self.data_DLS.clone()) ad_out = corr.get_output() - self.assertAlmostEqual(6.33, ad_out.geometry.config.system.rotation_axis.position[0],places=1) + self.assertAlmostEqual(6.48, ad_out.geometry.config.system.rotation_axis.position[0],places=1) @unittest.skipUnless(False, "TIGRE not installed")