Skip to content

Commit

Permalink
moved the functions of the previous commit to more sensible places
Browse files Browse the repository at this point in the history
  • Loading branch information
evgueni-ovtchinnikov committed Apr 17, 2024
1 parent a2691ac commit df408d2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
42 changes: 31 additions & 11 deletions src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,26 @@ The actual algorithm is described in
virtual void unnormalise(STIRAcquisitionData& ad) const;
// divide by bin efficiencies
virtual void normalise(STIRAcquisitionData& ad) const;
static void compute_ac_factors(
std::shared_ptr<STIRAcquisitionData> acq_templ_sptr,
std::shared_ptr<STIRImageData> mu_map_sptr,
std::shared_ptr<STIRAcquisitionData>& acf_sptr,
std::shared_ptr<STIRAcquisitionData>& iacf_sptr)
{
PETAcquisitionModelUsingRayTracingMatrix acq_mod;
acq_mod.set_up(acq_templ_sptr, mu_map_sptr);
std::shared_ptr<PETAttenuationModel>
asm_sptr(new PETAttenuationModel(*mu_map_sptr, acq_mod));
PETAttenuationModel& acq_sens_mod = *asm_sptr;
acq_sens_mod.set_up(acq_templ_sptr->get_exam_info_sptr(),
acq_templ_sptr->get_proj_data_info_sptr()->create_shared_clone());
acf_sptr = acq_templ_sptr->clone();
acf_sptr->fill(1.0);
iacf_sptr = acf_sptr->clone();
acq_sens_mod.unnormalise(*acf_sptr);
acq_sens_mod.normalise(*iacf_sptr);
}

protected:
stir::shared_ptr<stir::ForwardProjectorByBin> sptr_forw_projector_;
};
Expand Down Expand Up @@ -699,17 +719,17 @@ The actual algorithm is described in
std::shared_ptr<STIRAcquisitionData>& sinograms_sptr,
std::shared_ptr<STIRAcquisitionData>& randoms_sptr)
{
ListmodeToSinograms converter;
converter.set_input(lm_data);
converter.set_output("sinograms");
converter.set_template(acq_data_template);
converter.set_time_interval(start, stop);
converter.set_up();
converter.process_data();
sinograms_sptr = converter.get_output();
converter.estimate_randoms();
randoms_sptr = converter.get_randoms_sptr();
set_input(lm_data);
set_output("sinograms");
set_template(acq_data_template);
set_time_interval(start, stop);
set_up();
process_data();
sinograms_sptr = get_output();
estimate_randoms();
randoms_sptr = get_randoms_sptr();
}
/*
void acquisition_sensitivity_from_attenuation(
std::shared_ptr<STIRAcquisitionData> acq_templ_sptr,
std::shared_ptr<STIRImageData> attn_image_sptr,
Expand All @@ -728,7 +748,7 @@ The actual algorithm is described in
acq_sens_sptr->fill(1.0);
acq_sens_mod.unnormalise(*acq_sens_sptr);
}

*/
protected:
// variables for ML estimation of singles/randoms
int fan_size;
Expand Down
7 changes: 5 additions & 2 deletions src/xSTIR/cSTIR/tests/test7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ int main()
std::cout << sinograms_sptr->norm() << '\n';
std::cout << randoms_sptr->norm() << '\n';

converter.acquisition_sensitivity_from_attenuation(templ_sptr, mu_map_sptr, acq_sens_sptr);
std::cout << acq_sens_sptr->norm() << '\n';
std::shared_ptr<STIRAcquisitionData> acf_sptr; // attenuation correction factor
std::shared_ptr<STIRAcquisitionData> iacf_sptr; // the inverse of the above
PETAttenuationModel::compute_ac_factors(templ_sptr, mu_map_sptr, acf_sptr, iacf_sptr);
std::cout << acf_sptr->norm() << '\n';
std::cout << iacf_sptr->norm() << '\n';

std::cout << "done with test7.cpp...\n";
return 0;
Expand Down

0 comments on commit df408d2

Please sign in to comment.