ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
rtkJosephBackProjectionImageFilter.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 rtkJosephBackProjectionImageFilter_h
20#define rtkJosephBackProjectionImageFilter_h
21
22#include "rtkConfiguration.h"
25
26#include <itkVectorImage.h>
27
28namespace rtk
29{
30namespace Functor
31{
40template <class TInput, class TCoordinateType, class TOutput = TInput>
42{
43public:
46 bool
48 {
49 return false;
50 }
51 bool
53 {
54 return !(*this != other);
55 }
56
57 TOutput
58 operator()(const double itkNotUsed(stepLengthInVoxel),
59 const TCoordinateType itkNotUsed(weight),
60 const TInput * itkNotUsed(p),
61 const ptrdiff_t itkNotUsed(i)) const
62 {
63 return {};
64 }
65};
66
74template <class TInput, class TOutput>
75class ITK_TEMPLATE_EXPORT ValueAlongRay
76{
77public:
79
80 ValueAlongRay() = default;
81 ~ValueAlongRay() = default;
82 bool
84 {
85 return false;
86 }
87 bool
88 operator==(const ValueAlongRay & other) const
89 {
90 return !(*this != other);
91 }
92
93 const TOutput &
94 operator()(const TInput & rayValue,
95 const TInput itkNotUsed(attenuationRay),
96 const VectorType & itkNotUsed(stepInMM),
97 bool itkNotUsed(isEndRay)) const
98 {
99 return rayValue;
100 }
101};
102
110template <class TInput, class TCoordinateType, class TOutput = TCoordinateType>
111class ITK_TEMPLATE_EXPORT SplatWeightMultiplication
112{
113public:
116 bool
118 {
119 return false;
120 }
121 bool
123 {
124 return !(*this != other);
125 }
126
127 void
128 operator()(const TInput & rayValue,
129 TOutput & output,
130 const double stepLengthInVoxel,
131 const double voxelSize,
132 const TCoordinateType weight) const
133 {
134 output += rayValue * weight * voxelSize * stepLengthInVoxel;
135 }
136};
137
138} // end namespace Functor
139
140
154
155template <
156 class TInputImage,
157 class TOutputImage,
158 class TInterpolationWeightMultiplication = Functor::InterpolationWeightMultiplicationBackProjection<
159 typename TInputImage::PixelType,
161 class TSplatWeightMultiplication =
162 Functor::SplatWeightMultiplication<typename TInputImage::PixelType, double, typename TOutputImage::PixelType>,
163 class TSumAlongRay = Functor::ValueAlongRay<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
164class ITK_TEMPLATE_EXPORT JosephBackProjectionImageFilter : public BackProjectionImageFilter<TInputImage, TOutputImage>
165{
166public:
167 ITK_DISALLOW_COPY_AND_MOVE(JosephBackProjectionImageFilter);
168
174 using InputPixelType = typename TInputImage::PixelType;
175 using OutputPixelType = typename TOutputImage::PixelType;
176 using OutputImageRegionType = typename TOutputImage::RegionType;
177 using CoordinateType = double;
181
183 itkNewMacro(Self);
184
186 itkOverrideGetNameOfClassMacro(JosephBackProjectionImageFilter);
187
189 TInterpolationWeightMultiplication &
194 const TInterpolationWeightMultiplication &
199 void
200 SetInterpolationWeightMultiplication(const TInterpolationWeightMultiplication & _arg)
201 {
203 {
205 this->Modified();
206 }
207 }
208
210 TSplatWeightMultiplication &
215 const TSplatWeightMultiplication &
220 void
221 SetSplatWeightMultiplication(const TSplatWeightMultiplication & _arg)
222 {
223 if (m_SplatWeightMultiplication != _arg)
224 {
226 this->Modified();
227 }
228 }
229
231 TSumAlongRay &
233 {
234 return m_SumAlongRay;
235 }
236 const TSumAlongRay &
238 {
239 return m_SumAlongRay;
240 }
241 void
242 SetSumAlongRay(const TSumAlongRay & _arg)
243 {
244 if (m_SumAlongRay != _arg)
245 {
246 m_SumAlongRay = _arg;
247 this->Modified();
248 }
249 }
250
254 itkGetMacro(InferiorClip, double);
255 itkSetMacro(InferiorClip, double);
256 itkGetMacro(SuperiorClip, double);
257 itkSetMacro(SuperiorClip, double);
258
259protected:
262
263 void
264 GenerateData() override;
265
268 void
269 VerifyInputInformation() const override
270 {}
271
272 inline void
274 double stepLengthInVoxel,
275 double voxelSize,
276 OutputPixelType * pxiyi,
277 OutputPixelType * pxsyi,
278 OutputPixelType * pxiys,
279 OutputPixelType * pxsys,
280 double x,
281 double y,
282 ptrdiff_t ox,
283 ptrdiff_t oy);
284
285 inline void
287 double stepLengthInVoxel,
288 double voxelSize,
289 OutputPixelType * pxiyi,
290 OutputPixelType * pxsyi,
291 OutputPixelType * pxiys,
292 OutputPixelType * pxsys,
293 double x,
294 double y,
295 ptrdiff_t ox,
296 ptrdiff_t oy,
297 CoordinateType minx,
298 CoordinateType miny,
299 CoordinateType maxx,
300 CoordinateType maxy);
301
302 inline OutputPixelType
303 BilinearInterpolation(double stepLengthInVoxel,
304 const InputPixelType * pxiyi,
305 const InputPixelType * pxsyi,
306 const InputPixelType * pxiys,
307 const InputPixelType * pxsys,
308 double x,
309 double y,
310 ptrdiff_t ox,
311 ptrdiff_t oy);
312
313 inline OutputPixelType
314 BilinearInterpolationOnBorders(double stepLengthInVoxel,
315 const InputPixelType * pxiyi,
316 const InputPixelType * pxsyi,
317 const InputPixelType * pxiys,
318 const InputPixelType * pxsys,
319 double x,
320 double y,
321 ptrdiff_t ox,
322 ptrdiff_t oy,
323 double minx,
324 double miny,
325 double maxx,
326 double maxy);
327
329 TSplatWeightMultiplication m_SplatWeightMultiplication;
330 TInterpolationWeightMultiplication m_InterpolationWeightMultiplication;
331 TSumAlongRay m_SumAlongRay;
332 double m_InferiorClip{ 0. };
333 double m_SuperiorClip{ 1. };
334};
335
336} // end namespace rtk
337
338#ifndef ITK_MANUAL_INSTANTIATION
339# include "rtkJosephBackProjectionImageFilter.hxx"
340#endif
341
342#endif
virtual void Modified() const
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
bool operator==(const InterpolationWeightMultiplicationBackProjection &other) const
TOutput operator()(const double stepLengthInVoxel, const TCoordinateType weight, const TInput *p, const ptrdiff_t i) const
bool operator!=(const InterpolationWeightMultiplicationBackProjection &) const
bool operator!=(const SplatWeightMultiplication &) const
void operator()(const TInput &rayValue, TOutput &output, const double stepLengthInVoxel, const double voxelSize, const TCoordinateType weight) const
bool operator==(const SplatWeightMultiplication &other) const
const TOutput & operator()(const TInput &rayValue, const TInput attenuationRay, const VectorType &stepInMM, bool isEndRay) const
bool operator!=(const ValueAlongRay &) const
bool operator==(const ValueAlongRay &other) const
void BilinearSplatOnBorders(const InputPixelType &rayValue, double stepLengthInVoxel, double voxelSize, OutputPixelType *pxiyi, OutputPixelType *pxsyi, OutputPixelType *pxiys, OutputPixelType *pxsys, double x, double y, ptrdiff_t ox, ptrdiff_t oy, CoordinateType minx, CoordinateType miny, CoordinateType maxx, CoordinateType maxy)
OutputPixelType BilinearInterpolationOnBorders(double stepLengthInVoxel, const InputPixelType *pxiyi, const InputPixelType *pxsyi, const InputPixelType *pxiys, const InputPixelType *pxsys, double x, double y, ptrdiff_t ox, ptrdiff_t oy, double minx, double miny, double maxx, double maxy)
const TSplatWeightMultiplication & GetSplatWeightMultiplication() const
void SetSplatWeightMultiplication(const TSplatWeightMultiplication &_arg)
TInterpolationWeightMultiplication & GetInterpolationWeightMultiplication()
void BilinearSplat(const InputPixelType &rayValue, double stepLengthInVoxel, double voxelSize, OutputPixelType *pxiyi, OutputPixelType *pxsyi, OutputPixelType *pxiys, OutputPixelType *pxsys, double x, double y, ptrdiff_t ox, ptrdiff_t oy)
const TInterpolationWeightMultiplication & GetInterpolationWeightMultiplication() const
~JosephBackProjectionImageFilter() override=default
void SetInterpolationWeightMultiplication(const TInterpolationWeightMultiplication &_arg)
OutputPixelType BilinearInterpolation(double stepLengthInVoxel, const InputPixelType *pxiyi, const InputPixelType *pxsyi, const InputPixelType *pxiys, const InputPixelType *pxsys, double x, double y, ptrdiff_t ox, ptrdiff_t oy)
Projection geometry for a source and a 2-D flat panel.
#define itkSetMacro(name, type)