Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change prefix from PETAcquisitionData to STIRAcquisitionData. #1146

Merged
merged 4 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Added support for spiral trajectories that are pre-computed by the user by exposing a setter.
- Writing MR images to `.dcm` files quick-fixed. For proper fix, help from Gadgetron team will be sought after moving to using Gadgetron 4.
- Use C++ 17 if Gadgetron-support is enabled
- Renamed PETAcquisitionData and derived classes to STIRAcquisitionData* as STIR now supports SPECT in addition to PET modality. Backward compatibility ensured by defining old nomenclature via typedefs until the release of SIRF 4.

* Documentation
- revision of READMEs for the examples
Expand Down
80 changes: 40 additions & 40 deletions src/xSTIR/cSTIR/cstir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,11 @@ void* cSTIR_objectFromFile(const char* name, const char* filename)
}
if (sirf::iequals(name, "AcquisitionData")) {

std::shared_ptr<PETAcquisitionData> sptr;
if (PETAcquisitionData::storage_scheme().compare("file") == 0)
sptr.reset(new PETAcquisitionDataInFile(filename));
std::shared_ptr<STIRAcquisitionData> sptr;
if (STIRAcquisitionData::storage_scheme().compare("file") == 0)
sptr.reset(new STIRAcquisitionDataInFile(filename));
else
sptr.reset(new PETAcquisitionDataInMemory(filename));
sptr.reset(new STIRAcquisitionDataInMemory(filename));
return newObjectHandle(sptr);
}
if (sirf::iequals(name, "ListmodeToSinograms")) {
Expand Down Expand Up @@ -415,7 +415,7 @@ void* cSTIR_scatterSimulatorFwdReplace
try {
auto& am = objectFromHandle<PETSingleScatterSimulator>(ptr_am);
auto& id = objectFromHandle<STIRImageData>(ptr_im);
auto& ad = objectFromHandle<PETAcquisitionData>(ptr_ad);
auto& ad = objectFromHandle<STIRAcquisitionData>(ptr_ad);
am.forward(ad, id);
return new DataHandle;
}
Expand All @@ -429,7 +429,7 @@ void* cSTIR_setupScatterSimulator
try {
auto& am = objectFromHandle<PETSingleScatterSimulator>(ptr_am);
SPTR_FROM_HANDLE(STIRImageData, id, ptr_im);
SPTR_FROM_HANDLE(PETAcquisitionData, ad, ptr_ad);
SPTR_FROM_HANDLE(STIRAcquisitionData, ad, ptr_ad);
am.set_up(ad, id);
return new DataHandle;
}
Expand Down Expand Up @@ -521,7 +521,7 @@ void* cSTIR_createPETAcquisitionSensitivityModel
try {
shared_ptr<PETAcquisitionSensitivityModel> sptr;
if (sirf::iequals(src, "s")) {
PETAcquisitionData& ad = objectFromHandle<PETAcquisitionData>(ptr_src);
STIRAcquisitionData& ad = objectFromHandle<STIRAcquisitionData>(ptr_src);
sptr.reset(new PETAcquisitionSensitivityModel(ad));
}
else if (sirf::iequals(src, "n")) {
Expand Down Expand Up @@ -568,7 +568,7 @@ void* cSTIR_setupAcquisitionSensitivityModel(void* ptr_sm, void* ptr_ad)
try {
PETAcquisitionSensitivityModel& sm =
objectFromHandle<PETAcquisitionSensitivityModel>(ptr_sm);
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_ad);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_ad);
sm.set_up(sptr_ad->get_exam_info_sptr(),
sptr_ad->get_proj_data_info_sptr()->create_shared_clone());
return (void*) new DataHandle;
Expand All @@ -583,7 +583,7 @@ void* cSTIR_applyAcquisitionSensitivityModel
try {
PETAcquisitionSensitivityModel& sm =
objectFromHandle<PETAcquisitionSensitivityModel>(ptr_sm);
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_ad);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_ad);

if (sirf::iequals(job, "fwd"))
return newObjectHandle(sm.forward(*sptr_ad));
Expand All @@ -606,7 +606,7 @@ void* cSTIR_setupAcquisitionModel(void* ptr_am, void* ptr_dt, void* ptr_im)
try {
//writeText("setting up acquisition model\n");
AcqMod3DF& am = objectFromHandle<AcqMod3DF>(ptr_am);
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_dt, ptr_dt);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_dt, ptr_dt);
SPTR_FROM_HANDLE(STIRImageData, sptr_id, ptr_im);
am.set_up(sptr_dt, sptr_id);
return (void*) new DataHandle;
Expand Down Expand Up @@ -653,7 +653,7 @@ void* cSTIR_acquisitionModelFwdReplace
try {
AcqMod3DF& am = objectFromHandle<AcqMod3DF>(ptr_am);
STIRImageData& id = objectFromHandle<STIRImageData>(ptr_im);
PETAcquisitionData& ad = objectFromHandle<PETAcquisitionData>(ptr_ad);
STIRAcquisitionData& ad = objectFromHandle<STIRAcquisitionData>(ptr_ad);
am.forward(ad, id, subset_num, num_subsets, num_subsets > 1);
return new DataHandle;
}
Expand All @@ -666,7 +666,7 @@ void* cSTIR_acquisitionModelBwd(void* ptr_am, void* ptr_ad,
{
try {
AcqMod3DF& am = objectFromHandle<AcqMod3DF>(ptr_am);
PETAcquisitionData& ad = objectFromHandle<PETAcquisitionData>(ptr_ad);
STIRAcquisitionData& ad = objectFromHandle<STIRAcquisitionData>(ptr_ad);
return newObjectHandle(am.backward(ad, subset_num, num_subsets));
}
CATCH;
Expand All @@ -691,7 +691,7 @@ void* cSTIR_acquisitionModelBwdReplace(void* ptr_am, void* ptr_ad,
{
try {
AcqMod3DF& am = objectFromHandle<AcqMod3DF>(ptr_am);
PETAcquisitionData& ad = objectFromHandle<PETAcquisitionData>(ptr_ad);
STIRAcquisitionData& ad = objectFromHandle<STIRAcquisitionData>(ptr_ad);
STIRImageData& id = objectFromHandle<STIRImageData>(ptr_im);
am.backward(id, ad, subset_num, num_subsets);
return new DataHandle;
Expand All @@ -716,9 +716,9 @@ cSTIR_setAcquisitionDataStorageScheme(const char* scheme)
{
try {
if (scheme[0] == 'f' || strcmp(scheme, "default") == 0)
PETAcquisitionDataInFile::set_as_template();
STIRAcquisitionDataInFile::set_as_template();
else
PETAcquisitionDataInMemory::set_as_template();
STIRAcquisitionDataInMemory::set_as_template();
return (void*)new DataHandle;
}
CATCH;
Expand All @@ -729,15 +729,15 @@ void*
cSTIR_getAcquisitionDataStorageScheme()
{
return charDataHandleFromCharData
(PETAcquisitionData::storage_scheme().c_str());
(STIRAcquisitionData::storage_scheme().c_str());
}

extern "C"
void* cSTIR_acquisitionDataFromTemplate(void* ptr_t)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_t, ptr_t);
std::shared_ptr<PETAcquisitionData> sptr(sptr_t->new_acquisition_data());
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_t, ptr_t);
std::shared_ptr<STIRAcquisitionData> sptr(sptr_t->new_acquisition_data());
return newObjectHandle(sptr);
}
CATCH;
Expand All @@ -747,8 +747,8 @@ extern "C"
void* cSTIR_cloneAcquisitionData(void* ptr_ad)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_ad);
std::shared_ptr<PETAcquisitionData> sptr(sptr_ad->clone());
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_ad);
std::shared_ptr<STIRAcquisitionData> sptr(sptr_ad->clone());
return newObjectHandle(sptr);
}
CATCH;
Expand All @@ -765,8 +765,8 @@ const int num_tof_bins_to_combine
)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_t, ptr_t);
std::shared_ptr<PETAcquisitionData> sptr =
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_t, ptr_t);
std::shared_ptr<STIRAcquisitionData> sptr =
sptr_t->single_slice_rebinned_data(
num_segments_to_combine,
num_views_to_combine,
Expand All @@ -788,15 +788,15 @@ void* cSTIR_acquisitionDataFromScannerInfo
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
STIRAcquisitionData::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();
std::shared_ptr<PETAcquisitionData> sptr(sptr_t->same_acquisition_data
STIRAcquisitionDataInFile::init();
std::shared_ptr<STIRAcquisitionData> sptr_t =
STIRAcquisitionData::storage_template();
std::shared_ptr<STIRAcquisitionData> sptr(sptr_t->same_acquisition_data
(sptr_ei, sptr_pdi));
sptr->fill(0.0f);
return newObjectHandle(sptr);
Expand All @@ -809,7 +809,7 @@ void* cSTIR_getAcquisitionDataDimensions(const void* ptr_acq, size_t ptr_dim)
{
try {
int* dim = (int*)ptr_dim;
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_acq);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_acq);
dim[0] = sptr_ad->get_num_tangential_poss();
dim[1] = sptr_ad->get_num_views();
dim[2] = sptr_ad->get_num_non_TOF_sinograms();
Expand All @@ -824,7 +824,7 @@ void* cSTIR_getAcquisitionData(const void* ptr_acq, size_t ptr_data)
{
try {
float* data = (float*)ptr_data;
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_acq);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_acq);
if (sptr_ad->is_empty())
return DataHandle::error_handle(
"Failed to get acquisition data: dealing with empty template?",
Expand All @@ -839,7 +839,7 @@ extern "C"
void* cSTIR_fillAcquisitionData(void* ptr_acq, float v)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_acq);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_acq);
sptr_ad->fill(v);
return (void*)new DataHandle;
}
Expand All @@ -851,8 +851,8 @@ void* cSTIR_fillAcquisitionDataFromAcquisitionData
(void* ptr_acq, const void* ptr_from)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_acq);
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_from, ptr_from);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_acq);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_from, ptr_from);
sptr_ad->fill(*sptr_from);
return (void*)new DataHandle;
}
Expand All @@ -863,7 +863,7 @@ extern "C"
void* cSTIR_setAcquisitionData(void* ptr_acq, size_t ptr_data)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_acq);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_acq);
float *data = (float *)ptr_data;
sptr_ad->fill_from(data);
return (void*)new DataHandle;
Expand All @@ -875,7 +875,7 @@ extern "C"
void* cSTIR_writeAcquisitionData(void* ptr_acq, const char* filename)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_acq);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_acq);
sptr_ad->write(filename);
return (void*)new DataHandle;
}
Expand All @@ -886,7 +886,7 @@ extern "C"
void* cSTIR_get_ProjDataInfo(void* ptr_acq)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_acq);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_acq);
return charDataHandleFromCharData(
sptr_ad->get_proj_data_info_sptr()->parameter_info().c_str());
}
Expand All @@ -897,10 +897,10 @@ extern "C"
void* cSTIR_get_subset(void* ptr_acq, int nv, size_t ptr_views)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_acq);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_acq);
int* ptr_v = (int*)ptr_views;
std::vector<int> v(ptr_v, ptr_v + nv);
std::shared_ptr<PETAcquisitionData> sptr = std::move(sptr_ad->get_subset(v));
std::shared_ptr<STIRAcquisitionData> sptr = std::move(sptr_ad->get_subset(v));
return newObjectHandle(sptr);
}
CATCH;
Expand Down Expand Up @@ -1248,7 +1248,7 @@ void* cSTIR_ImageData_move_to_scanner_centre(void* im_ptr, const void* acq_data_
{
try {
STIRImageData& im = objectFromHandle<STIRImageData>(im_ptr);
PETAcquisitionData& ad = objectFromHandle<PETAcquisitionData>(acq_data_ptr);
STIRAcquisitionData& ad = objectFromHandle<STIRAcquisitionData>(acq_data_ptr);
im.move_to_scanner_centre(ad);

return static_cast<void*>(new DataHandle);
Expand All @@ -1261,7 +1261,7 @@ extern "C"
void* cSTIR_imageFromAcquisitionData(void* ptr_ad)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_ad);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_ad);
shared_ptr<STIRImageData> sptr(new STIRImageData(*sptr_ad));
return newObjectHandle(sptr);
}
Expand All @@ -1272,7 +1272,7 @@ extern "C"
void* cSTIR_imageFromAcquisitionDataAndNxNy(void* ptr_ad, int nx, int ny)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_ad);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, ptr_ad);
STIRImageData id(*sptr_ad);
int dim[3];
float vs[3];
Expand Down
20 changes: 10 additions & 10 deletions src/xSTIR/cSTIR/cstir_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ wrongFloatParameterValue
void*
sirf::cSTIR_AcquisitionDataParameter(void* hp, const char* name)
{
PETAcquisitionData& ad = objectFromHandle<PETAcquisitionData>(hp);
STIRAcquisitionData& ad = objectFromHandle<STIRAcquisitionData>(hp);
if (sirf::iequals(name, "tof_mash_factor"))
return dataHandle<int>(ad.get_tof_mash_factor());
else
Expand Down Expand Up @@ -136,7 +136,7 @@ sirf::cSTIR_setListmodeToSinogramsParameter(void* hp, const char* name, const vo
else if (sirf::iequals(name, "template_file"))
lm2s.set_template(charDataFromHandle(hv));
else if (sirf::iequals(name, "template"))
lm2s.set_template(objectFromHandle<PETAcquisitionData>(hv));
lm2s.set_template(objectFromHandle<STIRAcquisitionData>(hv));
else
return parameterNotFound(name, __FILE__, __LINE__);
return new DataHandle;
Expand Down Expand Up @@ -360,11 +360,11 @@ sirf::cSTIR_setAcquisitionModelParameter
{
AcqMod3DF& am = objectFromHandle< AcqMod3DF >(hp);
if (sirf::iequals(name, "additive_term")) {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, hv);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, hv);
am.set_additive_term(sptr_ad);
}
else if (sirf::iequals(name, "background_term")) {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, hv);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, hv);
am.set_background_term(sptr_ad);
}
else if (sirf::iequals(name, "asm")) {
Expand Down Expand Up @@ -565,12 +565,12 @@ sirf::cSTIR_setScatterEstimatorParameter

if (sirf::iequals(name, "setInput"))
{
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_pd, hv);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_pd, hv);
obj.set_input_sptr(sptr_pd);
}
else if (sirf::iequals(name, "setRandoms"))
{
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_pd, hv);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_pd, hv);
obj.set_background_sptr(sptr_pd);
}
else if (sirf::iequals(name, "setAttenuationImage"))
Expand All @@ -580,7 +580,7 @@ sirf::cSTIR_setScatterEstimatorParameter
}
else if (sirf::iequals(name, "setAttenuationCorrectionFactors"))
{
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, hv);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, hv);
obj.set_attenuation_correction_factors_sptr(sptr_ad);
}
else if (sirf::iequals(name, "setASM"))
Expand Down Expand Up @@ -679,7 +679,7 @@ sirf::cSTIR_setPoissonLogLikelihoodWithLinearModelForMeanAndProjDataParameter
//else if (sirf::iequals(name, "max_segment_num_to_process"))
// obj_fun.set_max_segment_num_toa_process(dataFromHandle<int>((void*)hv));
else if (sirf::iequals(name, "acquisition_data")) {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, hv);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, hv);
obj_fun.set_acquisition_data(sptr_ad);
}
else if (sirf::iequals(name, "acquisition_model")) {
Expand Down Expand Up @@ -715,7 +715,7 @@ sirf::cSTIR_setReconstructionParameter
if (sirf::iequals(name, "output_filename_prefix"))
recon.set_output_filename_prefix(charDataFromDataHandle(hv));
else if (sirf::iequals(name, "input_data")) {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, hv);
SPTR_FROM_HANDLE(STIRAcquisitionData, sptr_ad, hv);
recon.set_input_data(sptr_ad->data());
}
else if (sirf::iequals(name, "disable_output")) {
Expand Down Expand Up @@ -890,7 +890,7 @@ sirf::cSTIR_setFBP2DParameter(DataHandle* hp, const char* name, const DataHandle
xSTIR_FBP2DReconstruction& recon =
objectFromHandle<xSTIR_FBP2DReconstruction >(hp);
if (sirf::iequals(name, "input")) {
PETAcquisitionData& acq_data = objectFromHandle<PETAcquisitionData>(hv);
STIRAcquisitionData& acq_data = objectFromHandle<STIRAcquisitionData>(hv);
recon.set_input(acq_data);
}
else if (sirf::iequals(name, "zoom")) {
Expand Down
Loading