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"
44 #define MIN_BIN_EFFICIENCY 1.0e-20f
46 #define SIRF_DYNAMIC_CAST(T, X, Y) T& X = dynamic_cast<T&>(Y)
101 store_prompts =
true;
102 store_delayeds =
false;
103 delayed_increment = 0;
105 display_interval = 1;
110 void set_input(std::string lm_file)
112 input_filename = lm_file;
113 lm_data_ptr = stir::read_from_file<ListModeData>(input_filename);
114 exam_info_sptr_.reset(
new ExamInfo(lm_data_ptr->get_exam_info()));
115 proj_data_info_sptr_.reset(lm_data_ptr->get_proj_data_info_sptr()->clone());
122 output_filename_prefix = proj_data_file;
124 void set_template(std::string proj_data_file)
127 set_template(acq_data_template);
129 void set_template(
const STIRAcquisitionData& acq_data_template)
131 template_proj_data_info_ptr =
132 acq_data_template.get_proj_data_info_sptr()->create_shared_clone();
134 void set_time_interval(
double start,
double stop)
136 std::pair<double, double> interval(start, stop);
137 std::vector < std::pair<double, double> > intervals;
138 intervals.push_back(interval);
139 frame_defs = stir::TimeFrameDefinitions(intervals);
140 do_time_frame =
true;
142 int set_flag(
const char* flag,
bool value)
145 store_prompts = value;
147 store_delayeds = value;
150 do_pre_normalisation = value;
152 do_time_frame = value;
160 bool get_store_prompts()
const
162 return store_prompts;
164 bool get_store_delayeds()
const
166 return store_delayeds;
168 virtual stir::Succeeded set_up()
170 if (LmToProjData::set_up() == Succeeded::no)
171 THROW(
"LmToProjData setup failed");
173 #if STIR_VERSION < 060000
174 const auto max_fan_size =
175 lm_data_ptr->get_scanner_ptr()->get_max_num_non_arccorrected_bins();
177 const auto max_fan_size =
178 lm_data_ptr->get_scanner().get_max_num_non_arccorrected_bins();
181 fan_size = max_fan_size;
184 std::min(fan_size, max_fan_size);
185 half_fan_size = fan_size / 2;
186 fan_size = 2 * half_fan_size + 1;
188 exam_info_sptr_->set_time_frame_definitions(frame_defs);
189 const float h = proj_data_info_sptr_->get_bed_position_horizontal();
190 const float v = proj_data_info_sptr_->get_bed_position_vertical();
191 stir::shared_ptr<ProjDataInfo> temp_proj_data_info_sptr(template_proj_data_info_ptr->clone());
192 temp_proj_data_info_sptr->set_bed_position_horizontal(h);
193 temp_proj_data_info_sptr->set_bed_position_vertical(v);
194 randoms_sptr.reset(
new STIRAcquisitionDataInMemory(exam_info_sptr_, temp_proj_data_info_sptr));
196 return stir::Succeeded::yes;
198 int estimate_randoms();
201 std::string filename = output_filename_prefix +
"_randoms" +
"_f1g1d0b0.hs";
202 randoms_sptr->write(filename.c_str());
204 std::shared_ptr<STIRAcquisitionData> get_output()
206 std::string filename = output_filename_prefix +
"_f1g1d0b0.hs";
207 return std::shared_ptr<STIRAcquisitionData>
208 (
new STIRAcquisitionDataInFile(filename.c_str()));
210 std::shared_ptr<STIRAcquisitionData> get_randoms_sptr()
222 int max_ring_diff_for_fansums;
224 int display_interval;
227 stir::shared_ptr<ExamInfo> exam_info_sptr_;
228 stir::shared_ptr<ProjDataInfo> proj_data_info_sptr_;
229 stir::shared_ptr<std::vector<stir::Array<2, float> > > fan_sums_sptr;
230 stir::shared_ptr<stir::DetectorEfficiencies> det_eff_sptr;
231 std::shared_ptr<STIRAcquisitionData> randoms_sptr;
232 void compute_fan_sums_(
bool prompt_fansum =
false);
233 int compute_singles_();
235 static unsigned long compute_num_bins_(
const int num_rings,
236 const int num_detectors_per_ring,
237 const int max_ring_diff,
const int half_fan_size);
257 norm_.reset(
new stir::ChainedBinNormalisation(mod1.data(), mod2.data()));
260 void set_up(
const stir::shared_ptr<const stir::ExamInfo>& exam_info_sptr,
261 const stir::shared_ptr<stir::ProjDataInfo>&);
270 std::shared_ptr<STIRAcquisitionData> sptr_ad = ad.new_acquisition_data();
272 this->unnormalise(*sptr_ad);
278 std::shared_ptr<STIRAcquisitionData> sptr_ad = ad.new_acquisition_data();
280 this->normalise(*sptr_ad);
284 stir::shared_ptr<stir::BinNormalisation> data()
291 stir::shared_ptr<stir::BinNormalisation> norm_;
361 void set_subset(
int sub_num)
365 void set_num_subsets(
int num_sub)
369 virtual std::shared_ptr<STIRImageData> apply(
const STIRImageData& image_data)
371 std::shared_ptr<STIRAcquisitionData> sptr_fwd =
372 sptr_am_->forward(image_data, sub_num_, num_sub_);
373 std::shared_ptr<STIRImageData> sptr_bwd =
374 sptr_am_->backward(*sptr_fwd, sub_num_, num_sub_);
378 std::shared_ptr<const PETAcquisitionModel> sptr_am_;
391 float norm(
int subset_num = 0,
int num_subsets = 1,
int num_iter = 2,
int verb = 0)
const
394 bf.set_subset(subset_num);
395 bf.set_num_subsets(num_subsets);
397 jcg.set_num_iterations(num_iter);
399 image_data.fill(1.0);
400 float lmd = jcg.largest(bf, image_data, verb);
401 return std::sqrt(lmd);
404 void set_projectors(stir::shared_ptr<stir::ProjectorByBinPair> sptr_projectors)
406 sptr_projectors_ = sptr_projectors;
408 const stir::shared_ptr<stir::ProjectorByBinPair> projectors_sptr()
const
410 return sptr_projectors_;
412 void set_additive_term(std::shared_ptr<STIRAcquisitionData> sptr)
416 std::shared_ptr<const STIRAcquisitionData> additive_term_sptr()
const
420 void set_background_term(std::shared_ptr<STIRAcquisitionData> sptr)
422 sptr_background_ = sptr;
424 std::shared_ptr<const STIRAcquisitionData> background_term_sptr()
const
426 return sptr_background_;
428 std::shared_ptr<const STIRAcquisitionData> acq_template_sptr()
const
430 return sptr_acq_template_;
432 std::shared_ptr<const STIRImageData> image_template_sptr()
const
434 return sptr_image_template_;
440 const stir::shared_ptr<stir::BinNormalisation> normalisation_sptr()
const
443 return sptr_asm_->data();
444 stir::shared_ptr<stir::BinNormalisation> sptr;
453 void set_asm(std::shared_ptr<PETAcquisitionSensitivityModel> sptr_asm)
456 sptr_asm_ = sptr_asm;
458 stir::shared_ptr<PETAcquisitionSensitivityModel> asm_sptr()
const
467 void cancel_background_term()
469 sptr_background_.reset();
471 void cancel_additive_term()
475 void cancel_normalisation()
480 std::shared_ptr<const PETAcquisitionModel> linear_acq_mod_sptr()
const
482 std::shared_ptr<PETAcquisitionModel> sptr_am(
new PETAcquisitionModel);
483 sptr_am->set_projectors(sptr_projectors_);
484 sptr_am->set_asm(sptr_asm_);
485 sptr_am->sptr_acq_template_ = sptr_acq_template_;
486 sptr_am->sptr_image_template_ = sptr_image_template_;
491 std::shared_ptr<STIRAcquisitionData> sptr_acq,
492 std::shared_ptr<STIRImageData> sptr_image);
497 std::shared_ptr<STIRAcquisitionData>
498 forward(
const STIRImageData& image,
499 int subset_num = 0,
int num_subsets = 1,
bool do_linear_only =
false)
const;
510 void forward(STIRAcquisitionData& acq_data,
const STIRImageData& image,
511 int subset_num,
int num_subsets,
bool zero =
false,
bool do_linear_only =
false)
const;
514 std::shared_ptr<STIRImageData> backward(
const STIRAcquisitionData& ad,
515 int subset_num = 0,
int num_subsets = 1)
const;
517 void backward(STIRImageData& image,
const STIRAcquisitionData& ad,
518 int subset_num = 0,
int num_subsets = 1)
const;
521 stir::shared_ptr<stir::ProjectorByBinPair> sptr_projectors_;
522 std::shared_ptr<STIRAcquisitionData> sptr_acq_template_;
523 std::shared_ptr<STIRImageData> sptr_image_template_;
524 std::shared_ptr<STIRAcquisitionData> sptr_add_;
525 std::shared_ptr<STIRAcquisitionData> sptr_background_;
526 std::shared_ptr<PETAcquisitionSensitivityModel> sptr_asm_;
550 stir::SingleScatterSimulation(filename)
553 void set_up(std::shared_ptr<const STIRAcquisitionData> sptr_acq_template,
554 std::shared_ptr<const STIRImageData> sptr_act_image_template)
556 this->sptr_acq_template_ = sptr_acq_template;
558 stir::SingleScatterSimulation::set_template_proj_data_info(
559 *sptr_acq_template_->get_proj_data_info_sptr());
560 stir::SingleScatterSimulation::set_exam_info(
561 *sptr_acq_template_->get_exam_info_sptr());
565 auto& tmp = stir::SingleScatterSimulation::get_attenuation_image();
569 THROW(
"Fatal error in PETSingleScatterSimulator::set_up: attenuation_image has not been set");
571 this->set_activity_image_sptr(sptr_act_image_template);
573 if (stir::SingleScatterSimulation::set_up() == Succeeded::no)
574 THROW(
"Fatal error in PETSingleScatterSimulator::set_up() failed.");
577 void set_activity_image_sptr(std::shared_ptr<const STIRImageData> arg)
579 #if STIR_VERSION < 050000
581 stir::shared_ptr<Image3DF> sptr_image_copy(arg->data_sptr()->clone());
582 stir::SingleScatterSimulation::set_activity_image_sptr(sptr_image_copy);
584 stir::SingleScatterSimulation::set_activity_image_sptr(arg->data_sptr());
588 void set_attenuation_image_sptr(std::shared_ptr<const STIRImageData> arg)
590 #if STIR_VERSION < 050000
592 stir::shared_ptr<Image3DF> sptr_image_copy(arg->data_sptr()->clone());
593 stir::SingleScatterSimulation::set_density_image_sptr(sptr_image_copy);
595 stir::SingleScatterSimulation::set_density_image_sptr(arg->data_sptr());
599 std::shared_ptr<STIRAcquisitionData> forward(
const STIRImageData& activity_img)
601 if (!sptr_acq_template_.get())
602 THROW(
"Fatal error in PETSingleScatterSimulator::forward: acquisition template not set");
603 std::shared_ptr<STIRAcquisitionData> sptr_ad =
604 sptr_acq_template_->new_acquisition_data();
605 this->forward( *sptr_ad, activity_img);
609 void forward(STIRAcquisitionData& ad,
const STIRImageData& activity_img)
611 stir::shared_ptr<ProjData> sptr_fd = ad.data();
612 this->set_output_proj_data_sptr(sptr_fd);
614 this->process_data();
618 std::shared_ptr<const STIRAcquisitionData> sptr_acq_template_;
636 using recon_type = stir::OSMAPOSLReconstruction<DiscretisedDensity<3,float>>;
646 auto obj_sptr = std::make_shared<PoissonLogLikelihoodWithLinearModelForMeanAndProjData<DiscretisedDensity<3,float>>>();
647 auto recon_sptr = std::make_shared<recon_type>();
648 recon_sptr->set_num_subiterations(8);
649 recon_sptr->set_num_subsets(7);
650 recon_sptr->set_disable_output(
true);
651 recon_sptr->set_objective_function_sptr(obj_sptr);
652 stir::shared_ptr<stir::SeparableGaussianImageFilter<float> >
653 filter_sptr(
new stir::SeparableGaussianImageFilter<float>);
654 filter_sptr->set_fwhms(stir::make_coordinate(15.F,15.F,15.F));
655 recon_sptr->set_post_processor_sptr(filter_sptr);
656 stir::ScatterEstimation::set_reconstruction_method_sptr(recon_sptr);
660 stir::ScatterEstimation(filename)
666 stir::ScatterEstimation::set_input_proj_data_sptr(arg->data());
671 stir::ScatterEstimation::set_attenuation_correction_proj_data_sptr(arg->data());
674 void set_asm(std::shared_ptr<PETAcquisitionSensitivityModel> arg)
676 stir::ScatterEstimation::set_normalisation_sptr(arg->data());
681 stir::ScatterEstimation::set_background_proj_data_sptr(arg->data());
684 void set_attenuation_image_sptr(std::shared_ptr<const STIRImageData> arg)
686 #if STIR_VERSION < 050000
688 stir::shared_ptr<Image3DF> sptr_image_copy(arg->data_sptr()->clone());
689 stir::ScatterEstimation::set_attenuation_image_sptr(sptr_image_copy);
691 stir::ScatterEstimation::set_attenuation_image_sptr(arg->data_sptr());
704 stir::ScatterEstimation::set_export_scatter_estimates_of_each_iteration(!prefix.empty());
705 stir::ScatterEstimation::set_output_scatter_estimate_prefix(prefix);
708 void set_num_iterations(
int arg)
710 stir::ScatterEstimation::set_num_iterations(arg);
713 int get_num_iterations()
const
715 return stir::ScatterEstimation::get_num_iterations();
718 void set_OSEM_num_subiterations(
int arg)
720 this->get_reconstruction_method().set_num_subiterations(arg);
723 int get_OSEM_num_subiterations()
const
725 return this->get_reconstruction_method().get_num_subiterations();
728 void set_OSEM_num_subsets(
int arg)
730 this->get_reconstruction_method().set_num_subsets(arg);
731 this->_already_set_up_sirf =
false;
734 int get_OSEM_num_subsets()
const
736 return this->get_reconstruction_method().get_num_subsets();
739 std::shared_ptr<STIRAcquisitionData> get_scatter_estimate(
int est_num = -1)
const
742 est_num = num_scatter_iterations;
743 if (est_num == num_scatter_iterations)
746 if (output_scatter_estimate_prefix.empty())
747 THROW(
"output_scatter_estimate_prefix not set, so scatter estimates were not saved to file.");
748 const std::string filename = output_scatter_estimate_prefix +
"_" + std::to_string(est_num) +
".hs";
749 return std::make_shared<STIRAcquisitionDataInFile>(filename.c_str());
755 auto stir_proj_data_sptr = stir::ScatterEstimation::get_output();
756 if (!stir_proj_data_sptr)
757 THROW(
"output not yet computed");
758 std::shared_ptr<STIRAcquisitionData> sptr_acq_data
759 (STIRAcquisitionData::storage_template()->same_acquisition_data(stir_proj_data_sptr->get_exam_info_sptr(),
760 stir_proj_data_sptr->get_proj_data_info_sptr()->create_shared_clone()));
761 sptr_acq_data->data()->fill(*stir_proj_data_sptr);
762 return sptr_acq_data;
775 const float zoom = 0.2F;
776 stir::shared_ptr<Voxels3DF>
777 image_sptr(
new Voxels3DF(MAKE_SHARED<stir::ExamInfo>(*this->get_input_data()->get_exam_info_sptr()),
778 *this->get_input_data()->get_proj_data_info_sptr(),
780 image_sptr->fill(1.F);
781 stir::ScatterEstimation::set_initial_activity_image_sptr(image_sptr);
782 if (stir::ScatterEstimation::set_up() == Succeeded::no)
783 THROW(
"scatter estimation set_up failed");
784 this->_already_set_up_sirf =
true;
785 return Succeeded::yes;
789 if (!this->_already_set_up_sirf)
790 THROW(
"scatter estimation needs to be set-up first");
791 if (!stir::ScatterEstimation::already_setup())
792 THROW(
"scatter estimation needs to be set-up first");
793 if (stir::ScatterEstimation::process_data() == Succeeded::no)
794 THROW(
"scatter estimation failed");
798 bool _already_set_up_sirf;
801 recon_type& get_reconstruction_method()
const
803 return dynamic_cast<recon_type&
>(*this->reconstruction_template_sptr);
825 this->sptr_projectors_.reset(
new ProjectorPairUsingMatrix);
827 void set_matrix(stir::shared_ptr<stir::ProjMatrixByBin> sptr_matrix)
829 sptr_matrix_ = sptr_matrix;
830 ((ProjectorPairUsingMatrix*)this->sptr_projectors_.get())->
831 set_proj_matrix_sptr(sptr_matrix);
833 stir::shared_ptr<stir::ProjMatrixByBin> matrix_sptr()
840 std::shared_ptr<STIRAcquisitionData> sptr_acq,
841 std::shared_ptr<STIRImageData> sptr_image)
843 if (!sptr_matrix_.get())
844 THROW(
"PETAcquisitionModelUsingMatrix setup failed - matrix not set");
845 PETAcquisitionModel::set_up(sptr_acq, sptr_image);
851 sptr_matrix_->enable_cache(v);
855 stir::shared_ptr<stir::ProjMatrixByBin> sptr_matrix_;
864 stir::shared_ptr<RayTracingMatrix> matrix_sptr(
new RayTracingMatrix);
865 matrix_sptr->set_num_tangential_LORs(num_LORs);
866 set_matrix(matrix_sptr);
868 void set_num_tangential_LORs(
int num_LORs)
871 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
873 matrix.set_num_tangential_LORs(num_LORs);
879 auto matrix =
dynamic_cast<const RayTracingMatrix&
>(*matrix_sptr());
880 return matrix.get_num_tangential_LORs();
885 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
886 matrix.set_restrict_to_cylindrical_FOV(v);
891 void set_do_symmetry_90degrees_min_phi(
bool v =
true)
893 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
894 matrix.set_do_symmetry_90degrees_min_phi(v);
897 void set_do_symmetry_180degrees_min_phi(
bool v =
true)
899 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
900 matrix.set_do_symmetry_180degrees_min_phi(v);
903 void set_do_symmetry_swap_segment(
bool v =
true)
905 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
906 matrix.set_do_symmetry_swap_segment(v);
909 void set_do_symmetry_swap_s(
bool v =
true)
911 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
912 matrix.set_do_symmetry_swap_s(v);
915 void set_do_symmetry_shift_z(
bool v =
true)
917 auto matrix =
dynamic_cast<RayTracingMatrix&
>(*matrix_sptr());
918 matrix.set_do_symmetry_shift_z(v);
922 typedef PETAcquisitionModel AcqMod3DF;
923 typedef PETAcquisitionModelUsingMatrix AcqModUsingMatrix3DF;
924 typedef std::shared_ptr<AcqMod3DF> sptrAcqMod3DF;
926 #ifdef STIR_WITH_NiftyPET_PROJECTOR
932 class PETAcquisitionModelUsingNiftyPET :
public PETAcquisitionModel {
934 PETAcquisitionModelUsingNiftyPET()
936 _NiftyPET_projector_pair_sptr.reset(
new ProjectorPairUsingNiftyPET);
937 this->sptr_projectors_ = _NiftyPET_projector_pair_sptr;
939 _NiftyPET_projector_pair_sptr->set_verbosity(0);
941 void set_cuda_verbosity(
const bool verbosity)
const
943 _NiftyPET_projector_pair_sptr->set_verbosity(verbosity);
945 void set_use_truncation(
const bool use_truncation)
const
947 _NiftyPET_projector_pair_sptr->set_use_truncation(use_truncation);
950 stir::shared_ptr<stir::ProjectorPairUsingNiftyPET> _NiftyPET_projector_pair_sptr;
952 typedef PETAcquisitionModelUsingNiftyPET AcqModUsingNiftyPET3DF;
955 #ifdef STIR_WITH_Parallelproj_PROJECTOR
961 class PETAcquisitionModelUsingParallelproj :
public PETAcquisitionModel {
963 PETAcquisitionModelUsingParallelproj()
965 this->sptr_projectors_.reset(
new ProjectorByBinPairUsingParallelproj);
968 typedef PETAcquisitionModelUsingParallelproj AcqModUsingParallelproj;
985 stir::shared_ptr<stir::ForwardProjectorByBin> sptr_forw_projector_;
999 void set_length_x(
float v)
1003 void set_length_y(
float v)
1007 void set_length_z(
float v)
1011 float get_length_x()
const
1015 float get_length_y()
const
1019 float get_length_z()
const
1034 void only2D(
int only) {
1035 only_2D = only != 0;
1041 void only2D(
int only) {
1042 only_2D = only != 0;
1048 void only2D(
int only) {
1049 only_2D = only != 0;
1055 void only2D(
int only) {
1056 only_2D = only != 0;
1061 public stir::GeneralisedObjectiveFunction < Image3DF > {
1071 public stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData < Image3DF > {
1073 void set_input_file(
const char* filename) {
1074 input_filename = filename;
1076 void set_acquisition_data(std::shared_ptr<STIRAcquisitionData> sptr)
1079 set_proj_data_sptr(sptr->data());
1081 void set_acquisition_model(std::shared_ptr<AcqMod3DF> sptr_am)
1085 auto sptr_asm = am.asm_sptr();
1086 set_projector_pair_sptr(am.projectors_sptr());
1087 bool have_a = am.additive_term_sptr().get();
1088 bool have_b = am.background_term_sptr().get();
1089 bool have_asm = sptr_asm.get();
1092 set_additive_proj_data_sptr(am.additive_term_sptr()->data());
1095 auto sptr_b = am.background_term_sptr();
1096 stir::shared_ptr<STIRAcquisitionData> sptr;
1098 sptr = sptr_asm->invert(*sptr_b);
1100 sptr = sptr_b->clone();
1102 auto sptr_a = am.additive_term_sptr();
1104 sptr->axpby(&a, *sptr, &a, *sptr_a);
1106 set_additive_proj_data_sptr(sptr->data());
1108 if (am.normalisation_sptr().get())
1109 set_normalisation_sptr(am.normalisation_sptr());
1111 std::shared_ptr<AcqMod3DF> acquisition_model_sptr()
1116 std::shared_ptr<STIRAcquisitionData> sptr_ad_;
1117 std::shared_ptr<AcqMod3DF> sptr_am_;
1124 public stir::IterativeReconstruction < Image3DF > {
1132 void update(Image3DF &image) {
1133 update_estimate(image);
1134 end_of_iteration_processing(image);
1141 void update(stir::shared_ptr<STIRImageData> sptr_id)
1145 int& subiteration() {
1146 return subiteration_num;
1148 int subiteration()
const {
1149 return subiteration_num;
1151 void set_initial_estimate_file(
const char* filename) {
1152 initial_data_filename = filename;
1158 int& subiteration() {
1159 return subiteration_num;
1161 int subiteration()
const {
1162 return subiteration_num;
1168 void compute_kernelised_image_x(
1169 Image3DF& kernelised_image_out,
1170 const Image3DF& image_to_kernelise,
1171 const Image3DF& current_alpha_estimate)
1173 compute_kernelised_image(
1174 kernelised_image_out,
1176 current_alpha_estimate);
1182 float& relaxation_parameter_value() {
1183 return relaxation_parameter;
1185 float& relaxation_gamma_value() {
1186 return relaxation_gamma;
1188 double& upper_bound_value() {
1201 set_input_data(acq.data());
1203 void set_zoom(
float v)
1208 void set_alpha_ramp(
double alpha)
1212 if (!(alpha > 0 && alpha <= 1.0))
1214 (
"wrong ramp filter parameter alpha", __FILE__, __LINE__);
1217 void set_frequency_cut_off(
double fc)
1219 if (!(fc > 0 && fc <= 0.5))
1221 (
"wrong frequency cut-off", __FILE__, __LINE__);
1224 void set_up(std::shared_ptr<STIRImageData> sptr_id)
1227 stir::Succeeded s = stir::Reconstruction<Image3DF>::set_up(_sptr_image_data->data_sptr());
1228 if (s != stir::Succeeded::yes)
1229 THROW(
"stir::Reconstruction setup failed");
1238 stir::Succeeded s = stir::Succeeded::no;
1240 stir::shared_ptr<Image3DF> sptr_image(construct_target_image_ptr());
1242 stir::Reconstruction<Image3DF>::set_up(sptr_image);
1243 s = reconstruct(sptr_image);
1246 s = reconstruct(_sptr_image_data->data_sptr());
1247 if (s != stir::Succeeded::yes)
1248 THROW(
"stir::AnalyticReconstruction::reconstruct failed");
1250 std::shared_ptr<STIRImageData> get_output()
1252 return _sptr_image_data;
1256 std::shared_ptr<STIRImageData> _sptr_image_data;
1260 public stir::SeparableGaussianImageFilter<float> {
1270 void set_fwhms_xyz(
char xyz,
float f)
1272 stir::BasicCoordinate<3, float> v = get_fwhms();
1285 void set_max_kernel_sizes_xyz(
char xyz,
int s)
1287 stir::BasicCoordinate<3, int> v = get_max_kernel_sizes();
1298 set_max_kernel_sizes(v);
Definition: LocalisedException.h:32
Definition: JacobiCG.h:37
Listmode-to-sinograms converter.
Definition: stir_x.h:83
void set_output(std::string proj_data_file)
Specifies the prefix for the output file(s),.
Definition: stir_x.h:120
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:96
Class for the product of backward and forward projectors of a PET acquisition model.
Definition: stir_x.h:358
Class for a PET acquisition model.
Definition: stir_x.h:349
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:391
Ray tracing matrix implementation of the PET acquisition model.
Definition: stir_x.h:821
void enable_cache(bool v=true)
Enables or disables the caching mechanism.
Definition: stir_x.h:849
int get_num_tangential_LORs()
@
Definition: stir_x.h:877
void set_restrict_to_cylindrical_FOV(bool v=true)
Enables or disables using a circular axial FOV (vs rectangular)
Definition: stir_x.h:883
Class for PET scanner detector efficiencies model.
Definition: stir_x.h:246
Attenuation model.
Definition: stir_x.h:977
Class for estimating the scatter contribution in PET projection data.
Definition: stir_x.h:635
void set_attenuation_correction_factors_sptr(std::shared_ptr< const STIRAcquisitionData > arg)
Set attenuation correction factors as acq_data.
Definition: stir_x.h:669
PETScatterEstimator()
constructor.
Definition: stir_x.h:644
void set_input_sptr(std::shared_ptr< const STIRAcquisitionData > arg)
Set the input data.
Definition: stir_x.h:664
std::shared_ptr< STIRAcquisitionData > get_output() const
get last scatter estimate
Definition: stir_x.h:753
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:679
Succeeded set_up()
set up the object and performs checks
Definition: stir_x.h:772
void set_asm(std::shared_ptr< PETAcquisitionSensitivityModel > arg)
Set acquisition sensitivity model specifying detection efficiencies (without attenuation)
Definition: stir_x.h:674
void set_output_prefix(std::string prefix)
Set prefix for filenames with scatter estimates.
Definition: stir_x.h:702
PETScatterEstimator(std::string filename)
Overloaded constructor which takes the parameter file.
Definition: stir_x.h:659
Class for simulating the scatter contribution to PET data.
Definition: stir_x.h:543
PETSingleScatterSimulator(std::string filename)
Overloaded constructor which takes the parameter file.
Definition: stir_x.h:549
PETSingleScatterSimulator()
Default constructor.
Definition: stir_x.h:546
STIR ProjData wrapper with added functionality.
Definition: stir_data_containers.h:148
In-file implementation of STIRAcquisitionData.
Definition: stir_data_containers.h:503
STIR DiscretisedDensity<3, float> wrapper with added functionality.
Definition: stir_data_containers.h:875
Accessor classes.
Definition: stir_x.h:997
Definition: stir_x.h:1193
Definition: stir_x.h:1061
Definition: stir_x.h:1025
Definition: stir_x.h:1124
Definition: stir_x.h:1166
Definition: stir_x.h:1039
Definition: stir_x.h:1156
Definition: stir_x.h:1180
Definition: stir_x.h:1053
Definition: stir_x.h:1071
Definition: stir_x.h:1032
Definition: stir_x.h:1046
Definition: stir_x.h:1260
Abstract data container.
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:302
Specification file for data handling types not present in STIR.