ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
rtkJosephBackAttenuatedProjectionImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright RTK Consortium
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18
19#ifndef rtkJosephBackAttenuatedProjectionImageFilter_h
20#define rtkJosephBackAttenuatedProjectionImageFilter_h
21
22#include "rtkConfiguration.h"
25
26namespace rtk
27{
28namespace Functor
29{
38template <class TInput, class TCoordinateType, class TOutput = TInput>
40{
41public:
43
45 bool
50
51 bool
53 {
54 return !(*this != other);
55 }
56
57 TOutput
58 operator()(const double stepLengthInVoxel, const TCoordinateType weight, const TInput * p, const ptrdiff_t i)
59 {
60 const double w = weight * stepLengthInVoxel;
61
63 return w * (p + m_AttenuationMinusEmissionMapsPtrDiff)[i];
64 }
65
66 void
71 TOutput *
73 {
74 return &m_AttenuationPixel;
75 }
76
77private:
80};
81
89template <class TInput, class TOutput>
91{
92public:
94
96
98 bool
100 {
101 return false;
102 }
103
104 bool
106 {
107 return !(*this != other);
108 }
109
110 TOutput
111 operator()(const TInput rayValue, const TInput attenuationRay, const VectorType & stepInMM, bool & isNewRay)
112 {
113 if (isNewRay)
114 {
115 m_Ex1 = 1;
116 isNewRay = false;
117 }
118 TInput ex2 = exp(-attenuationRay * stepInMM.GetNorm());
119 TInput wf;
120 if (*m_AttenuationPixel > 0)
121 {
122 wf = (m_Ex1 - ex2) / *m_AttenuationPixel;
123 }
124 else
125 {
126 wf = m_Ex1 * stepInMM.GetNorm();
127 }
128
129 m_Ex1 = ex2;
131 return wf * rayValue;
132 }
133
134 void
135 SetAttenuationPixel(TInput * attenuationPixel)
136 {
137 m_AttenuationPixel = attenuationPixel;
138 }
139
140private:
141 TInput m_Ex1;
143};
144
153template <class TInput, class TCoordinateType, class TOutput = TCoordinateType>
154class ITK_TEMPLATE_EXPORT SplatWeightMultiplicationAttenuated
155{
156public:
159 bool
161 {
162 return false;
163 }
164
165 bool
167 {
168 return !(*this != other);
169 }
170
171 void
172 operator()(const TInput & rayValue,
173 TOutput & output,
174 const double stepLengthInVoxel,
175 const double itkNotUsed(voxelSize),
176 const TCoordinateType weight) const
177 {
178 output += rayValue * weight * stepLengthInVoxel;
179 }
180};
181} // end namespace Functor
182
196
197template <
198 class TInputImage,
199 class TOutputImage,
200 class TInterpolationWeightMultiplication = Functor::InterpolationWeightMultiplicationAttenuatedBackProjection<
201 typename TInputImage::PixelType,
203 class TSplatWeightMultiplication = Functor::
204 SplatWeightMultiplicationAttenuated<typename TInputImage::PixelType, double, typename TOutputImage::PixelType>,
205 class TSumAlongRay = Functor::ComputeAttenuationCorrectionBackProjection<typename TInputImage::PixelType,
206 typename TOutputImage::PixelType>>
208 : public JosephBackProjectionImageFilter<TInputImage,
209 TOutputImage,
210 TInterpolationWeightMultiplication,
211 TSplatWeightMultiplication,
212 TSumAlongRay>
213{
214public:
215 ITK_DISALLOW_COPY_AND_MOVE(JosephBackAttenuatedProjectionImageFilter);
216
220 TOutputImage,
221 TInterpolationWeightMultiplication,
222 TSplatWeightMultiplication,
223 TSumAlongRay>;
226 using InputPixelType = typename TInputImage::PixelType;
227 using OutputPixelType = typename TOutputImage::PixelType;
228 using OutputImageRegionType = typename TOutputImage::RegionType;
229 using CoordinateType = double;
233
235 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
236
238 itkNewMacro(Self);
239
241 itkOverrideGetNameOfClassMacro(JosephBackAttenuatedProjectionImageFilter);
242
243protected:
246
248 void
250
253 void
254 VerifyInputInformation() const override;
255
256 void
257 GenerateData() override;
258
259 void
261};
262} // end namespace rtk
263
264#ifndef ITK_MANUAL_INSTANTIATION
265# include "rtkJosephBackAttenuatedProjectionImageFilter.hxx"
266#endif
267
268#endif
Traits for a pixel that define the dimension and component type.
Implements transparent reference counting.
A templated class holding a n-Dimensional vector.
Definition itkVector.h:63
RealValueType GetNorm() const
bool operator!=(const ComputeAttenuationCorrectionBackProjection &) const
bool operator==(const ComputeAttenuationCorrectionBackProjection &other) const
TOutput operator()(const TInput rayValue, const TInput attenuationRay, const VectorType &stepInMM, bool &isNewRay)
bool operator!=(const InterpolationWeightMultiplicationAttenuatedBackProjection &) const
bool operator==(const InterpolationWeightMultiplicationAttenuatedBackProjection &other) const
TOutput operator()(const double stepLengthInVoxel, const TCoordinateType weight, const TInput *p, const ptrdiff_t i)
void operator()(const TInput &rayValue, TOutput &output, const double stepLengthInVoxel, const double voxelSize, const TCoordinateType weight) const
bool operator==(const SplatWeightMultiplicationAttenuated &other) const
bool operator!=(const SplatWeightMultiplicationAttenuated &) const
JosephBackProjectionImageFilter< TInputImage, TOutputImage, TInterpolationWeightMultiplication, TSplatWeightMultiplication, TSumAlongRay > Superclass
itk::Vector< CoordinateType, TInputImage::ImageDimension > VectorType
~JosephBackAttenuatedProjectionImageFilter() override=default
Projection geometry for a source and a 2-D flat panel.