Skip to content

Commit

Permalink
STIR min/max-scale-factor in ScatterEstimation exposed. (#1271)
Browse files Browse the repository at this point in the history
* tackled #1270

* accepted reviewers' suggestions

* add doxygen [ci skip]

* updated CHANGES.md to prepare for merging PR #1271

---------

Co-authored-by: Kris Thielemans <KrisThielemans@users.noreply.github.com>
  • Loading branch information
evgueni-ovtchinnikov and KrisThielemans authored Jun 25, 2024
1 parent 81f5c0a commit 947bfef
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <packagename>_ROOT env variables
Expand Down
13 changes: 8 additions & 5 deletions src/xSTIR/cSTIR/cstir_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,25 +856,28 @@ sirf::cSTIR_setScatterEstimatorParameter
int value = dataFromHandle<int>(hv);
obj.set_num_iterations(value);
}

else if (sirf::iequals(name, "set_OSEM_num_subiterations"))
{
int value = dataFromHandle<int>(hv);
obj.set_OSEM_num_subiterations(value);
}

else if (sirf::iequals(name, "set_OSEM_num_subsets"))
{
int value = dataFromHandle<int>(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<float>(hv));
}
else if (sirf::iequals(name, "set_min_scale_value"))
{
obj.set_min_scale_value(dataFromHandle<float>(hv));
}
else
return parameterNotFound(name, __FILE__, __LINE__);

Expand Down
12 changes: 12 additions & 0 deletions src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<STIRAcquisitionData> get_scatter_estimate(int est_num = -1) const
{
if (est_num == -1) // Get the last one
Expand Down
8 changes: 8 additions & 0 deletions src/xSTIR/pSTIR/STIR.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 947bfef

Please sign in to comment.