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 #if ITK_VERSION_MAJOR<5
230  void VerifyInputInformation() ITK_OVERRIDE {}
231 #else
232  void VerifyInputInformation() const ITK_OVERRIDE {}
233 #endif
234 
235 
236  inline void BilinearSplat(const InputPixelType &rayValue,
237  const double stepLengthInVoxel,
238  const double voxelSize,
239  OutputPixelType *pxiyi,
240  OutputPixelType *pxsyi,
241  OutputPixelType *pxiys,
242  OutputPixelType *pxsys,
243  const double x,
244  const double y,
245  const int ox,
246  const int oy);
247 
248  inline void BilinearSplatOnBorders(const InputPixelType &rayValue,
249  const double stepLengthInVoxel,
250  const double voxelSize,
251  OutputPixelType *pxiyi,
252  OutputPixelType *pxsyi,
253  OutputPixelType *pxiys,
254  OutputPixelType *pxsys,
255  const double x,
256  const double y,
257  const int ox,
258  const int oy,
259  const CoordRepType minx,
260  const CoordRepType miny,
261  const CoordRepType maxx,
262  const CoordRepType maxy);
263 
264  inline OutputPixelType BilinearInterpolation(const double stepLengthInVoxel,
265  const InputPixelType *pxiyi,
266  const InputPixelType *pxsyi,
267  const InputPixelType *pxiys,
268  const InputPixelType *pxsys,
269  const double x,
270  const double y,
271  const int ox,
272  const int oy);
273 
274  inline OutputPixelType BilinearInterpolationOnBorders(const double stepLengthInVoxel,
275  const InputPixelType *pxiyi,
276  const InputPixelType *pxsyi,
277  const InputPixelType *pxiys,
278  const InputPixelType *pxsys,
279  const double x,
280  const double y,
281  const int ox,
282  const int oy,
283  const double minx,
284  const double miny,
285  const double maxx,
286  const double maxy);
287 
289  TSplatWeightMultiplication m_SplatWeightMultiplication;
290  TInterpolationWeightMultiplication m_InterpolationWeightMultiplication;
291  TSumAlongRay m_SumAlongRay;
294 
295 private:
296  JosephBackProjectionImageFilter(const Self&); //purposely not implemented
297  void operator=(const Self&); //purposely not implemented
298 
299 };
300 
301 } // end namespace rtk
302 
303 #ifndef ITK_MANUAL_INSTANTIATION
304 #include "rtkJosephBackProjectionImageFilter.hxx"
305 #endif
306 
307 #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)