RTK  1.4.0
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 
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:
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:
160  typedef typename TInputImage::PixelType InputPixelType;
161  typedef typename TOutputImage::PixelType OutputPixelType;
162  typedef typename TOutputImage::RegionType OutputImageRegionType;
163  typedef double CoordRepType;
167 
169  itkNewMacro(Self);
170 
173 
175  TInterpolationWeightMultiplication & GetInterpolationWeightMultiplication() { return m_InterpolationWeightMultiplication; }
176  const TInterpolationWeightMultiplication & GetInterpolationWeightMultiplication() const { return m_InterpolationWeightMultiplication; }
177  void SetInterpolationWeightMultiplication(const TInterpolationWeightMultiplication & _arg)
178  {
179  if ( m_InterpolationWeightMultiplication != _arg )
180  {
181  m_InterpolationWeightMultiplication = _arg;
182  this->Modified();
183  }
184  }
186 
188  TSplatWeightMultiplication & GetSplatWeightMultiplication() { return m_SplatWeightMultiplication; }
189  const TSplatWeightMultiplication & GetSplatWeightMultiplication() const { return m_SplatWeightMultiplication; }
190  void SetSplatWeightMultiplication(const TSplatWeightMultiplication & _arg)
191  {
192  if ( m_SplatWeightMultiplication != _arg )
193  {
194  m_SplatWeightMultiplication = _arg;
195  this->Modified();
196  }
197  }
199 
201  TSumAlongRay & GetSumAlongRay() { return m_SumAlongRay; }
202  const TSumAlongRay & GetSumAlongRay() const { return m_SumAlongRay; }
203  void SetSumAlongRay(const TSumAlongRay & _arg)
204  {
205  if ( m_SumAlongRay != _arg )
206  {
207  m_SumAlongRay = _arg;
208  this->Modified();
209  }
210  }
212 
216  itkGetMacro(InferiorClip, double)
217  itkSetMacro(InferiorClip, double)
218  itkGetMacro(SuperiorClip, double)
219  itkSetMacro(SuperiorClip, double)
220 
221 protected:
223  virtual ~JosephBackProjectionImageFilter() ITK_OVERRIDE {}
224 
225  void GenerateData() ITK_OVERRIDE;
226 
229  void VerifyInputInformation() ITK_OVERRIDE {}
230 
231  inline void BilinearSplat(const InputPixelType &rayValue,
232  const double stepLengthInVoxel,
233  const double voxelSize,
234  OutputPixelType *pxiyi,
235  OutputPixelType *pxsyi,
236  OutputPixelType *pxiys,
237  OutputPixelType *pxsys,
238  const double x,
239  const double y,
240  const int ox,
241  const int oy);
242 
243  inline void BilinearSplatOnBorders(const InputPixelType &rayValue,
244  const double stepLengthInVoxel,
245  const double voxelSize,
246  OutputPixelType *pxiyi,
247  OutputPixelType *pxsyi,
248  OutputPixelType *pxiys,
249  OutputPixelType *pxsys,
250  const double x,
251  const double y,
252  const int ox,
253  const int oy,
254  const CoordRepType minx,
255  const CoordRepType miny,
256  const CoordRepType maxx,
257  const CoordRepType maxy);
258 
259  inline OutputPixelType BilinearInterpolation(const double stepLengthInVoxel,
260  const InputPixelType *pxiyi,
261  const InputPixelType *pxsyi,
262  const InputPixelType *pxiys,
263  const InputPixelType *pxsys,
264  const double x,
265  const double y,
266  const int ox,
267  const int oy);
268 
269  inline OutputPixelType BilinearInterpolationOnBorders(const double stepLengthInVoxel,
270  const InputPixelType *pxiyi,
271  const InputPixelType *pxsyi,
272  const InputPixelType *pxiys,
273  const InputPixelType *pxsys,
274  const double x,
275  const double y,
276  const int ox,
277  const int oy,
278  const double minx,
279  const double miny,
280  const double maxx,
281  const double maxy);
282 
284  TSplatWeightMultiplication m_SplatWeightMultiplication;
285  TInterpolationWeightMultiplication m_InterpolationWeightMultiplication;
286  TSumAlongRay m_SumAlongRay;
289 
290 private:
291  JosephBackProjectionImageFilter(const Self&); //purposely not implemented
292  void operator=(const Self&); //purposely not implemented
293 
294 };
295 
296 } // end namespace rtk
297 
298 #ifndef ITK_MANUAL_INSTANTIATION
299 #include "rtkJosephBackProjectionImageFilter.hxx"
300 #endif
301 
302 #endif
rtk::ThreeDCircularProjectionGeometry GeometryType
itk::Vector< CoordRepType, TInputImage::ImageDimension > VectorType
void SetInterpolationWeightMultiplication(const TInterpolationWeightMultiplication &_arg)
TInterpolationWeightMultiplication & GetInterpolationWeightMultiplication()
bool operator==(const ValueAlongRay &other) const
BackProjectionImageFilter< TInputImage, TOutputImage > Superclass
bool operator!=(const ValueAlongRay &) const
bool operator!=(const SplatWeightMultiplication &) const
bool operator==(const SplatWeightMultiplication &other) const
bool operator!=(const InterpolationWeightMultiplicationBackProjection &) const
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
TSplatWeightMultiplication & GetSplatWeightMultiplication()
TInterpolationWeightMultiplication m_InterpolationWeightMultiplication
#define itkSetMacro(name, type)