plastimatch
Loading...
Searching...
No Matches
rpl_volume.h
Go to the documentation of this file.
1/* -----------------------------------------------------------------------
2 See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information
3 ----------------------------------------------------------------------- */
4#ifndef _rpl_volume_h_
5#define _rpl_volume_h_
6
7#include "plmbase_config.h"
8#include <string>
9#include "aperture.h"
10#include "plm_image.h"
11#include "ray_trace_callback.h"
12#include "smart_pointer.h"
13
14#define PMMA_DENSITY 1.19 // PMMA density in g
15#define PMMA_STPR 0.98 // PMMA Stopping Power Ratio, no dim
16
18PLMBASE_API float compute_PrSTPR_Schneider_weq_from_HU (float CT_HU); // Stopping Power Ratio - Schneider's model
19PLMBASE_API float compute_PrWER_from_HU(float CT_HU); // WER = STRP / density
20PLMBASE_API float compute_density_from_HU (float CT_HU); // density VS HU - Schneider's model: broken curve
21
22class Proj_volume;
23class Ray_data;
24class Rpl_volume_private;
25class Volume;
26class Volume_limit;
27
32
34{
35public:
37 Rpl_volume_private *d_ptr;
38public:
39 Rpl_volume ();
40 ~Rpl_volume ();
41public:
42 void set_geometry (
43 const double src[3], // position of source (mm)
44 const double iso[3], // position of isocenter (mm)
45 const double vup[3], // dir to "top" of projection plane
46 double sid, // dist from proj plane to source (mm)
47 const plm_long image_dim[2], // resolution of image
48 const double image_center[2], // image center (pixels)
49 const double image_spacing[2], // pixel size (mm)
50 const double step_length // spacing between planes
51 );
52 void clone_geometry (const Rpl_volume *rv);
53
54 void set_ray_trace_start (Rpl_volume_ray_trace_start rvrtt);
55
56 Aperture::Pointer& get_aperture ();
57 const Aperture::Pointer& get_aperture () const;
58 void set_aperture (Aperture::Pointer& ap);
59
60 Volume* get_vol ();
61 const Volume* get_vol () const;
62 Proj_volume* get_proj_volume ();
63 void set_ct_volume (Plm_image::Pointer& ct_volume);
64
65 const Proj_volume* get_proj_volume () const;
66
67 const plm_long *get_image_dim ();
68 plm_long get_num_steps ();
69
70 double get_value (plm_long ap_ij[2], double dist) const;
71 double get_value (double ap_ij[2], double dist) const;
72 double get_value (const double *xyz) const;
73
74 void set_ct (const Plm_image::Pointer& ct_volume);
75 Plm_image::Pointer get_ct();
76
77 void set_ct_limit(Volume_limit* ct_limit);
78 Volume_limit* get_ct_limit();
79
80 Ray_data* get_ray_data();
81 const Ray_data* get_ray_data() const;
82 void set_ray_data (Ray_data *ray);
83
84 void set_front_clipping_plane(double front_clip);
85 double get_front_clipping_plane () const;
86 void set_back_clipping_plane(double back_clip);
87 double get_back_clipping_plane () const;
88 double get_step_length () const;
89
90 void compute_rpl_ct_density (); // compute density volume
91 void compute_rpl_HU (); // compute HU volume
92 void compute_rpl_void (); // compute void volume
93
94 void compute_rpl (bool use_aperture, Ray_trace_callback callback);
95 void compute_rpl_sample (bool use_aperture);
96 void compute_rpl_accum (bool use_aperture);
97
98 void compute_rpl_range_length_rgc(); // range length volume creation taking into account the range compensator
99 void compute_rpl_PrSTRP_no_rgc (); // compute Proton Stopping Power Ratio volume without considering the range compensator
100
101 double compute_farthest_penetrating_ray_on_nrm(float range); // return the distance from aperture to the farthest which rg_lenght > range
102
103 void compute_wed_volume (Volume *wed_vol, Volume *in_vol, float background);
104 void compute_dew_volume (Volume *wed_vol, Volume *dew_vol, float background);
105 void compute_proj_wed_volume (Volume *proj_wed_vol, float background);
106
107 void compute_volume_aperture(Aperture::Pointer ap);
108
109 void apply_beam_modifiers ();
110
111 void save (const char* filename);
112 void save (const std::string& filename);
113 void load_rpl (const char* filename);
114 void load_rpl (const std::string& filename);
115 void load_img (const char *filename);
116 void load_img (const std::string& filename);
117
118 void compute_ray_data ();
119
120protected:
121 void rpl_ray_trace (
122 Volume *ct_vol, /* I: CT volume */
123 Ray_data *ray_data, /* I: Pre-computed data for this ray */
124 Ray_trace_callback callback, /* I: Ray trace callback function */
125 Volume_limit *vol_limit, /* I: CT bounding region */
126 const double *src, /* I: @ source */
127 double rc_thk, /* I: range compensator thickness */
128 int* ires /* I: ray cast resolution */
129 );
130protected:
131 void save_img (const char* filename);
132 void save_img (const std::string& filename);
133};
134
135#endif
std::shared_ptr< Self > Pointer
Definition aperture.h:15
std::shared_ptr< Self > Pointer
Definition plm_image.h:29
The Proj_volume class represents a three-dimensional volume on a uniform non-orthogonal grid....
Definition proj_volume.h:22
Definition ray_data.h:9
Definition rpl_volume.h:34
Rpl_volume_private * d_ptr
Definition rpl_volume.h:37
const Ray_data * get_ray_data() const
Definition volume_limit.h:16
The Volume class represents a three-dimensional volume on a uniform grid. The volume can be located a...
Definition volume.h:38
#define PLMBASE_API
Definition plmbase_config.h:19
void(* Ray_trace_callback)(void *callback_data, size_t vox_index, double vox_len, float vox_value)
Definition ray_trace_callback.h:9
float compute_PrSTPR_Schneider_weq_from_HU(float CT_HU)
Definition rpl_volume.cxx:1628
float compute_PrWER_from_HU(float CT_HU)
Definition rpl_volume.cxx:1696
float compute_PrSTPR_from_HU(float)
Definition rpl_volume.cxx:1622
float compute_density_from_HU(float CT_HU)
Definition rpl_volume.cxx:1701
Rpl_volume_ray_trace_start
Definition rpl_volume.h:28
@ RAY_TRACE_START_AT_CLIPPING_PLANE
Definition rpl_volume.h:30
@ RAY_TRACE_START_AT_RAY_VOLUME_INTERSECTION
Definition rpl_volume.h:29
#define SMART_POINTER_SUPPORT(T)
Definition smart_pointer.h:19