RTK  1.4.0
Reconstruction Toolkit
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  * 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 rtkJosephBackAttenuatedProjectionImageFilter_h
20 #define rtkJosephBackAttenuatedProjectionImageFilter_h
21 
22 #include "rtkConfiguration.h"
25 
26 namespace rtk
27 {
28 namespace Functor
29 {
38 template< class TInput, class TCoordRepType, class TOutput = TInput >
40 {
41 public:
43  {
45  }
46 
49  return false;
50  }
51 
53  {
54  return !( *this != other );
55  }
56 
57  inline TOutput operator()( const double stepLengthInVoxel,
58  const TCoordRepType weight,
59  const TInput *p,
60  const int i )
61  {
62  const double w = weight*stepLengthInVoxel;
63 
66  }
67 
69  TOutput * GetAttenuationPixel() {return &m_AttenuationPixel;}
70 
71 private:
74 };
75 
83 template< class TInput, class TOutput>
85 {
86 public:
88 
90  m_ex1 = 1;
91  }
92 
95  {
96  return false;
97  }
98 
100  {
101  return !( *this != other );
102  }
103 
104  inline TOutput operator()(const TInput rayValue,
105  const TInput attenuationRay,
106  const VectorType &stepInMM,
107  bool &isNewRay)
108  {
109  if(isNewRay)
110  {
111  m_ex1 = 1;
112  isNewRay =false;
113  }
114  TInput ex2 = exp(-attenuationRay*stepInMM.GetNorm() );
115  TInput wf;
116  if(*m_AttenuationPixel> 0)
117  {
118  wf = (m_ex1 - ex2)/ *m_AttenuationPixel;
119  }
120  else
121  {
122  wf = m_ex1 * stepInMM.GetNorm();
123  }
124 
125  m_ex1 = ex2 ;
126  *m_AttenuationPixel= 0;
127  return wf *rayValue;
128  }
129 
130  void SetAttenuationPixel( TInput *attenuationPixel) {m_AttenuationPixel = attenuationPixel;}
131 
132 private:
133  TInput m_ex1;
135 };
136 
145 template< class TInput, class TCoordRepType, class TOutput=TCoordRepType >
147 {
148 public:
152  {
153  return false;
154  }
155 
157  {
158  return !( *this != other );
159  }
160 
161  inline void operator()( const TInput &rayValue,
162  TOutput &output,
163  const double stepLengthInVoxel,
164  const double itkNotUsed(voxelSize),
165  const TCoordRepType weight) const
166  {
167  output += rayValue * weight * stepLengthInVoxel;
168  }
169 };
170 } // end namespace Functor
171 
186 template <class TInputImage,
187  class TOutputImage,
191  >
193  public JosephBackProjectionImageFilter<TInputImage,TOutputImage,TInterpolationWeightMultiplication, TSplatWeightMultiplication, TSumAlongRay>
194 {
195 public:
201  typedef typename TInputImage::PixelType InputPixelType;
202  typedef typename TOutputImage::PixelType OutputPixelType;
203  typedef typename TOutputImage::RegionType OutputImageRegionType;
204  typedef double CoordRepType;
208 
210  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
211 
213  itkNewMacro(Self);
214 
217 
218 protected:
221 
223  void GenerateInputRequestedRegion() ITK_OVERRIDE;
224 
227 #if ITK_VERSION_MAJOR<5
228  void VerifyInputInformation() ITK_OVERRIDE;
229 #else
230  void VerifyInputInformation() const ITK_OVERRIDE;
231 #endif
232 
233 
234  void GenerateData() ITK_OVERRIDE;
235 
236  void Init();
237 
238 private:
239  JosephBackAttenuatedProjectionImageFilter(const Self&); //purposely not implemented
240  void operator=(const Self&); //purposely not implemented
241 
242 };
243 } // end namespace rtk
244 
245 #ifndef ITK_MANUAL_INSTANTIATION
246 #include "rtkJosephBackAttenuatedProjectionImageFilter.hxx"
247 #endif
248 
249 #endif
Function to multiply the interpolation weights with the projected volume values and attenuation map...
bool operator!=(const InterpolationWeightMultiplicationAttenuatedBackProjection &) const
TOutput operator()(const double stepLengthInVoxel, const TCoordRepType weight, const TInput *p, const int i)
TOutput operator()(const TInput rayValue, const TInput attenuationRay, const VectorType &stepInMM, bool &isNewRay)
Projection geometry for a source and a 2-D flat panel.
bool operator!=(const ComputeAttenuationCorrectionBackProjection &) const
Function to compute the attenuation correction on the projection.
bool operator==(const InterpolationWeightMultiplicationAttenuatedBackProjection &other) const
bool operator==(const SplatWeightMultiplicationAttenuated &other) const
void operator()(const TInput &rayValue, TOutput &output, const double stepLengthInVoxel, const double, const TCoordRepType weight) const
bool operator==(const ComputeAttenuationCorrectionBackProjection &other) const
itk::Vector< CoordRepType, TInputImage::ImageDimension > VectorType
Function to multiply the interpolation weights with the projection values.
JosephBackProjectionImageFilter< TInputImage, TOutputImage, TInterpolationWeightMultiplication, TSplatWeightMultiplication, TSumAlongRay > Superclass
bool operator!=(const SplatWeightMultiplicationAttenuated &) const