23 #ifndef __stir_DynamicDiscretisedDensity_H__ 24 #define __stir_DynamicDiscretisedDensity_H__ 57 typedef std::vector<shared_ptr<singleDiscDensT>> DensitiesT;
72 const double scan_start_time_in_secs_since_1970,
73 const shared_ptr<Scanner>& scanner_sptr)
76 shared_ptr<ExamInfo> _exam_info_sptr(
new ExamInfo);
77 _exam_info_sptr->set_time_frame_definitions(time_frame_definitions);
78 _exam_info_sptr->start_time_in_secs_since_1970 = scan_start_time_in_secs_since_1970;
79 this->exam_info_sptr = _exam_info_sptr;
80 _scanner_sptr = scanner_sptr;
84 const double scan_start_time_in_secs_since_1970,
85 const shared_ptr<Scanner>& scanner_sptr,
86 const shared_ptr<singleDiscDensT>& density_sptr)
89 shared_ptr<ExamInfo> _exam_info_sptr;
90 if (is_null_ptr(density_sptr->get_exam_info_sptr()))
93 _exam_info_sptr = density_sptr->get_exam_info_sptr()->create_shared_clone();
94 _exam_info_sptr->set_time_frame_definitions(time_frame_definitions);
95 _exam_info_sptr->start_time_in_secs_since_1970 = scan_start_time_in_secs_since_1970;
96 this->exam_info_sptr = _exam_info_sptr;
98 _scanner_sptr = scanner_sptr;
100 for (
unsigned int frame_num = 1; frame_num <= time_frame_definitions.
get_num_frames(); ++frame_num)
102 shared_ptr<singleDiscDensT> density_frame_sptr(density_sptr->get_empty_copy());
103 ExamInfo this_exam_info(*exam_info_sptr);
104 this_exam_info.set_time_frame_definitions(
TimeFrameDefinitions(time_frame_definitions, frame_num));
105 density_frame_sptr->set_exam_info(this_exam_info);
106 this->_densities[frame_num - 1] = density_frame_sptr;
116 inline full_iterator begin_all();
117 inline const_full_iterator begin_all()
const;
118 inline const_full_iterator begin_all_const()
const;
119 inline full_iterator end_all();
120 inline const_full_iterator end_all()
const;
121 inline const_full_iterator end_all_const()
const;
131 void set_density(
const singleDiscDensT& density,
const unsigned int frame_num);
137 const std::vector<shared_ptr<singleDiscDensT>>& get_densities()
const;
139 const singleDiscDensT& get_density(
const unsigned int frame_num)
const;
141 const singleDiscDensT& operator[](
const unsigned int frame_num)
const {
return this->get_density(frame_num); }
144 singleDiscDensT& get_density(
const unsigned int frame_num);
146 singleDiscDensT& operator[](
const unsigned int frame_num) {
return this->get_density(frame_num); }
149 const float get_isotope_halflife()
const;
151 float get_calibration_factor()
const;
154 const singleDiscDensT&
at(
const unsigned int frame_num)
const {
return this->get_density(frame_num); }
157 singleDiscDensT&
at(
const unsigned int frame_num) {
return this->get_density(frame_num); }
169 const double get_start_time_in_secs_since_1970()
const;
171 const float get_scanner_default_bin_size()
const;
175 shared_ptr<ExamInfo> sptr = this->exam_info_sptr->create_shared_clone();
176 sptr->set_time_frame_definitions(time_frame_definitions);
177 this->exam_info_sptr = sptr;
180 void set_scanner(
const Scanner& scanner) { this->_scanner_sptr.reset(
new Scanner(scanner)); }
184 unsigned get_num_time_frames()
const {
return this->get_time_frame_definitions().
get_num_time_frames(); }
190 Succeeded write_to_ecat7(
const std::string& filename)
const;
192 void calibrate_frames()
const;
197 void decay_correct_frames();
198 void set_if_decay_corrected(
const bool is_decay_corrected);
199 void set_calibration_factor(
const float calibration_factor);
200 void set_num_densities(
const int num_densities) { _densities.resize(num_densities); }
205 DensitiesT _densities;
206 shared_ptr<Scanner> _scanner_sptr;
207 bool _is_decay_corrected;
215 #endif //__stir_DynamicDiscretisedDensity_H__ NestedIterator< DensitiesT::const_iterator, ConstPtrBeginEndAllFunction< DensitiesT::const_iterator > > const_full_iterator
typedef for const iterator that runs over all densels in all frames
Definition: DynamicDiscretisedDensity.h:63
Class used for storing time frame durations.
Definition: TimeFrameDefinitions.h:38
singleDiscDensT & at(const unsigned int frame_num)
at method
Definition: DynamicDiscretisedDensity.h:157
unsigned int get_num_time_frames() const
Get number of frames.
Definition: TimeFrameDefinitions.cxx:92
Declaration of class stir::TimeFrameDefinitions.
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
defines the stir::DiscretisedDensity class
Class NestedIterator implements a (forward) iterator using a pair of 'nested' iterators.
Definition: NestedIterator.h:93
unique_ptr< DataT > read_from_file(const FileSignature &signature, FileT file)
Function that reads data from file using the default InputFileFormatRegistry, using the provided File...
Definition: read_from_file.h:46
A class for storing some info on the scanner.
Definition: Scanner.h:107
Class of multiple image frames, one for each time frame Each time frame is a DiscretisedDensity<3,float>
Definition: DynamicDiscretisedDensity.h:45
DynamicDiscretisedDensity(const TimeFrameDefinitions &time_frame_definitions, const double scan_start_time_in_secs_since_1970, const shared_ptr< Scanner > &scanner_sptr, const shared_ptr< singleDiscDensT > &density_sptr)
Construct an empty DynamicDiscretisedDensity based on a shared_ptr<DiscretisedDensity<3,float> >
Definition: DynamicDiscretisedDensity.h:83
Definition of stir::is_null_ptr functions.
Declaration of class stir::Scanner.
NestedIterator< DensitiesT::iterator, PtrBeginEndAllFunction< DensitiesT::iterator > > full_iterator
typedef for iterator that runs over all densels in all frames
Definition: DynamicDiscretisedDensity.h:61
a class for storing information about 1 exam (or scan)
Definition: ExamInfo.h:41
unsigned int get_num_frames() const
Get number of frames.
Definition: TimeFrameDefinitions.cxx:86
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
This file declares the stir::NestedIterator class and supporting function objects.
const singleDiscDensT & at(const unsigned int frame_num) const
at method
Definition: DynamicDiscretisedDensity.h:154
DynamicDiscretisedDensity hierarchy_base_type
A typedef that can be used what the base of the hierarchy is.
Definition: DynamicDiscretisedDensity.h:51
base class for data objects such as ProjData etcProvides an ExamInfo member.
Definition: ExamData.h:33
Inline implementations of class stir::DynamicDiscretisedDensity.