RTK  2.5.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 {
133 template <typename TOutputImage,
134  typename TGradientOutputImage =
136  TOutputImage::ImageDimension>>
138  : public rtk::IterativeConeBeamReconstructionFilter<TOutputImage, TOutputImage>
139 {
140 public:
141  ITK_DISALLOW_COPY_AND_MOVE(ADMMTotalVariationConeBeamReconstructionFilter);
142 
147 
148  using ForwardProjectionType = typename Superclass::ForwardProjectionType;
149  using BackProjectionType = typename Superclass::BackProjectionType;
150 
152  itkNewMacro(Self);
153 
155 #ifdef itkOverrideGetNameOfClassMacro
156  itkOverrideGetNameOfClassMacro(ADMMTotalVariationConeBeamReconstructionFilter);
157 #else
159 #endif
160 
161 
168  typename TOutputImage::ValueType,
169  typename TOutputImage::ValueType,
170  TGradientOutputImage>;
174  using AddGradientsFilterType = itk::AddImageFilter<TGradientOutputImage>;
181 
183  itkSetObjectMacro(Geometry, ThreeDCircularProjectionGeometry);
184 
186  void
187  SetBetaForCurrentIteration(int iter);
188 
190  void
191  SetGatingWeights(std::vector<float> weights);
192 
193  itkSetMacro(Alpha, float);
194  itkGetMacro(Alpha, float);
195 
196  itkSetMacro(Beta, float);
197  itkGetMacro(Beta, float);
198 
199  itkSetMacro(AL_iterations, float);
200  itkGetMacro(AL_iterations, float);
201 
202  itkSetMacro(CG_iterations, float);
203  itkGetMacro(CG_iterations, float);
204 
206  itkSetMacro(DisableDisplacedDetectorFilter, bool);
207  itkGetMacro(DisableDisplacedDetectorFilter, bool);
209 
210 protected:
213 
215  void
216  VerifyPreconditions() ITKv5_CONST override;
217 
219  void
220  GenerateData() override;
221 
223  typename SubtractGradientsFilterType::Pointer m_SubtractFilter1;
224  typename SubtractGradientsFilterType::Pointer m_SubtractFilter2;
225  typename MultiplyVolumeFilterType::Pointer m_MultiplyFilter;
226  typename MultiplyVolumeFilterType::Pointer m_ZeroMultiplyVolumeFilter;
227  typename MultiplyGradientFilterType::Pointer m_ZeroMultiplyGradientFilter;
228  typename ImageGradientFilterType::Pointer m_GradientFilter1;
229  typename ImageGradientFilterType::Pointer m_GradientFilter2;
230  typename SubtractVolumeFilterType::Pointer m_SubtractVolumeFilter;
231  typename AddGradientsFilterType::Pointer m_AddGradientsFilter;
232  typename ImageDivergenceFilterType::Pointer m_DivergenceFilter;
233  typename ConjugateGradientFilterType::Pointer m_ConjugateGradientFilter;
234  typename SoftThresholdTVFilterType::Pointer m_SoftThresholdFilter;
235  typename CGOperatorFilterType::Pointer m_CGOperator;
236  typename ForwardProjectionImageFilter<TOutputImage, TOutputImage>::Pointer m_ForwardProjectionFilter;
237  typename BackProjectionImageFilter<TOutputImage, TOutputImage>::Pointer m_BackProjectionFilterForConjugateGradient;
238  typename BackProjectionImageFilter<TOutputImage, TOutputImage>::Pointer m_BackProjectionFilter;
239  typename DisplacedDetectorFilterType::Pointer m_DisplacedDetectorFilter;
240  typename GatingWeightsFilterType::Pointer m_GatingWeightsFilter;
241 
245  void
246  VerifyInputInformation() const override
247  {}
248 
251  void
252  GenerateInputRequestedRegion() override;
253  void
254  GenerateOutputInformation() override;
256 
259  bool m_IsGated;
260  std::vector<float> m_GatingWeights;
262 
263 private:
264  float m_Alpha;
265  float m_Beta;
266  unsigned int m_AL_iterations;
267  unsigned int m_CG_iterations;
268 
270 };
271 } // namespace rtk
272 
273 
274 #ifndef ITK_MANUAL_INSTANTIATION
275 # include "rtkADMMTotalVariationConeBeamReconstructionFilter.hxx"
276 #endif
277 
278 #endif
rtk::SoftThresholdTVImageFilter< TGradientOutputImage > SoftThresholdTVFilterType
Weigting for displaced detectors.
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...
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.