RTK  2.0.1
Reconstruction Toolkit
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  * http://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 
28 namespace rtk
29 {
30 namespace Functor
31 {
40 template< class TInput, class TCoordRepType, class TOutput=TInput >
42 {
43 public:
47  return false;
48  }
50  {
51  return !( *this != other );
52  }
53 
54  inline int operator()(const double itkNotUsed(stepLengthInVoxel),
55  const TCoordRepType itkNotUsed(weight),
56  const TInput *itkNotUsed(p),
57  const int itkNotUsed(i) ) const
58  {
59  return 0;
60  }
61 };
62 
70 template< class TInput, class TOutput>
72 {
73 public:
75 
76  ValueAlongRay()= default;
77  ~ValueAlongRay() = default;
78  bool operator!=( const ValueAlongRay & ) const
79  {
80  return false;
81  }
82  bool operator==(const ValueAlongRay & other) const
83  {
84  return !( *this != other );
85  }
86 
87  inline const TOutput & operator()(const TInput &rayValue,
88  const TInput itkNotUsed(attenuationRay),
89  const VectorType &itkNotUsed(stepInMM),
90  bool itkNotUsed(isEndRay)) const
91  {
92  return rayValue;
93  }
94 };
103 template< class TInput, class TCoordRepType, class TOutput=TCoordRepType >
105 {
106 public:
107  SplatWeightMultiplication() = default;
108  ~SplatWeightMultiplication() = default;
109  bool operator!=( const SplatWeightMultiplication & ) const
110  {
111  return false;
112  }
113  bool operator==(const SplatWeightMultiplication & other) const
114  {
115  return !( *this != other );
116  }
117 
118  inline void operator()( const TInput &rayValue,
119  TOutput &output,
120  const double stepLengthInVoxel,
121  const double voxelSize,
122  const TCoordRepType weight) const
123  {
124  output += rayValue * weight * voxelSize * stepLengthInVoxel;
125  }
126 };
127 
128 } // end namespace Functor
129 
130 
145 template <class TInputImage,
146  class TOutputImage,
150  >
152  public BackProjectionImageFilter<TInputImage,TOutputImage>
153 {
154 public:
155  ITK_DISALLOW_COPY_AND_ASSIGN(JosephBackProjectionImageFilter);
156 
162  using InputPixelType = typename TInputImage::PixelType;
163  using OutputPixelType = typename TOutputImage::PixelType;
164  using OutputImageRegionType = typename TOutputImage::RegionType;
165  using CoordRepType = double;
169 
171  itkNewMacro(Self);
172 
175 
177  TInterpolationWeightMultiplication & GetInterpolationWeightMultiplication() { return m_InterpolationWeightMultiplication; }
178  const TInterpolationWeightMultiplication & GetInterpolationWeightMultiplication() const { return m_InterpolationWeightMultiplication; }
179  void SetInterpolationWeightMultiplication(const TInterpolationWeightMultiplication & _arg)
180  {
181  if ( m_InterpolationWeightMultiplication != _arg )
182  {
183  m_InterpolationWeightMultiplication = _arg;
184  this->Modified();
185  }
186  }
188 
190  TSplatWeightMultiplication & GetSplatWeightMultiplication() { return m_SplatWeightMultiplication; }
191  const TSplatWeightMultiplication & GetSplatWeightMultiplication() const { return m_SplatWeightMultiplication; }
192  void SetSplatWeightMultiplication(const TSplatWeightMultiplication & _arg)
193  {
194  if ( m_SplatWeightMultiplication != _arg )
195  {
196  m_SplatWeightMultiplication = _arg;
197  this->Modified();
198  }
199  }
201 
203  TSumAlongRay & GetSumAlongRay() { return m_SumAlongRay; }
204  const TSumAlongRay & GetSumAlongRay() const { return m_SumAlongRay; }
205  void SetSumAlongRay(const TSumAlongRay & _arg)
206  {
207  if ( m_SumAlongRay != _arg )
208  {
209  m_SumAlongRay = _arg;
210  this->Modified();
211  }
212  }
214 
218  itkGetMacro(InferiorClip, double)
219  itkSetMacro(InferiorClip, double)
220  itkGetMacro(SuperiorClip, double)
221  itkSetMacro(SuperiorClip, double)
222 
223 protected:
225  ~JosephBackProjectionImageFilter() override = default;
226 
227  void GenerateData() override;
228 
231 #if ITK_VERSION_MAJOR<5
232  void VerifyInputInformation() override {}
233 #else
234  void VerifyInputInformation() const override {}
235 #endif
236 
237 
238  inline void BilinearSplat(const InputPixelType &rayValue,
239  const double stepLengthInVoxel,
240  const double voxelSize,
241  OutputPixelType *pxiyi,
242  OutputPixelType *pxsyi,
243  OutputPixelType *pxiys,
244  OutputPixelType *pxsys,
245  const double x,
246  const double y,
247  const int ox,
248  const int oy);
249 
250  inline void BilinearSplatOnBorders(const InputPixelType &rayValue,
251  const double stepLengthInVoxel,
252  const double voxelSize,
253  OutputPixelType *pxiyi,
254  OutputPixelType *pxsyi,
255  OutputPixelType *pxiys,
256  OutputPixelType *pxsys,
257  const double x,
258  const double y,
259  const int ox,
260  const int oy,
261  const CoordRepType minx,
262  const CoordRepType miny,
263  const CoordRepType maxx,
264  const CoordRepType maxy);
265 
266  inline OutputPixelType BilinearInterpolation(const double stepLengthInVoxel,
267  const InputPixelType *pxiyi,
268  const InputPixelType *pxsyi,
269  const InputPixelType *pxiys,
270  const InputPixelType *pxsys,
271  const double x,
272  const double y,
273  const int ox,
274  const int oy);
275 
276  inline OutputPixelType BilinearInterpolationOnBorders(const double stepLengthInVoxel,
277  const InputPixelType *pxiyi,
278  const InputPixelType *pxsyi,
279  const InputPixelType *pxiys,
280  const InputPixelType *pxsys,
281  const double x,
282  const double y,
283  const int ox,
284  const int oy,
285  const double minx,
286  const double miny,
287  const double maxx,
288  const double maxy);
289 
291  TSplatWeightMultiplication m_SplatWeightMultiplication;
292  TInterpolationWeightMultiplication m_InterpolationWeightMultiplication;
293  TSumAlongRay m_SumAlongRay;
294  double m_InferiorClip{0.};
295  double m_SuperiorClip{1.};
296 
297 };
298 
299 } // end namespace rtk
300 
301 #ifndef ITK_MANUAL_INSTANTIATION
302 #include "rtkJosephBackProjectionImageFilter.hxx"
303 #endif
304 
305 #endif
void SetInterpolationWeightMultiplication(const TInterpolationWeightMultiplication &_arg)
TInterpolationWeightMultiplication & GetInterpolationWeightMultiplication()
bool operator==(const ValueAlongRay &other) const
bool operator!=(const ValueAlongRay &) const
bool operator!=(const SplatWeightMultiplication &) const
bool operator==(const SplatWeightMultiplication &other) const
bool operator!=(const InterpolationWeightMultiplicationBackProjection &) const
typename TInputImage::PixelType InputPixelType
bool operator==(const InterpolationWeightMultiplicationBackProjection &other) const
void operator()(const TInput &rayValue, TOutput &output, const double stepLengthInVoxel, const double voxelSize, const TCoordRepType weight) const
void SetSplatWeightMultiplication(const TSplatWeightMultiplication &_arg)
const TOutput & operator()(const TInput &rayValue, const TInput, const VectorType &, bool) const
Projection geometry for a source and a 2-D flat panel.
Function to multiply the interpolation weights with the projected volume values.
const TInterpolationWeightMultiplication & GetInterpolationWeightMultiplication() const
int operator()(const double, const TCoordRepType, const TInput *, const int) const
Function to multiply the interpolation weights with the projection values.
const TSplatWeightMultiplication & GetSplatWeightMultiplication() const
typename TOutputImage::RegionType OutputImageRegionType
TSplatWeightMultiplication & GetSplatWeightMultiplication()
TInterpolationWeightMultiplication m_InterpolationWeightMultiplication
#define itkSetMacro(name, type)