Skip to content

Commit

Permalink
Merge pull request #1280 from KrisThielemans/exposeMaskMethodsForScatter
Browse files Browse the repository at this point in the history
expose mask functions for PET scatter estimation
  • Loading branch information
KrisThielemans authored Nov 22, 2024
2 parents a7d4e9d + f90ee5e commit fc20f13
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 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
- prior value returned as double
- ScatterEstimation has extra methods that allow setting masks for the tail-fitting

## v3.8.0

Expand Down
17 changes: 17 additions & 0 deletions src/xSTIR/cSTIR/cstir_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,23 @@ sirf::cSTIR_setScatterEstimatorParameter
SPTR_FROM_HANDLE(STIRImageData, sptr_id, hv);
obj.set_attenuation_image_sptr(sptr_id);
}
else if (sirf::iequals(name, "setMaskImage"))
{
SPTR_FROM_HANDLE(STIRImageData, sptr_id, hv);
obj.set_mask_image_sptr(sptr_id);
}
else if (sirf::iequals(name, "setMaskAcqData"))
{
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_pd, hv);
obj.set_mask_acq_data_sptr(sptr_pd);
}
#if STIR_VERSION >= 060200
else if (sirf::iequals(name, "setRecomputeMaskImage"))
{
bool value = dataFromHandle<bool>(hv);
obj.set_recompute_mask_image(value);
}
#endif
else if (sirf::iequals(name, "setAttenuationCorrectionFactors"))
{
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, hv);
Expand Down
14 changes: 14 additions & 0 deletions src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,20 @@ The actual algorithm is described in
stir::ScatterEstimation::set_attenuation_image_sptr(arg->data_sptr());
#endif
}
void set_mask_image_sptr(std::shared_ptr<const STIRImageData> arg)
{
stir::ScatterEstimation::set_mask_image_sptr(arg->data_sptr());
}
void set_mask_acq_data_sptr(std::shared_ptr<const STIRAcquisitionData> arg)
{
stir::ScatterEstimation::set_mask_proj_data_sptr(arg->data());
}
#if STIR_VERSION >= 060200
void set_recompute_mask_image(bool arg)
{
stir::ScatterEstimation::set_recompute_mask_image(arg);
}
#endif

//! Set prefix for filenames with scatter estimates.
/*!
Expand Down
9 changes: 9 additions & 0 deletions src/xSTIR/pSTIR/STIR.py
Original file line number Diff line number Diff line change
Expand Up @@ -3608,6 +3608,15 @@ def set_attenuation_correction_factors(self, arg):
assert_validity(arg, AcquisitionData)
parms.set_parameter(self.handle, self.name, 'setAttenuationCorrectionFactors', arg.handle)

def set_mask_image(self, image):
assert_validity(image, ImageData)
parms.set_parameter(self.handle, self.name, 'setMaskImage', image.handle)

def set_mask_acq_data(self, arg):
assert_validity(arg, AcquisitionData)
parms.set_parameter(self.handle, self.name, 'setMaskAcqData', arg.handle)


def set_input(self, acq_data):
assert_validity(acq_data, AcquisitionData)
parms.set_parameter(self.handle, self.name, 'setInput', acq_data.handle)
Expand Down

0 comments on commit fc20f13

Please sign in to comment.