From 52cf5e3109a08e3130715cd4c223fb55ee3c50c4 Mon Sep 17 00:00:00 2001 From: Evgueni Ovtchinnikov Date: Mon, 24 Jun 2024 12:29:58 +0000 Subject: [PATCH 1/4] tackled #1270 --- src/xSTIR/cSTIR/cstir_p.cpp | 13 ++++++++----- src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h | 10 ++++++++++ src/xSTIR/pSTIR/STIR.py | 8 ++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/xSTIR/cSTIR/cstir_p.cpp b/src/xSTIR/cSTIR/cstir_p.cpp index bb145db55..0ff11f9b3 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_factor_value(dataFromHandle(hv)); + } + else if (sirf::iequals(name, "set_min_scale_value")) + { + obj.set_min_scale_factor_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..98c83d8bd 100644 --- a/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h +++ b/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h @@ -947,6 +947,16 @@ The actual algorithm is described in return this->get_reconstruction_method().get_num_subsets(); } + void set_max_scale_factor_value(float v) + { + set_max_scale_value(v); + } + + void set_min_scale_factor_value(float v) + { + 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. From 004d968a9d02b102756b15aaa8a0f0c95d8e80f8 Mon Sep 17 00:00:00 2001 From: Evgueni Ovtchinnikov Date: Tue, 25 Jun 2024 12:13:13 +0000 Subject: [PATCH 2/4] accepted reviewers' suggestions --- src/xSTIR/cSTIR/cstir_p.cpp | 4 ++-- src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/xSTIR/cSTIR/cstir_p.cpp b/src/xSTIR/cSTIR/cstir_p.cpp index 0ff11f9b3..35b5cf2bb 100644 --- a/src/xSTIR/cSTIR/cstir_p.cpp +++ b/src/xSTIR/cSTIR/cstir_p.cpp @@ -872,11 +872,11 @@ sirf::cSTIR_setScatterEstimatorParameter } else if (sirf::iequals(name, "set_max_scale_value")) { - obj.set_max_scale_factor_value(dataFromHandle(hv)); + obj.set_max_scale_value(dataFromHandle(hv)); } else if (sirf::iequals(name, "set_min_scale_value")) { - obj.set_min_scale_factor_value(dataFromHandle(hv)); + 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 98c83d8bd..09560398b 100644 --- a/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h +++ b/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h @@ -947,14 +947,14 @@ The actual algorithm is described in return this->get_reconstruction_method().get_num_subsets(); } - void set_max_scale_factor_value(float v) + void set_max_scale_value(float v) { - set_max_scale_value(v); + stir::ScatterEstimation::set_max_scale_value(v); } - void set_min_scale_factor_value(float v) + void set_min_scale_value(float v) { - set_min_scale_value(v); + stir::ScatterEstimation::set_min_scale_value(v); } std::shared_ptr get_scatter_estimate(int est_num = -1) const From cfbbb79f98158a5a5f5d569edb36bcd63fb31450 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Tue, 25 Jun 2024 15:37:51 +0100 Subject: [PATCH 3/4] add doxygen [ci skip] --- src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h b/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h index 09560398b..649c5fd51 100644 --- a/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h +++ b/src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h @@ -947,11 +947,13 @@ 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); From 535a8ab839cd6420a79ccb3b084d2b4415c7d894 Mon Sep 17 00:00:00 2001 From: Evgueni Ovtchinnikov Date: Tue, 25 Jun 2024 14:41:26 +0000 Subject: [PATCH 4/4] updated CHANGES.md to prepare for merging PR #1271 --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) 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