Skip to content

Commit

Permalink
Merge pull request #1064 from KrisThielemans/TOF_mashing
Browse files Browse the repository at this point in the history
allow specifying TOF mashing for STIR
  • Loading branch information
KrisThielemans authored Sep 1, 2022
2 parents ed49f3e + 7bc486a commit 8705e26
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
* documentation
- revision of READMEs for the examples

* Require STIR 5.0

* sirf.STIR.AcquisitionData constructor taking a scanner now has an extra optional argument
tof_mash_factor (defaulting to 1). This is only functional if a STIR version supporting TOF is used.

## v3.3.0

* Added a new acquisition model `SPECTUBMatrix` for (simple) usage in SPECT.
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ if (DISABLE_STIR)
else()
find_package(STIR REQUIRED)
message(STATUS "STIR version found: ${STIR_VERSION}")
if (STIR_VERSION VERSION_LESS 4.1.0)
# Note: we support both version 4 and 5, so cannot put the version in the find_package statement
message(FATAL_ERROR "SIRF requires STIR version at least 4.1.0")
if (STIR_VERSION VERSION_LESS 5.0.0)
# Note: we support both version 5 and 6, so cannot put the version in the find_package statement
message(FATAL_ERROR "SIRF requires STIR version at least 5.0.0")
endif()
if (STIR_WITH_NiftyPET_PROJECTOR)
set(NiftyPET_BOOL_STR "1")
Expand Down
5 changes: 4 additions & 1 deletion src/xSTIR/cSTIR/cstir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,14 +780,17 @@ const int num_tof_bins_to_combine

extern "C"
void* cSTIR_acquisitionDataFromScannerInfo
(const char* scanner, int span, int max_ring_diff, int view_mash_factor)
(const char* scanner, int span, int max_ring_diff, int view_mash_factor, int tof_mash_factor)
{
try{
stir::shared_ptr<ExamInfo> sptr_ei(new ExamInfo());
sptr_ei->imaging_modality = ImagingModality::PT;
stir::shared_ptr<stir::ProjDataInfo> sptr_pdi =
PETAcquisitionData::proj_data_info_from_scanner
(scanner, span, max_ring_diff, view_mash_factor);
#if STIR_VERSION >= 050000
sptr_pdi->set_tof_mash_factor(tof_mash_factor);
#endif
PETAcquisitionDataInFile::init();
std::shared_ptr<PETAcquisitionData> sptr_t =
PETAcquisitionData::storage_template();
Expand Down
2 changes: 1 addition & 1 deletion src/xSTIR/cSTIR/include/sirf/STIR/cstir.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extern "C" {
const int num_tof_bins_to_combine
);
void* cSTIR_acquisitionDataFromScannerInfo
(const char* scanner, int span, int max_ring_diff, int view_mash_factor);
(const char* scanner, int span, int max_ring_diff, int view_mash_factor, int tof_mash_factor);
void* cSTIR_getAcquisitionDataDimensions(const void* ptr_acq, PTR_INT ptr_dim);
void* cSTIR_getAcquisitionData(const void* ptr_acq, PTR_FLOAT ptr_data);
void* cSTIR_setAcquisitionData(void* ptr_acq, PTR_FLOAT ptr_data);
Expand Down
9 changes: 6 additions & 3 deletions src/xSTIR/mSTIR/+sirf/+STIR/AcquisitionData.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ function set_storage_scheme(scheme)
end
methods
function self = AcquisitionData...
(arg, span, max_ring_diff, view_mash_factor)
(arg, span, max_ring_diff, view_mash_factor, tof_mash_factor)
%***SIRF*** AcquisitionData(arg) creates a new AcquisitionData object
% from a file or scanner or another AcquisitionData object;
% arg: file or scanner name or AcquisitionData object.
% if a scanner name is used, additional arguments can be
% given to specify the data size, e.g.:
% acq=AcquisitionData('Siemens_mMR',span,max_ring_diff,view_mash_factor);
% Defaults are:
% span=1, max_ring_diff=-1 (i.e. all), view_mash_factor=1
% span=1, max_ring_diff=-1 (i.e. all), view_mash_factor=1, tof_mash_factor=1
self.handle_ = [];
self.name = 'AcquisitionData';
self.read_only = false;
Expand All @@ -71,6 +71,9 @@ function set_storage_scheme(scheme)
elseif ischar(arg)
i = strfind(arg, '.');
if isempty(i)
if nargin < 5
tof_mash_factor = 1;
end
if nargin < 4
view_mash_factor = 1;
end
Expand All @@ -82,7 +85,7 @@ function set_storage_scheme(scheme)
end
self.handle_ = calllib...
('mstir', 'mSTIR_acquisitionDataFromScannerInfo',...
arg, span, max_ring_diff, view_mash_factor);
arg, span, max_ring_diff, view_mash_factor, tof_mash_factor);
status = calllib('miutilities', 'mExecutionStatus', ...
self.handle_);
if status ~= 0
Expand Down
4 changes: 2 additions & 2 deletions src/xSTIR/pSTIR/STIR.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ def set_resolution_model(self, collimator_sigma_0_in_mm, collimator_slope_in_mm,
class AcquisitionData(DataContainer):
"""Class for PET acquisition data."""

def __init__(self, src=None, span=1, max_ring_diff=-1, view_mash_factor=1):
def __init__(self, src=None, span=1, max_ring_diff=-1, view_mash_factor=1, tof_mash_factor=1):
"""Creates new AcquisitionData.
Can create object from a file or another AcquisitionData object.
Expand All @@ -893,7 +893,7 @@ def __init__(self, src=None, span=1, max_ring_diff=-1, view_mash_factor=1):
else:
# src is a scanner name
self.handle = pystir.cSTIR_acquisitionDataFromScannerInfo(
src, span, max_ring_diff, view_mash_factor)
src, span, max_ring_diff, view_mash_factor, tof_mash_factor)
if pyiutil.executionStatus(self.handle) != 0:
msg = pyiutil.executionError(self.handle)
if msg == 'Unknown scanner':
Expand Down

0 comments on commit 8705e26

Please sign in to comment.