From 947bfef50dd06e2f83bc32a94159a4924ab2eb98 Mon Sep 17 00:00:00 2001 From: Evgueni Ovtchinnikov Date: Tue, 25 Jun 2024 15:44:38 +0100 Subject: [PATCH] STIR min/max-scale-factor in ScatterEstimation exposed. (#1271) * tackled #1270 * accepted reviewers' suggestions * add doxygen [ci skip] * updated CHANGES.md to prepare for merging PR #1271 --------- Co-authored-by: Kris Thielemans --- CHANGES.md | 1 + src/xSTIR/cSTIR/cstir_p.cpp | 13 ++++++++----- src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h | 12 ++++++++++++ src/xSTIR/pSTIR/STIR.py | 8 ++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4d864ac47..b3b5da469 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ * SIRF/STIR (PET and SPECT) - use direct STIR operations for arrays, potentially resulting in speed-up when using STIR 6.2 or later. + - added means for setting maximal and minimal value for scale factor in stir::ScatterEstimation * CMake/building: - set CMP0074 policy to NEW, i.e. honour _ROOT env variables diff --git a/src/xSTIR/cSTIR/cstir_p.cpp b/src/xSTIR/cSTIR/cstir_p.cpp index bb145db55..35b5cf2bb 100644 --- a/src/xSTIR/cSTIR/cstir_p.cpp +++ b/src/xSTIR/cSTIR/cstir_p.cpp @@ -856,25 +856,28 @@ sirf::cSTIR_setScatterEstimatorParameter int value = dataFromHandle(hv); obj.set_num_iterations(value); } - else if (sirf::iequals(name, "set_OSEM_num_subiterations")) { int value = dataFromHandle(hv); obj.set_OSEM_num_subiterations(value); } - else if (sirf::iequals(name, "set_OSEM_num_subsets")) { int value = dataFromHandle(hv); obj.set_OSEM_num_subsets(value); } - - - else if (sirf::iequals(name, "set_output_prefix")) { obj.set_output_prefix(charDataFromHandle(hv)); } + else if (sirf::iequals(name, "set_max_scale_value")) + { + obj.set_max_scale_value(dataFromHandle(hv)); + } + else if (sirf::iequals(name, "set_min_scale_value")) + { + obj.set_min_scale_value(dataFromHandle(hv)); + } else return parameterNotFound(name, __FILE__, __LINE__); diff --git a/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h b/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h index 227d1d5e2..649c5fd51 100644 --- a/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h +++ b/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h @@ -947,6 +947,18 @@ The actual algorithm is described in return this->get_reconstruction_method().get_num_subsets(); } + //! Set maximal scale factor value of the SSS algorithm to use + void set_max_scale_value(float v) + { + stir::ScatterEstimation::set_max_scale_value(v); + } + + //! Set minimal scale factor value of the SSS algorithm to use + void set_min_scale_value(float v) + { + stir::ScatterEstimation::set_min_scale_value(v); + } + std::shared_ptr get_scatter_estimate(int est_num = -1) const { if (est_num == -1) // Get the last one diff --git a/src/xSTIR/pSTIR/STIR.py b/src/xSTIR/pSTIR/STIR.py index 89e8ef8c5..5fddaa42d 100644 --- a/src/xSTIR/pSTIR/STIR.py +++ b/src/xSTIR/pSTIR/STIR.py @@ -3614,6 +3614,14 @@ def set_num_iterations(self, v): """Set number of iterations of the SSS algorithm to use.""" parms.set_int_par(self.handle, 'PETScatterEstimator', 'set_num_iterations', v) + def set_max_scale_value(self, v): + """Set maximal scale factor value of the SSS algorithm to use.""" + parms.set_float_par(self.handle, 'PETScatterEstimator', 'set_max_scale_value', v) + + def set_min_scale_value(self, v): + """Set maximal scale factor value of the SSS algorithm to use.""" + parms.set_float_par(self.handle, 'PETScatterEstimator', 'set_min_scale_value', v) + def set_output_prefix(self, v): """ Set prefix for filenames with scatter estimates.