22 #ifndef EXTRA_STIR_TYPES
23 #define EXTRA_STIR_TYPES
25 #define WIN32_LEAN_AND_MEAN
40 #include "sirf/common/JacobiCG.h"
42 #include "stir/recon_buildblock/PoissonLogLikelihoodWithLinearModelForMeanAndProjData.h"
43 #include "stir/recon_buildblock/PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h"
45 #define MIN_BIN_EFFICIENCY 1.0e-20f
47 #define SIRF_DYNAMIC_CAST(T, X, Y) T& X = dynamic_cast<T&>(Y)
102 store_prompts =
true;
103 store_delayeds =
false;
104 delayed_increment = 0;
106 display_interval = 1;
111 void set_input(
const STIRListmodeData& lm_data_v)
113 input_filename =
"UNKNOWN";
115 this->set_input_data(lm_data_v.data());
116 exam_info_sptr_.reset(
new ExamInfo(lm_data_ptr->get_exam_info()));
117 proj_data_info_sptr_.reset(lm_data_ptr->get_proj_data_info_sptr()->clone());
119 void set_input(std::string lm_file)
121 this->set_input(STIRListmodeData(lm_file));
122 this->input_filename = lm_file;
129 output_filename_prefix = proj_data_file;
131 void set_template(std::string proj_data_file)
134 set_template(acq_data_template);
136 void set_template(
const STIRAcquisitionData& acq_data_template)
138 template_proj_data_info_ptr =
139 acq_data_template.get_proj_data_info_sptr()->create_shared_clone();
141 void set_time_interval(
double start,
double stop)
143 std::pair<double, double> interval(start, stop);
144 std::vector < std::pair<double, double> > intervals;
145 intervals.push_back(interval);
146 frame_defs = stir::TimeFrameDefinitions(intervals);
147 do_time_frame =
true;
149 int set_flag(
const char* flag,
bool value)
152 store_prompts = value;
154 store_delayeds = value;
157 do_pre_normalisation = value;
159 do_time_frame = value;
167 bool get_store_prompts()
const
169 return store_prompts;
171 bool get_store_delayeds()
const
173 return store_delayeds;
175 virtual stir::Succeeded set_up()
177 if (LmToProjData::set_up() == Succeeded::no)
178 THROW(
"LmToProjData setup failed");
180 #if STIR_VERSION < 060000
181 const auto max_fan_size =
182 lm_data_ptr->get_scanner_ptr()->get_max_num_non_arccorrected_bins();
184 const auto max_fan_size =
185 lm_data_ptr->get_scanner().get_max_num_non_arccorrected_bins();
188 fan_size = max_fan_size;
191 std::min(fan_size, max_fan_size);
192 half_fan_size = fan_size / 2;
193 fan_size = 2 * half_fan_size + 1;
195 exam_info_sptr_->set_time_frame_definitions(frame_defs);
196 const float h = proj_data_info_sptr_->get_bed_position_horizontal();
197 const float v = proj_data_info_sptr_->get_bed_position_vertical();
198 stir::shared_ptr<ProjDataInfo> temp_proj_data_info_sptr(template_proj_data_info_ptr->clone());
199 temp_proj_data_info_sptr->set_bed_position_horizontal(h);
200 temp_proj_data_info_sptr->set_bed_position_vertical(v);
201 randoms_sptr.reset(
new STIRAcquisitionDataInMemory(exam_info_sptr_, temp_proj_data_info_sptr));
203 return stir::Succeeded::yes;
205 int estimate_randoms();
208 std::string filename = output_filename_prefix +
"_randoms" +
"_f1g1d0b0.hs";
209 randoms_sptr->write(filename.c_str());
211 std::shared_ptr<STIRAcquisitionData> get_output()
213 std::string filename = output_filename_prefix +
"_f1g1d0b0.hs";
214 return std::shared_ptr<STIRAcquisitionData>
215 (
new STIRAcquisitionDataInFile(filename.c_str()));
217 std::shared_ptr<STIRAcquisitionData> get_randoms_sptr()
229 int max_ring_diff_for_fansums;
231 int display_interval;
234 stir::shared_ptr<ExamInfo> exam_info_sptr_;
235 stir::shared_ptr<ProjDataInfo> proj_data_info_sptr_;
236 stir::shared_ptr<std::vector<stir::Array<2, float> > > fan_sums_sptr;
237 stir::shared_ptr<stir::DetectorEfficiencies> det_eff_sptr;
238 std::shared_ptr<STIRAcquisitionData> randoms_sptr;
239 void compute_fan_sums_(
bool prompt_fansum =
false);
240 int compute_singles_();
242 static unsigned long compute_num_bins_(
const int num_rings,
243 const int num_detectors_per_ring,
244 const int max_ring_diff,
const int half_fan_size);
264 norm_.reset(
new stir::ChainedBinNormalisation(mod1.data(), mod2.data()));
267 void set_up(
const stir::shared_ptr<const stir::ExamInfo>& exam_info_sptr,
268 const stir::shared_ptr<stir::ProjDataInfo>&);
277 std::shared_ptr<STIRAcquisitionData> sptr_ad = ad.new_acquisition_data();
279 this->unnormalise(*sptr_ad);
285 std::shared_ptr<STIRAcquisitionData> sptr_ad = ad.new_acquisition_data();
287 this->normalise(*sptr_ad);
291 stir::shared_ptr<stir::BinNormalisation> data()
298 stir::shared_ptr<stir::BinNormalisation> norm_;
368 void set_subset(
int sub_num)
372 void set_num_subsets(
int num_sub)
376 virtual std::shared_ptr<STIRImageData> apply(
const STIRImageData& image_data)
378 std::shared_ptr<STIRAcquisitionData> sptr_fwd =
379 sptr_am_->forward(image_data, sub_num_, num_sub_);
380 std::shared_ptr<STIRImageData> sptr_bwd =
381 sptr_am_->backward(*sptr_fwd, sub_num_, num_sub_);
385 std::shared_ptr<const PETAcquisitionModel> sptr_am_;
398 float norm(
int subset_num = 0,
int num_subsets = 1,
int num_iter = 2,
int verb = 0)
const
401 bf.set_subset(subset_num);
402 bf.set_num_subsets(num_subsets);
404 jcg.set_num_iterations(num_iter);
406 image_data.fill(1.0);
407 float lmd = jcg.largest(bf, image_data, verb);
408 return std::sqrt(lmd);
411 void set_projectors(stir::shared_ptr<stir::ProjectorByBinPair> sptr_projectors)
413 sptr_projectors_ = sptr_projectors;
415 const stir::shared_ptr<stir::ProjectorByBinPair> projectors_sptr()
const
417 return sptr_projectors_;
419 void set_additive_term(std::shared_ptr<STIRAcquisitionData> sptr)
423 std::shared_ptr<const STIRAcquisitionData> additive_term_sptr()
const
427 void set_background_term(std::shared_ptr<STIRAcquisitionData> sptr)
429 sptr_background_ = sptr;
431 std::shared_ptr<const STIRAcquisitionData> background_term_sptr()
const
433 return sptr_background_;
435 std::shared_ptr<const STIRAcquisitionData> acq_template_sptr()
const
437 return sptr_acq_template_;
439 std::shared_ptr<const STIRImageData> image_template_sptr()
const
441 return sptr_image_template_;
447 const stir::shared_ptr<stir::BinNormalisation> normalisation_sptr()
const
450 return sptr_asm_->data();
451 stir::shared_ptr<stir::BinNormalisation> sptr;
460 void set_asm(std::shared_ptr<PETAcquisitionSensitivityModel> sptr_asm)
463 sptr_asm_ = sptr_asm;
465 stir::shared_ptr<PETAcquisitionSensitivityModel> asm_sptr()
const
474 void cancel_background_term()
476 sptr_background_.reset();
478 void cancel_additive_term()
482 void cancel_normalisation()
487 std::shared_ptr<const PETAcquisitionModel> linear_acq_mod_sptr()
const
489 std::shared_ptr<PETAcquisitionModel> sptr_am(
new PETAcquisitionModel);
490 sptr_am->set_projectors(sptr_projectors_);
491 sptr_am->set_asm(sptr_asm_);
492 sptr_am->sptr_acq_template_ = sptr_acq_template_;
493 sptr_am->sptr_image_template_ = sptr_image_template_;
498 std::shared_ptr<STIRAcquisitionData> sptr_acq,
499 std::shared_ptr<STIRImageData> sptr_image);
504 std::shared_ptr<STIRAcquisitionData>
505 forward(
const STIRImageData& image,
506 int subset_num = 0,
int num_subsets = 1,
bool do_linear_only =
false)
const;
517 void forward(STIRAcquisitionData& acq_data,
const STIRImageData& image,
518 int subset_num,
int num_subsets,
bool zero =
false,
bool do_linear_only =
false)
const;
521 std::shared_ptr<STIRImageData> backward(
const STIRAcquisitionData& ad,
522 int subset_num = 0,
int num_subsets = 1)
const;
524 void backward(STIRImageData& image,
const STIRAcquisitionData& ad,
525 int subset_num = 0,
int num_subsets = 1)
const;
528 stir::shared_ptr<stir::ProjectorByBinPair> sptr_projectors_;
529 std::shared_ptr<STIRAcquisitionData> sptr_acq_template_;
530 std::shared_ptr<STIRImageData> sptr_image_template_;
531 std::shared_ptr<STIRAcquisitionData> sptr_add_;
532 std::shared_ptr<STIRAcquisitionData> sptr_background_;
533 std::shared_ptr<PETAcquisitionSensitivityModel> sptr_asm_;
557 stir::SingleScatterSimulation(filename)
560 void set_up(std::shared_ptr<const STIRAcquisitionData> sptr_acq_template,
561 std::shared_ptr<const STIRImageData> sptr_act_image_template)
563 this->sptr_acq_template_ = sptr_acq_template;
565 stir::SingleScatterSimulation::set_template_proj_data_info(
566 *sptr_acq_template_->get_proj_data_info_sptr());
567 stir::SingleScatterSimulation::set_exam_info(
568 *sptr_acq_template_->get_exam_info_sptr());
572 auto& tmp = stir::SingleScatterSimulation::get_attenuation_image();
576 THROW(
"Fatal error in PETSingleScatterSimulator::set_up: attenuation_image has not been set");
578 this->set_activity_image_sptr(sptr_act_image_template);
580 if (stir::SingleScatterSimulation::set_up() == Succeeded::no)
581 THROW(
"Fatal error in PETSingleScatterSimulator::set_up() failed.");
584 void set_activity_image_sptr(std::shared_ptr<const STIRImageData> arg)
586 #if STIR_VERSION < 050000
588 stir::shared_ptr<Image3DF> sptr_image_copy(arg->data_sptr()->clone());
589 stir::SingleScatterSimulation::set_activity_image_sptr(sptr_image_copy);
591 stir::SingleScatterSimulation::set_activity_image_sptr(arg->data_sptr());
595 void set_attenuation_image_sptr(std::shared_ptr<const STIRImageData> arg)
597 #if STIR_VERSION < 050000
599 stir::shared_ptr<Image3DF> sptr_image_copy(arg->data_sptr()->clone());
600 stir::SingleScatterSimulation::set_density_image_sptr(sptr_image_copy);
602 stir::SingleScatterSimulation::set_density_image_sptr(arg->data_sptr());
606 std::shared_ptr<STIRAcquisitionData> forward(
const STIRImageData& activity_img)
608 if (!sptr_acq_template_.get())
609 THROW(
"Fatal error in PETSingleScatterSimulator::forward: acquisition template not set");
610 std::shared_ptr<STIRAcquisitionData> sptr_ad =
611 sptr_acq_template_->new_acquisition_data();
612 this->forward( *sptr_ad, activity_img);
616 void forward(STIRAcquisitionData& ad,
const STIRImageData& activity_img)
618 stir::shared_ptr<ProjData> sptr_fd = ad.data();
619 this->set_output_proj_data_sptr(sptr_fd);
621 this->process_data();
625 std::shared_ptr<const STIRAcquisitionData> sptr_acq_template_;
643 using recon_type = stir::OSMAPOSLReconstruction<DiscretisedDensity<3,float>>;
653 auto obj_sptr = std::make_shared<PoissonLogLikelihoodWithLinearModelForMeanAndProjData<DiscretisedDensity<3,float>>>();
654 auto recon_sptr = std::make_shared<recon_type>();
655 recon_sptr->set_num_subiterations(8);
656 recon_sptr->set_num_subsets(7);
657 recon_sptr->set_disable_output(
true);
658 recon_sptr->set_objective_function_sptr(obj_sptr);
659 stir::shared_ptr<stir::SeparableGaussianImageFilter<float> >
660 filter_sptr(
new stir::SeparableGaussianImageFilter<float>);
661 filter_sptr->set_fwhms(stir::make_coordinate(15.F,15.F,15.F));
662 recon_sptr->set_post_processor_sptr(filter_sptr);
663 stir::ScatterEstimation::set_reconstruction_method_sptr(recon_sptr);
667 stir::ScatterEstimation(filename)
673 stir::ScatterEstimation::set_input_proj_data_sptr(arg->data());
678 stir::ScatterEstimation::set_attenuation_correction_proj_data_sptr(arg->data());
681 void set_asm(std::shared_ptr<PETAcquisitionSensitivityModel> arg)
683 stir::ScatterEstimation::set_normalisation_sptr(arg->data());
688 stir::ScatterEstimation::set_background_proj_data_sptr(arg->data());
691 void set_attenuation_image_sptr(std::shared_ptr<const STIRImageData> arg)
693 #if STIR_VERSION < 050000
695 stir::shared_ptr<Image3DF> sptr_image_copy(arg->data_sptr()->clone());
696 stir::ScatterEstimation::set_attenuation_image_sptr(sptr_image_copy);
698 stir::ScatterEstimation::set_attenuation_image_sptr(arg->data_sptr());
711 stir::ScatterEstimation::set_export_scatter_estimates_of_each_iteration(!prefix.empty());
712 stir::ScatterEstimation::set_output_scatter_estimate_prefix(prefix);
715 void set_num_iterations(
int arg)
717 stir::ScatterEstimation::set_num_iterations(arg);
720 int get_num_iterations()
const
722 return stir::ScatterEstimation::get_num_iterations();
725 void set_OSEM_num_subiterations(
int arg)
727 this->get_reconstruction_method().set_num_subiterations(arg);
730 int get_OSEM_num_subiterations()
const
732 return this->get_reconstruction_method().get_num_subiterations();
735 void set_OSEM_num_subsets(
int arg)
737 this->get_reconstruction_method().set_num_subsets(arg);
738 this->_already_set_up_sirf =
false;
741 int get_OSEM_num_subsets()
const
743 return this->get_reconstruction_method().get_num_subsets();
746 std::shared_ptr<STIRAcquisitionData> get_scatter_estimate(
int est_num = -1)
const
749 est_num = num_scatter_iterations;
750 if (est_num == num_scatter_iterations)
753 if (output_scatter_estimate_prefix.empty())
754 THROW(
"output_scatter_estimate_prefix not set, so scatter estimates were not saved to file.");
755 const std::string filename = output_scatter_estimate_prefix +
"_" + std::to_string(est_num) +
".hs";
756 return std::make_shared<STIRAcquisitionDataInFile>(filename.c_str());
762 auto stir_proj_data_sptr = stir::ScatterEstimation::get_output();
763 if (!stir_proj_data_sptr)
764 THROW(
"output not yet computed");
765 std::shared_ptr<STIRAcquisitionData> sptr_acq_data
766 (STIRAcquisitionData::storage_template()->same_acquisition_data(stir_proj_data_sptr->get_exam_info_sptr(),
767 stir_proj_data_sptr->get_proj_data_info_sptr()->create_shared_clone()));
768 sptr_acq_data->data()->fill(*stir_proj_data_sptr);
769 return sptr_acq_data;
782 const float zoom = 0.2F;
783 stir::shared_ptr<Voxels3DF>
784 image_sptr(
new Voxels3DF(MAKE_SHARED<stir::ExamInfo>(*this->get_input_data()->get_exam_info_sptr()),
785 *this->get_input_data()->get_proj_data_info_sptr(),
787 image_sptr->fill(1.F);
788 stir::ScatterEstimation::set_initial_activity_image_sptr(image_sptr);
789 if (stir::ScatterEstimation::set_up() == Succeeded::no)
790 THROW(
"scatter estimation set_up failed");
791 this->_already_set_up_sirf =
true;
792 return Succeeded::yes;
796 if (!this->_already_set_up_sirf)
797 THROW(
"scatter estimation needs to be set-up first");
798 if (!stir::ScatterEstimation::already_setup())
799 THROW(
"scatter estimation needs to be set-up first");
800 if (stir::ScatterEstimation::process_data() == Succeeded::no)
801 THROW(
"scatter estimation failed");
805 bool _already_set_up_sirf;
808 recon_type& get_reconstruction_method()
const
810 return dynamic_cast<recon_type&
>(*this->reconstruction_template_sptr);
832 this->sptr_projectors_.reset(
new ProjectorPairUsingMatrix);
834 void set_matrix(stir::shared_ptr<stir::ProjMatrixByBin> sptr_matrix)
836 sptr_matrix_ = sptr_matrix;
837 ((ProjectorPairUsingMatrix*)this->sptr_projectors_.get())->
838 set_proj_matrix_sptr(sptr_matrix);
840 stir::shared_ptr<stir::ProjMatrixByBin> matrix_sptr()
847 std::shared_ptr<STIRAcquisitionData> sptr_acq,
848 std::shared_ptr<STIRImageData> sptr_image)
850 if (!sptr_matrix_.get())
851 THROW(
"PETAcquisitionModelUsingMatrix setup failed - matrix not set");
852 PETAcquisitionModel::set_up(sptr_acq, sptr_image);
858 sptr_matrix_->enable_cache(v);
862 stir::shared_ptr<stir::ProjMatrixByBin> sptr_matrix_;
871 stir::shared_ptr<RayTracingMatrix> matrix_sptr(
new RayTracingMatrix);
872 matrix_sptr->set_num_tangential_LORs(num_LORs);
873 set_matrix(matrix_sptr);
875 void set_num_tangential_LORs(
int num_LORs)
878 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
880 matrix.set_num_tangential_LORs(num_LORs);
886 auto matrix =
dynamic_cast<const RayTracingMatrix&
>(*matrix_sptr());
887 return matrix.get_num_tangential_LORs();
892 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
893 matrix.set_restrict_to_cylindrical_FOV(v);
898 void set_do_symmetry_90degrees_min_phi(
bool v =
true)
900 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
901 matrix.set_do_symmetry_90degrees_min_phi(v);
904 void set_do_symmetry_180degrees_min_phi(
bool v =
true)
906 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
907 matrix.set_do_symmetry_180degrees_min_phi(v);
910 void set_do_symmetry_swap_segment(
bool v =
true)
912 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
913 matrix.set_do_symmetry_swap_segment(v);
916 void set_do_symmetry_swap_s(
bool v =
true)
918 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
919 matrix.set_do_symmetry_swap_s(v);
922 void set_do_symmetry_shift_z(
bool v =
true)
924 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
925 matrix.set_do_symmetry_shift_z(v);
929 typedef PETAcquisitionModel AcqMod3DF;
930 typedef PETAcquisitionModelUsingMatrix AcqModUsingMatrix3DF;
931 typedef std::shared_ptr<AcqMod3DF> sptrAcqMod3DF;
933 #ifdef STIR_WITH_NiftyPET_PROJECTOR
939 class PETAcquisitionModelUsingNiftyPET :
public PETAcquisitionModel {
941 PETAcquisitionModelUsingNiftyPET()
943 _NiftyPET_projector_pair_sptr.reset(
new ProjectorPairUsingNiftyPET);
944 this->sptr_projectors_ = _NiftyPET_projector_pair_sptr;
946 _NiftyPET_projector_pair_sptr->set_verbosity(0);
948 void set_cuda_verbosity(
const bool verbosity)
const
950 _NiftyPET_projector_pair_sptr->set_verbosity(verbosity);
952 void set_use_truncation(
const bool use_truncation)
const
954 _NiftyPET_projector_pair_sptr->set_use_truncation(use_truncation);
957 stir::shared_ptr<stir::ProjectorPairUsingNiftyPET> _NiftyPET_projector_pair_sptr;
959 typedef PETAcquisitionModelUsingNiftyPET AcqModUsingNiftyPET3DF;
962 #ifdef STIR_WITH_Parallelproj_PROJECTOR
968 class PETAcquisitionModelUsingParallelproj :
public PETAcquisitionModel {
970 PETAcquisitionModelUsingParallelproj()
972 this->sptr_projectors_.reset(
new ProjectorByBinPairUsingParallelproj);
975 typedef PETAcquisitionModelUsingParallelproj AcqModUsingParallelproj;
992 stir::shared_ptr<stir::ForwardProjectorByBin> sptr_forw_projector_;
1006 void set_length_x(
float v)
1010 void set_length_y(
float v)
1014 void set_length_z(
float v)
1018 float get_length_x()
const
1022 float get_length_y()
const
1026 float get_length_z()
const
1034 void multiply_with_Hessian(Image3DF& output,
const Image3DF& curr_image_est,
1035 const Image3DF& input)
const
1038 accumulate_Hessian_times_input(output, curr_image_est, input);
1047 void only2D(
int only) {
1048 only_2D = only != 0;
1054 void only2D(
int only) {
1055 only_2D = only != 0;
1061 void only2D(
int only) {
1062 only_2D = only != 0;
1068 void only2D(
int only) {
1069 only_2D = only != 0;
1074 public stir::GeneralisedObjectiveFunction < Image3DF > {
1076 void multiply_with_Hessian(Image3DF& output,
const Image3DF& curr_image_est,
1077 const Image3DF& input,
const int subset)
const
1081 accumulate_sub_Hessian_times_input(output, curr_image_est, input, subset);
1083 for (
int s = 0; s < get_num_subsets(); s++) {
1084 accumulate_sub_Hessian_times_input(output, curr_image_est, input, s);
1097 public stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData < Image3DF > {
1099 void set_input_file(
const char* filename) {
1100 input_filename = filename;
1102 void set_acquisition_data(std::shared_ptr<STIRAcquisitionData> sptr)
1105 set_proj_data_sptr(sptr->data());
1107 void set_acquisition_model(std::shared_ptr<AcqMod3DF> sptr_am);
1109 std::shared_ptr<AcqMod3DF> acquisition_model_sptr()
1114 std::shared_ptr<STIRAcquisitionData> sptr_ad_;
1115 std::shared_ptr<AcqMod3DF> sptr_am_;
1122 public stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin<Image3DF> {
1126 void set_acquisition_data(std::shared_ptr<PETAcquisitionData> sptr)
1129 set_proj_data_info(*sptr->data());
1132 void set_acquisition_model(std::shared_ptr<AcqMod3DF> sptr_am);
1134 void set_cache_path(
const std::string filepath)
1136 stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin<Image3DF>::
1137 set_cache_path(filepath);
1140 void set_time_interval(
double start,
double stop)
1142 std::pair<double, double> interval(start, stop);
1143 std::vector < std::pair<double, double> > intervals;
1144 intervals.push_back(interval);
1145 frame_defs = stir::TimeFrameDefinitions(intervals);
1146 do_time_frame =
true;
1151 std::shared_ptr<PETAcquisitionModelUsingMatrix> sptr_am_;
1157 public stir::IterativeReconstruction < Image3DF > {
1165 void update(Image3DF &image) {
1166 update_estimate(image);
1167 end_of_iteration_processing(image);
1174 void update(stir::shared_ptr<STIRImageData> sptr_id)
1178 int& subiteration() {
1179 return subiteration_num;
1181 int subiteration()
const {
1182 return subiteration_num;
1184 void set_initial_estimate_file(
const char* filename) {
1185 initial_data_filename = filename;
1191 int& subiteration() {
1192 return subiteration_num;
1194 int subiteration()
const {
1195 return subiteration_num;
1201 void compute_kernelised_image_x(
1202 Image3DF& kernelised_image_out,
1203 const Image3DF& image_to_kernelise,
1204 const Image3DF& current_alpha_estimate)
1206 compute_kernelised_image(
1207 kernelised_image_out,
1209 current_alpha_estimate);
1215 float& relaxation_parameter_value() {
1216 return relaxation_parameter;
1218 float& relaxation_gamma_value() {
1219 return relaxation_gamma;
1221 double& upper_bound_value() {
1234 set_input_data(acq.data());
1236 void set_zoom(
float v)
1241 void set_alpha_ramp(
double alpha)
1245 if (!(alpha > 0 && alpha <= 1.0))
1247 (
"wrong ramp filter parameter alpha", __FILE__, __LINE__);
1250 void set_frequency_cut_off(
double fc)
1252 if (!(fc > 0 && fc <= 0.5))
1254 (
"wrong frequency cut-off", __FILE__, __LINE__);
1257 void set_up(std::shared_ptr<STIRImageData> sptr_id)
1260 stir::Succeeded s = stir::Reconstruction<Image3DF>::set_up(_sptr_image_data->data_sptr());
1261 if (s != stir::Succeeded::yes)
1262 THROW(
"stir::Reconstruction setup failed");
1271 stir::Succeeded s = stir::Succeeded::no;
1273 stir::shared_ptr<Image3DF> sptr_image(construct_target_image_ptr());
1275 stir::Reconstruction<Image3DF>::set_up(sptr_image);
1276 s = reconstruct(sptr_image);
1279 s = reconstruct(_sptr_image_data->data_sptr());
1280 if (s != stir::Succeeded::yes)
1281 THROW(
"stir::AnalyticReconstruction::reconstruct failed");
1283 std::shared_ptr<STIRImageData> get_output()
1285 return _sptr_image_data;
1289 std::shared_ptr<STIRImageData> _sptr_image_data;
1293 public stir::SeparableGaussianImageFilter<float> {
1303 void set_fwhms_xyz(
char xyz,
float f)
1305 stir::BasicCoordinate<3, float> v = get_fwhms();
1318 void set_max_kernel_sizes_xyz(
char xyz,
int s)
1320 stir::BasicCoordinate<3, int> v = get_max_kernel_sizes();
1331 set_max_kernel_sizes(v);
Definition: LocalisedException.h:32
Definition: JacobiCG.h:37
Listmode-to-sinograms converter.
Definition: stir_x.h:84
void set_output(std::string proj_data_file)
Specifies the prefix for the output file(s),.
Definition: stir_x.h:127
float get_time_at_which_num_prompts_exceeds_threshold(const unsigned long threshold) const
Definition: stir_x.cpp:53
ListmodeToSinograms(const char *par)
Constructor.
Definition: stir_x.h:97
Class for the product of backward and forward projectors of a PET acquisition model.
Definition: stir_x.h:365
Class for a PET acquisition model.
Definition: stir_x.h:356
void set_image_data_processor(stir::shared_ptr< ImageDataProcessor > sptr_processor)
sets data processor to use on the image before forward projection and after back projection
Definition: stir_x.cpp:510
std::shared_ptr< STIRAcquisitionData > forward(const STIRImageData &image, int subset_num=0, int num_subsets=1, bool do_linear_only=false) const
computes and returns a subset of forward-projected data
Definition: stir_x.cpp:558
float norm(int subset_num=0, int num_subsets=1, int num_iter=2, int verb=0) const
Method computing the norm of the linear part S G of the PET acquisition model operator F.
Definition: stir_x.h:398
Ray tracing matrix implementation of the PET acquisition model.
Definition: stir_x.h:828
void enable_cache(bool v=true)
Enables or disables the caching mechanism.
Definition: stir_x.h:856
int get_num_tangential_LORs()
@
Definition: stir_x.h:884
void set_restrict_to_cylindrical_FOV(bool v=true)
Enables or disables using a circular axial FOV (vs rectangular)
Definition: stir_x.h:890
Class for PET scanner detector efficiencies model.
Definition: stir_x.h:253
Attenuation model.
Definition: stir_x.h:984
Class for estimating the scatter contribution in PET projection data.
Definition: stir_x.h:642
void set_attenuation_correction_factors_sptr(std::shared_ptr< const STIRAcquisitionData > arg)
Set attenuation correction factors as acq_data.
Definition: stir_x.h:676
PETScatterEstimator()
constructor.
Definition: stir_x.h:651
void set_input_sptr(std::shared_ptr< const STIRAcquisitionData > arg)
Set the input data.
Definition: stir_x.h:671
std::shared_ptr< STIRAcquisitionData > get_output() const
get last scatter estimate
Definition: stir_x.h:760
void set_background_sptr(std::shared_ptr< const STIRAcquisitionData > arg)
Set the background data (normally equal to the randoms in PET)
Definition: stir_x.h:686
Succeeded set_up()
set up the object and performs checks
Definition: stir_x.h:779
void set_asm(std::shared_ptr< PETAcquisitionSensitivityModel > arg)
Set acquisition sensitivity model specifying detection efficiencies (without attenuation)
Definition: stir_x.h:681
void set_output_prefix(std::string prefix)
Set prefix for filenames with scatter estimates.
Definition: stir_x.h:709
PETScatterEstimator(std::string filename)
Overloaded constructor which takes the parameter file.
Definition: stir_x.h:666
Class for simulating the scatter contribution to PET data.
Definition: stir_x.h:550
PETSingleScatterSimulator(std::string filename)
Overloaded constructor which takes the parameter file.
Definition: stir_x.h:556
PETSingleScatterSimulator()
Default constructor.
Definition: stir_x.h:553
STIR ProjData wrapper with added functionality.
Definition: stir_data_containers.h:161
In-file implementation of STIRAcquisitionData.
Definition: stir_data_containers.h:536
STIR DiscretisedDensity<3, float> wrapper with added functionality.
Definition: stir_data_containers.h:956
Accessor classes.
Definition: stir_x.h:1004
Definition: stir_x.h:1226
Definition: stir_x.h:1074
Definition: stir_x.h:1032
Definition: stir_x.h:1157
Definition: stir_x.h:1199
Definition: stir_x.h:1052
Definition: stir_x.h:1189
Definition: stir_x.h:1213
Definition: stir_x.h:1066
Definition: stir_x.h:1122
Definition: stir_x.h:1097
Definition: stir_x.h:1045
Definition: stir_x.h:1059
Definition: stir_x.h:1293
Abstract base class for SIRF image data.
Definition: GeometricalInfo.cpp:141
bool iequals(const std::string &a, const std::string &b)
Case insensitive string comparison, replaces boost::iequals.
Definition: iequals.cpp:7
DataProcessor3DF ImageDataProcessor
A typedef to use SIRF terminology for DataProcessors.
Definition: stir_x.h:309
Specification file for data handling types not present in STIR.