diff --git a/CHANGES.md b/CHANGES.md index 7ab1b7dec..4b36c713d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f72dbe79..e40540321 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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") diff --git a/src/xSTIR/cSTIR/cstir.cpp b/src/xSTIR/cSTIR/cstir.cpp index 30d7a3979..70c35ca94 100644 --- a/src/xSTIR/cSTIR/cstir.cpp +++ b/src/xSTIR/cSTIR/cstir.cpp @@ -780,7 +780,7 @@ 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 sptr_ei(new ExamInfo()); @@ -788,6 +788,9 @@ void* cSTIR_acquisitionDataFromScannerInfo stir::shared_ptr 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 sptr_t = PETAcquisitionData::storage_template(); diff --git a/src/xSTIR/cSTIR/include/sirf/STIR/cstir.h b/src/xSTIR/cSTIR/include/sirf/STIR/cstir.h index 68d30ebcd..931e26380 100644 --- a/src/xSTIR/cSTIR/include/sirf/STIR/cstir.h +++ b/src/xSTIR/cSTIR/include/sirf/STIR/cstir.h @@ -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); diff --git a/src/xSTIR/mSTIR/+sirf/+STIR/AcquisitionData.m b/src/xSTIR/mSTIR/+sirf/+STIR/AcquisitionData.m index f44396748..32eb4b7b0 100644 --- a/src/xSTIR/mSTIR/+sirf/+STIR/AcquisitionData.m +++ b/src/xSTIR/mSTIR/+sirf/+STIR/AcquisitionData.m @@ -54,7 +54,7 @@ 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. @@ -62,7 +62,7 @@ function set_storage_scheme(scheme) % 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; @@ -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 @@ -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 diff --git a/src/xSTIR/pSTIR/STIR.py b/src/xSTIR/pSTIR/STIR.py index bdc326888..7d9b78364 100644 --- a/src/xSTIR/pSTIR/STIR.py +++ b/src/xSTIR/pSTIR/STIR.py @@ -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. @@ -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':