-
Notifications
You must be signed in to change notification settings - Fork 6
/
pctProtonPairsToDistanceDrivenProjection.h
186 lines (140 loc) · 6.57 KB
/
pctProtonPairsToDistanceDrivenProjection.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#ifndef __pctProtonPairsToDistanceDrivenProjection_h
#define __pctProtonPairsToDistanceDrivenProjection_h
#include "rtkConfiguration.h"
#include "pctBetheBlochFunctor.h"
#include <rtkQuadricShape.h>
#include <itkInPlaceImageFilter.h>
#include <mutex>
namespace pct
{
template <class TInputImage, class TOutputImage>
class ITK_EXPORT ProtonPairsToDistanceDrivenProjection :
public itk::InPlaceImageFilter<TInputImage,TOutputImage>
{
public:
/** Standard class typedefs. */
typedef ProtonPairsToDistanceDrivenProjection Self;
typedef itk::InPlaceImageFilter<TInputImage,TOutputImage> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::Vector<float, 3> ProtonPairsPixelType;
typedef itk::Image<ProtonPairsPixelType,2> ProtonPairsImageType;
typedef ProtonPairsImageType::Pointer ProtonPairsImagePointer;
typedef itk::Image<unsigned int, 3> CountImageType;
typedef CountImageType::Pointer CountImagePointer;
typedef itk::Image<float, 3> AngleImageType;
typedef AngleImageType::Pointer AngleImagePointer;
typedef TOutputImage OutputImageType;
typedef typename OutputImageType::Pointer OutputImagePointer;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef rtk::QuadricShape RQIType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(ProtonPairsToDistanceDrivenProjection, itk::InPlaceImageFilter);
/** Get/Set image of proton pairs. */
itkGetMacro(ProtonPairsFileName, std::string);
itkSetMacro(ProtonPairsFileName, std::string);
/** Get/Set the source position. */
itkGetMacro(SourceDistance, double);
itkSetMacro(SourceDistance, double);
/** Get/Set the most likely path type. Can be "schulte" or "polynomial" */
itkGetMacro(MostLikelyPathType, std::string);
itkSetMacro(MostLikelyPathType, std::string);
itkGetMacro(MostLikelyPathTrackerUncertainties, bool);
itkSetMacro(MostLikelyPathTrackerUncertainties, bool);
itkGetMacro(MostLikelyPathPolynomialDegree, int);
itkSetMacro(MostLikelyPathPolynomialDegree, int);
itkGetMacro(TrackerResolution, double);
itkSetMacro(TrackerResolution, double);
itkGetMacro(TrackerPairSpacing, double);
itkSetMacro(TrackerPairSpacing, double);
itkGetMacro(MaterialBudget, double);
itkSetMacro(MaterialBudget, double);
/** Get/Set the boundaries of the object. */
itkGetMacro(QuadricIn, RQIType::Pointer);
itkSetMacro(QuadricIn, RQIType::Pointer);
itkGetMacro(QuadricOut, RQIType::Pointer);
itkSetMacro(QuadricOut, RQIType::Pointer);
/** Get/Set the count of proton pairs per pixel. */
itkGetMacro(Count, CountImagePointer);
/** Get/Set the angle of proton pairs per pixel. */
itkGetMacro(Angle, AngleImagePointer);
/** Get/Set the angle of proton pairs per pixel. */
itkGetMacro(SquaredOutput, OutputImagePointer);
/** Get/Set the ionization potential used in the Bethe-Bloch equation. */
itkGetMacro(IonizationPotential, double);
itkSetMacro(IonizationPotential, double);
/** Get the beam energy. */
itkGetMacro(BeamEnergy, double);
itkSetMacro(BeamEnergy, double);
/** Convert the projection data to line integrals after pre-processing.
** Default is off. */
itkSetMacro(Robust, bool);
itkGetConstMacro(Robust, bool);
itkBooleanMacro(Robust);
/** Do the scatter projections (see Quinones et al, PMB, 2016)
** Default is off. */
itkSetMacro(ComputeScattering, bool);
itkGetConstMacro(ComputeScattering, bool);
itkBooleanMacro(ComputeScattering);
/** Compute WEPL variance per pixel in the projections
** Default is off. */
itkSetMacro(ComputeNoise, bool);
itkGetConstMacro(ComputeNoise, bool);
itkBooleanMacro(ComputeNoise);
protected:
ProtonPairsToDistanceDrivenProjection();
virtual ~ProtonPairsToDistanceDrivenProjection() {}
virtual void BeforeThreadedGenerateData() ITK_OVERRIDE;
virtual void ThreadedGenerateData( const OutputImageRegionType& outputRegionForThread, rtk::ThreadIdType threadId ) ITK_OVERRIDE;
virtual void AfterThreadedGenerateData() ITK_OVERRIDE;
/** The two inputs should not be in the same space so there is nothing
* to verify. */
virtual void VerifyInputInformation() const ITK_OVERRIDE {}
private:
ProtonPairsToDistanceDrivenProjection(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
std::string m_ProtonPairsFileName;
double m_SourceDistance;
std::string m_MostLikelyPathType;
int m_MostLikelyPathPolynomialDegree;
double m_BeamEnergy;
bool m_VariableBeamEnergy=false;
// MLP considering tracker uncertainties
bool m_MostLikelyPathTrackerUncertainties;
double m_TrackerResolution;
double m_TrackerPairSpacing;
double m_MaterialBudget;
/** Count event in each thread */
CountImagePointer m_Count;
std::vector<CountImagePointer> m_Counts;
AngleImagePointer m_Angle;
std::vector<AngleImagePointer> m_Angles;
std::vector< std::vector<float> > m_AnglesVectors;
std::mutex m_AnglesVectorsMutex;
AngleImagePointer m_AngleSq;
std::vector<AngleImagePointer> m_AnglesSq;
OutputImagePointer m_SquaredOutput;
std::vector<OutputImagePointer> m_SquaredOutputs; // NK: squared WEPL for noise projections
/** Create one output per thread */
std::vector<OutputImagePointer> m_Outputs;
// std::vector<OutputImagePointer> m_AngleOutputs; // Note NK: check these declarations. Are these members really used?
// std::vector<OutputImagePointer> m_AngleSqOutputs; // ... probably only m_Angles and m_AngleSq, declared above, are used.
/** The two quadric functions defining the object support. */
RQIType::Pointer m_QuadricIn;
RQIType::Pointer m_QuadricOut;
/** Ionization potential used in the Bethe Bloch equation */
double m_IonizationPotential;
/** The functor to convert energy loss to attenuation */
Functor::IntegratedBetheBlochProtonStoppingPowerInverse<float, double> *m_ConvFunc;
ProtonPairsImageType::Pointer m_ProtonPairs;
bool m_Robust;
bool m_ComputeScattering;
bool m_ComputeNoise;
};
} // end namespace pct
#ifndef ITK_MANUAL_INSTANTIATION
#include "pctProtonPairsToDistanceDrivenProjection.txx"
#endif
#endif