RTK  2.7.0
Reconstruction Toolkit
rtkADMMTotalVariationConeBeamReconstructionFilter.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 rtkADMMTotalVariationConeBeamReconstructionFilter_h
20 #define rtkADMMTotalVariationConeBeamReconstructionFilter_h
21 
22 #include <itkImageToImageFilter.h>
23 #include <itkAddImageFilter.h>
24 #include <itkSubtractImageFilter.h>
25 #include <itkMultiplyImageFilter.h>
26 
34 
35 namespace rtk
36 {
134 template <typename TOutputImage>
136  : public rtk::IterativeConeBeamReconstructionFilter<TOutputImage, TOutputImage>
137 {
138 public:
139  ITK_DISALLOW_COPY_AND_MOVE(ADMMTotalVariationConeBeamReconstructionFilter);
140 
145 
146  using ForwardProjectionType = typename Superclass::ForwardProjectionType;
147  using BackProjectionType = typename Superclass::BackProjectionType;
148 
150  itkNewMacro(Self);
151 
153  itkOverrideGetNameOfClassMacro(ADMMTotalVariationConeBeamReconstructionFilter);
154 
162 #ifdef RTK_USE_CUDA
163  typedef
164  typename std::conditional<std::is_same<TOutputImage, CPUImageType>::value,
166  itk::CudaImage<VectorPixelType, TOutputImage::ImageDimension>>::type GradientImageType;
167 #else
169 #endif
171  typename TOutputImage::ValueType,
172  typename TOutputImage::ValueType,
184 
186  itkSetObjectMacro(Geometry, ThreeDCircularProjectionGeometry);
187 
189  void
190  SetBetaForCurrentIteration(int iter);
191 
193  void
194  SetGatingWeights(std::vector<float> weights);
195 
196  itkSetMacro(Alpha, float);
197  itkGetMacro(Alpha, float);
198 
199  itkSetMacro(Beta, float);
200  itkGetMacro(Beta, float);
201 
202  itkSetMacro(AL_iterations, float);
203  itkGetMacro(AL_iterations, float);
204 
205  itkSetMacro(CG_iterations, float);
206  itkGetMacro(CG_iterations, float);
207 
209  itkSetMacro(DisableDisplacedDetectorFilter, bool);
210  itkGetMacro(DisableDisplacedDetectorFilter, bool);
212 
213 protected:
216 
218  void
219  VerifyPreconditions() const override;
220 
222  void
223  GenerateData() override;
224 
244 
248  void
249  VerifyInputInformation() const override
250  {}
251 
254  void
255  GenerateInputRequestedRegion() override;
256  void
257  GenerateOutputInformation() override;
259 
262  bool m_IsGated;
263  std::vector<float> m_GatingWeights;
265 
266 private:
267  float m_Alpha;
268  float m_Beta;
269  unsigned int m_AL_iterations;
270  unsigned int m_CG_iterations;
271 
273 };
274 } // namespace rtk
275 
276 
277 #ifndef ITK_MANUAL_INSTANTIATION
278 # include "rtkADMMTotalVariationConeBeamReconstructionFilter.hxx"
279 #endif
280 
281 #endif
std::conditional< std::is_same< TOutputImage, CPUImageType >::value, itk::Image< VectorPixelType, TOutputImage::ImageDimension >, itk::CudaImage< VectorPixelType, TOutputImage::ImageDimension > >::type GradientImageType
ForwardProjectionImageFilter< TOutputImage, TOutputImage >::Pointer m_ForwardProjectionFilter
BackProjectionImageFilter< TOutputImage, TOutputImage >::Pointer m_BackProjectionFilter
Weigting for displaced detectors.
BackProjectionImageFilter< TOutputImage, TOutputImage >::Pointer m_BackProjectionFilterForConjugateGradient
Projection geometry for a source and a 2-D flat panel.
#define itkSetMacro(name, type)
Computes the gradient of an image using forward difference.
Implements the operator A used in the conjugate gradient step of ADMM reconstruction with total varia...
Multiplies each (n-1) dimension image by the corresponding element in a vector.
Mother class for cone beam reconstruction filters which need runtime selection of their forward and b...
rtk::SoftThresholdTVImageFilter< GradientImageType > SoftThresholdTVFilterType
Computes the Total Variation from a gradient input image (pixels are vectors), soft thresholds it...
Computes the backward differences divergence (adjoint of the forward differences gradient) of the inp...
Implements the ADMM reconstruction with total variation regularization.
Solves AX = B by conjugate gradient.