STIR 6.4.0
ProjDataInfo.h
Go to the documentation of this file.
1//
2//
3/*
4 Copyright (C) 2000 PARAPET partners
5 Copyright (C) 2000 - 2011-10-14, Hammersmith Imanet Ltd
6 Copyright (C) 2011-07-01 - 2011, Kris Thielemans
7 Copyright (C) 2016-17, University of Hull
8 Copyright (C) 2017-2018, 2020, 2022, 2023 University College London
9 This file is part of STIR.
10
11 SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
12 See STIR/LICENSE.txt for details
13*/
27#ifndef __stir_ProjDataInfo_H__
28#define __stir_ProjDataInfo_H__
29
30#include "stir/SegmentIndices.h"
34#include "stir/Scanner.h"
35#include "stir/shared_ptr.h"
36#include "stir/unique_ptr.h"
37#include <string>
38#include <memory>
39
40START_NAMESPACE_STIR
41
42template <typename elemT>
43class Sinogram;
44template <typename elemT>
45class Viewgram;
46template <typename elemT>
47class SegmentByView;
48template <typename elemT>
49class SegmentBySinogram;
50template <typename elemT>
51class RelatedViewgrams;
52class DataSymmetriesForViewSegmentNumbers;
53class ViewSegmentNumbers;
54class Bin;
55template <typename T>
56class LOR;
57template <typename T>
58class LORInAxialAndNoArcCorrSinogramCoordinates;
59class PMessage;
60
70{
71protected:
72 typedef ProjDataInfo root_type;
73
74public:
75 /********** static members **************/
76
79
81
86 static ProjDataInfo* ProjDataInfoGE(const shared_ptr<Scanner>& scanner_ptr,
87 const int max_delta,
88 const int num_views,
89 const int num_tangential_poss,
90 const bool arc_corrected = true,
91 const int tof_mash_factor = 0);
92
94
96 static ProjDataInfo* ProjDataInfoCTI(const shared_ptr<Scanner>& scanner_ptr,
97 const int span,
98 const int max_delta,
99 const int num_views,
100 const int num_tangential_poss,
101 const bool arc_corrected = true,
102 const int tof_mash_factor = 0);
103
105
114 static unique_ptr<ProjDataInfo> construct_proj_data_info(const shared_ptr<Scanner>& scanner_sptr,
115 const int span,
116 const int max_delta,
117 const int num_views,
118 const int num_tangential_poss,
119 const bool arc_corrected = true,
120 const int tof_mash_factor = 0);
121
122 /************ constructors ***********/
123 // TODO should probably be protected
124
126 ProjDataInfo();
127
129
133 ProjDataInfo(const shared_ptr<Scanner>& scanner_ptr,
134 const VectorWithOffset<int>& num_axial_pos_per_segment,
135 const int num_views,
136 const int num_tangential_poss);
137
139 ProjDataInfo(const shared_ptr<Scanner>& scanner_ptr,
140 const VectorWithOffset<int>& num_axial_pos_per_segment,
141 const int num_views,
142 const int num_tangential_poss,
143 const int tof_mash_factor);
144
146 virtual ProjDataInfo* clone() const = 0;
147
149 inline shared_ptr<ProjDataInfo> create_shared_clone() const;
150
152 inline shared_ptr<ProjDataInfo> create_non_tof_clone() const;
153
155 virtual ~ProjDataInfo() {}
156
157 /**************** member functions *********/
158
159 // ProjDataInfo& operator=(const ProjDataInfo&);
160
162
163
165
170 virtual void reduce_segment_range(const int min_segment_num, const int max_segment_num);
172
174 virtual void set_num_views(const int num_views);
176
178 virtual void set_num_tangential_poss(const int num_tang_poss);
180
187 virtual void set_num_axial_poss_per_segment(const VectorWithOffset<int>& num_axial_poss_per_segment);
188
190
191 virtual void set_min_axial_pos_num(const int min_ax_pos_num, const int segment_num);
193
194 virtual void set_max_axial_pos_num(const int max_ax_pos_num, const int segment_num);
195
197
198 virtual void set_min_tangential_pos_num(const int min_tang_poss);
200
201 virtual void set_max_tangential_pos_num(const int max_tang_poss);
203
207 virtual void set_tof_mash_factor(const int new_num);
209
211
212
213 inline int get_num_segments() const;
215 inline int get_num_axial_poss(const int segment_num) const;
217 inline int get_num_views() const;
219 inline int get_num_tangential_poss() const;
221 inline int get_tof_bin(const double delta) const;
222#if 0
223// KT: code disabled as buggy but currently not needed
225 inline int get_unmashed_tof_bin(const double delta) const;
226#endif
228 inline int get_num_tof_poss() const;
230 inline int get_min_segment_num() const;
232 inline int get_max_segment_num() const;
234 inline int get_min_axial_pos_num(const int segment_num) const;
236 inline int get_max_axial_pos_num(const int segment_num) const;
238 inline int get_min_view_num() const;
240 inline int get_max_view_num() const;
242 inline int get_min_tangential_pos_num() const;
244 inline int get_max_tangential_pos_num() const;
246 /* 0 indicates non-TOF data, as well as the max number of TOF bins for the scanner
247 (as all TOF bins will then be added). */
248 inline int get_tof_mash_factor() const;
250 inline int get_min_tof_pos_num() const;
252 inline int get_max_tof_pos_num() const;
253
255
258 inline int get_num_sinograms() const;
260
263 inline int get_num_non_tof_sinograms() const;
265 inline std::size_t size_all() const;
267
269 inline bool is_tof_data() const;
270
272
278 virtual std::vector<int> get_original_view_nums() const;
279
280 //| \name Functions that return geometrical info for a Bin
282
284 virtual float get_tantheta(const Bin&) const = 0;
285
287
288 inline float get_costheta(const Bin&) const;
289
291
292 virtual float get_phi(const Bin&) const = 0;
293
295
297 virtual float get_t(const Bin&) const = 0;
298
300
312 virtual inline float get_m(const Bin&) const;
313
315
317 virtual float get_s(const Bin&) const = 0;
318
321 float get_k(const Bin&) const;
322
324 double get_tof_delta_time(const Bin&) const;
325
327
334
336
337
344 virtual float get_sampling_in_t(const Bin&) const;
345
347
353 virtual float get_sampling_in_m(const Bin&) const;
354
356
362 virtual float get_sampling_in_s(const Bin&) const;
363
365 float get_sampling_in_k(const Bin&) const;
367
369
382 virtual Bin get_bin(const LOR<float>&, const double delta_time = 0.0) const = 0;
383
385
386
387 bool operator==(const ProjDataInfo& proj) const;
388
389 bool operator!=(const ProjDataInfo& proj) const;
390
392 virtual bool operator>=(const ProjDataInfo& proj) const;
393
395
397
398
407
409
410 Viewgram<float> get_empty_viewgram(const int view_num,
411 const int segment_num,
412 const bool make_num_tangential_poss_odd = false,
413 const int timing_pos_num = 0) const;
414
416
417 Sinogram<float> get_empty_sinogram(const int ax_pos_num,
418 const int segment_num,
419 const bool make_num_tangential_poss_odd = false,
420 const int timing_pos_num = 0) const;
421
423
425 const bool make_num_tangential_poss_odd = false,
426 const int timing_pos_num = 0) const;
428
430 const bool make_num_tangential_poss_odd = false,
431 const int timing_pos_num = 0) const;
432
434
435 // TODOTOF
437 const shared_ptr<DataSymmetriesForViewSegmentNumbers>&,
438 const bool make_num_tangential_poss_odd = false,
439 const int timing_pos_num = 0) const;
441
443 inline const Scanner* get_scanner_ptr() const;
444
446 inline shared_ptr<Scanner> get_scanner_sptr() const;
447
449 virtual std::string parameter_info() const;
450
453 {
454 float low_lim;
455 float high_lim;
456 };
457
464#if 0
465 mutable VectorWithOffset<Float1Float2> tof_bin_unmashed_boundaries_mm;
467 mutable VectorWithOffset<Float1Float2> tof_bin_unmashed_boundaries_ps;
468#endif
469
471 void set_bed_position_horizontal(const float bed_position_horizontal_arg)
472 {
473 bed_position_horizontal = bed_position_horizontal_arg;
474 }
475
478 {
479 return bed_position_horizontal;
480 }
481
483 void set_bed_position_vertical(const float bed_position_vertical_arg)
484 {
485 bed_position_vertical = bed_position_vertical_arg;
486 }
487
490 {
491 return bed_position_vertical;
492 }
493
494 inline bool has_energy_information() const
495 {
496 return scanner_ptr->has_energy_information();
497 }
498
499protected:
500 virtual bool blindly_equals(const root_type* const) const = 0;
501
502private:
503 shared_ptr<Scanner> scanner_ptr;
504 int min_view_num;
505 int max_view_num;
506 int min_tangential_pos_num;
507 int max_tangential_pos_num;
509 int min_tof_pos_num;
511 int max_tof_pos_num;
512#if 0
514 int min_unmashed_tof_pos_num;
516 int max_unmashed_tof_pos_num;
517#endif
519 int tof_mash_factor;
521 float tof_increament_in_mm;
523 int num_tof_bins;
524 VectorWithOffset<int> min_axial_pos_per_seg;
525 VectorWithOffset<int> max_axial_pos_per_seg;
526 float bed_position_horizontal;
527 float bed_position_vertical;
528};
529
530END_NAMESPACE_STIR
531
532#include "stir/ProjDataInfo.inl"
533
534#endif // __ProjDataInfo_H__
Implementations of inline functions for class stir::ProjDataInfo.
Declaration of class stir::Scanner.
Definition of class stir::SegmentIndices.
Definition of class stir::SinogramIndices.
defines the stir::VectorWithOffset class
Definition of class stir::ViewgramIndices.
A class for storing coordinates and value of a single projection bin.
Definition Bin.h:49
A class for LORs.
Definition LORCoordinates.h:511
A base class for specifying an LOR with geometric coordinates.
Definition LORCoordinates.h:59
virtual std::string parameter_info() const
Return a string describing the object.
Definition ProjDataInfo.cxx:314
float get_bed_position_horizontal() const
Get horizontal bed position.
Definition ProjDataInfo.h:477
void set_bed_position_horizontal(const float bed_position_horizontal_arg)
Vector which holds the lower and higher boundary for each TOF position, without the application of TO...
Definition ProjDataInfo.h:471
static unique_ptr< ProjDataInfo > construct_proj_data_info(const shared_ptr< Scanner > &scanner_sptr, const int span, const int max_delta, const int num_views, const int num_tangential_poss, const bool arc_corrected=true, const int tof_mash_factor=0)
Construct a ProjDataInfo suitable with a given span.
Definition ProjDataInfo.cxx:606
shared_ptr< ProjDataInfo > create_non_tof_clone() const
Similar to create_shared_clone() but returns a non-tof version of ProjDataInfo setting tof mashing fa...
Definition ProjDataInfo.inl:39
shared_ptr< ProjDataInfo > create_shared_clone() const
Like clone() but return a shared_ptr.
Definition ProjDataInfo.inl:32
float get_k(const Bin &) const
Get value of the TOF location along the LOR (in mm) k is a line segment connecting the centers of the...
Definition ProjDataInfo.cxx:69
virtual float get_sampling_in_s(const Bin &) const
Get sampling distance in the s coordinate.
Definition ProjDataInfo.cxx:109
virtual Bin get_bin(const LOR< float > &, const double delta_time=0.0) const =0
Find the bin in the projection data that 'contains' an LOR.
virtual bool operator>=(const ProjDataInfo &proj) const
Check if *this contains proj.
Definition ProjDataInfo.cxx:756
float get_bed_position_vertical() const
Get vertical bed position.
Definition ProjDataInfo.h:489
virtual float get_sampling_in_t(const Bin &) const
Get sampling distance in the t coordinate.
Definition ProjDataInfo.cxx:93
static ProjDataInfo * ProjDataInfoCTI(const shared_ptr< Scanner > &scanner_ptr, const int span, const int max_delta, const int num_views, const int num_tangential_poss, const bool arc_corrected=true, const int tof_mash_factor=0)
Old name for construct_proj_data_info()
Definition ProjDataInfo.cxx:489
virtual float get_sampling_in_m(const Bin &) const
Get sampling distance in the m coordinate.
Definition ProjDataInfo.cxx:101
virtual void get_LOR(LORInAxialAndNoArcCorrSinogramCoordinates< float > &, const Bin &) const =0
Get LOR corresponding to a given bin.
shared_ptr< Scanner > get_scanner_sptr() const
Get scanner shared pointer.
Definition ProjDataInfo.inl:218
VectorWithOffset< Float1Float2 > tof_bin_boundaries_mm
Vector which holds the lower and higher boundary for each TOF position in mm, for faster access.
Definition ProjDataInfo.h:459
float get_sampling_in_k(const Bin &) const
Get sampling distance in the k coordinate.
Definition ProjDataInfo.cxx:84
Sinogram< float > get_empty_sinogram(const SinogramIndices &) const
Get empty_sinogram.
Definition ProjDataInfo.cxx:397
float get_costheta(const Bin &) const
Get cosine of the co-polar angle of the normal to the projection plane.
Definition ProjDataInfo.inl:200
virtual float get_t(const Bin &) const =0
Get value of the (roughly) axial coordinate in the projection plane (in mm)
Viewgram< float > get_empty_viewgram(const ViewgramIndices &) const
Get empty viewgram.
Definition ProjDataInfo.cxx:371
virtual float get_m(const Bin &) const
Return z-coordinate of the middle of the LOR (in mm)
Definition ProjDataInfo.inl:206
VectorWithOffset< Float1Float2 > tof_bin_boundaries_ps
Vector which holds the lower and higher boundary for each TOF position in ps`, for faster access.
Definition ProjDataInfo.h:461
ProjDataInfo()
Construct an empty object.
Definition ProjDataInfo.cxx:274
static ProjDataInfo * ask_parameters()
Ask for the details and return a ProjDataInfo pointer.
Definition ProjDataInfo.cxx:680
virtual ProjDataInfo * clone() const =0
Standard trick for a 'virtual copy-constructor'.
virtual float get_tantheta(const Bin &) const =0
Get tangent of the co-polar angle of the normal to the projection plane.
static ProjDataInfo * ProjDataInfoGE(const shared_ptr< Scanner > &scanner_ptr, const int max_delta, const int num_views, const int num_tangential_poss, const bool arc_corrected=true, const int tof_mash_factor=0)
Construct a ProjDataInfo with span=3 for segment 0, but span=1 for others.
Definition ProjDataInfo.cxx:622
double get_tof_delta_time(const Bin &) const
Get the value of the TOF timing difference (in ps)
Definition ProjDataInfo.cxx:78
SegmentBySinogram< float > get_empty_segment_by_sinogram(const SegmentIndices &) const
Get empty segment view.
Definition ProjDataInfo.cxx:425
const Scanner * get_scanner_ptr() const
Get scanner pointer.
Definition ProjDataInfo.inl:212
RelatedViewgrams< float > get_empty_related_viewgrams(const ViewgramIndices &, const shared_ptr< DataSymmetriesForViewSegmentNumbers > &, const bool make_num_tangential_poss_odd=false, const int timing_pos_num=0) const
Get empty related viewgrams, where the symmetries_ptr specifies the symmetries to use.
Definition ProjDataInfo.cxx:462
virtual float get_s(const Bin &) const =0
Get value of the tangential coordinate in the projection plane (in mm)
virtual ~ProjDataInfo()
Destructor.
Definition ProjDataInfo.h:155
void set_bed_position_vertical(const float bed_position_vertical_arg)
Set vertical bed position.
Definition ProjDataInfo.h:483
bool operator==(const ProjDataInfo &proj) const
check equality
Definition ProjDataInfo.cxx:737
virtual float get_phi(const Bin &) const =0
Get azimuthal angle phi of the normal to the projection plane.
SegmentByView< float > get_empty_segment_by_view(const SegmentIndices &) const
Get empty segment sino.
Definition ProjDataInfo.cxx:453
A class for storing viewgrams which are related by symmetry.
Definition RelatedViewgrams.h:41
A class for storing some info on the scanner.
Definition Scanner.h:108
A class for storing (3d) projection data with fixed SegmentIndices.
Definition SegmentBySinogram.h:51
A class for storing (3d) projection data with fixed SegmentIndices.
Definition SegmentByView.h:52
A very simple class to store segment numbers and any other indices that define a segment.
Definition SegmentIndices.h:34
A very simple class to store all dincies to get a (2D) Sinogram.
Definition SinogramIndices.h:34
A class for 2d projection data.
Definition Sinogram.h:47
A templated class for vectors, but with indices starting not from 0.
Definition VectorWithOffset.h:65
A very simple class to store all dincies to get a (2D) Viewgram.
Definition ViewgramIndices.h:33
A class for 2d projection data.
Definition Viewgram.h:49
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast into the stir names...
Struct which holds two floating numbers.
Definition ProjDataInfo.h:453
Import of std::unique_ptr into the stir namespace, together with work-arounds for other compilers.