RTK  2.6.0
Reconstruction Toolkit
rtkRegularizedConjugateGradientConeBeamReconstructionFilter.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 #ifndef rtkRegularizedConjugateGradientConeBeamReconstructionFilter_h
19 #define rtkRegularizedConjugateGradientConeBeamReconstructionFilter_h
20 
22 #ifdef RTK_USE_CUDA
24 #else
26 #endif
28 
30 
31 namespace rtk
32 {
106 template <typename TImage>
108  : public rtk::IterativeConeBeamReconstructionFilter<TImage, TImage>
109 {
110 public:
112 
118 
119 #ifdef RTK_USE_CUDA
120  using GradientImageType = itk::CudaImage<CovariantVectorForSpatialGradient, TImage::ImageDimension>;
121 #else
123 #endif
124 
125  using ForwardProjectionType = typename Superclass::ForwardProjectionType;
126  using BackProjectionType = typename Superclass::BackProjectionType;
127 
129  itkNewMacro(Self);
130 
132 #ifdef itkOverrideGetNameOfClassMacro
133  itkOverrideGetNameOfClassMacro(RegularizedConjugateGradientConeBeamReconstructionFilter);
134 #else
136 #endif
137 
138 
140  void
141  SetInputVolume(const TImage * Volume);
142  typename TImage::ConstPointer
143  GetInputVolume();
145 
147  void
148  SetInputProjectionStack(const TImage * Projection);
149  typename TImage::Pointer
150  GetInputProjectionStack();
152 
154  void
155  SetInputWeights(const TImage * Weights);
156  typename TImage::Pointer
157  GetInputWeights();
159 
161  void
162  SetSupportMask(const TImage * SupportMask);
163  typename TImage::ConstPointer
164  GetSupportMask();
166 
172 
173  // Regularization steps to perform
174  itkSetMacro(PerformPositivity, bool);
175  itkGetMacro(PerformPositivity, bool);
176  itkSetMacro(PerformTVSpatialDenoising, bool);
177  itkGetMacro(PerformTVSpatialDenoising, bool);
178  itkSetMacro(PerformWaveletsSpatialDenoising, bool);
179  itkGetMacro(PerformWaveletsSpatialDenoising, bool);
180  itkSetMacro(PerformSoftThresholdOnImage, bool);
181  itkGetMacro(PerformSoftThresholdOnImage, bool);
182 
183  // Regularization parameters
184  itkSetMacro(GammaTV, float);
185  itkGetMacro(GammaTV, float);
186  itkSetMacro(SoftThresholdWavelets, float);
187  itkGetMacro(SoftThresholdWavelets, float);
188  itkSetMacro(SoftThresholdOnImage, float);
189  itkGetMacro(SoftThresholdOnImage, float);
190 
192  itkGetMacro(NumberOfLevels, unsigned int);
193  itkSetMacro(NumberOfLevels, unsigned int);
195 
197  itkGetMacro(Order, unsigned int);
198  itkSetMacro(Order, unsigned int);
200 
201  // Iterations
202  itkSetMacro(MainLoop_iterations, int);
203  itkGetMacro(MainLoop_iterations, int);
204  itkSetMacro(CG_iterations, int);
205  itkGetMacro(CG_iterations, int);
206  itkSetMacro(TV_iterations, int);
207  itkGetMacro(TV_iterations, int);
208 
209  // Geometry
210  itkSetObjectMacro(Geometry, ThreeDCircularProjectionGeometry);
211  itkGetModifiableObjectMacro(Geometry, ThreeDCircularProjectionGeometry);
212 
214  itkSetMacro(Preconditioned, bool);
215  itkGetMacro(Preconditioned, bool);
217 
219  itkSetMacro(Tikhonov, float);
220  itkGetMacro(Tikhonov, float);
221  itkSetMacro(Gamma, float);
222  itkGetMacro(Gamma, float);
224 
226  itkSetMacro(CudaConjugateGradient, bool);
227  itkGetMacro(CudaConjugateGradient, bool);
229 
231  itkSetMacro(DisableDisplacedDetectorFilter, bool);
232  itkGetMacro(DisableDisplacedDetectorFilter, bool);
234 
235 protected:
238 
240  void
241  VerifyPreconditions() const override;
242 
244  void
245  GenerateData() override;
246 
247  void
248  GenerateOutputInformation() override;
249 
250  void
251  GenerateInputRequestedRegion() override;
252 
253  // Inputs are not supposed to occupy the same physical space,
254  // so there is nothing to verify
255  void
256  VerifyInputInformation() const override
257  {}
258 
265 
266  // Booleans for each regularization (should it be performed or not)
267  // as well as to choose whether CG should be on GPU or not
273 
274  // Regularization parameters
275  float m_GammaTV;
276  float m_Gamma;
277  float m_Tikhonov;
280  bool m_DimensionsProcessedForTV[TImage::ImageDimension];
283 
285  unsigned int m_Order;
286  unsigned int m_NumberOfLevels;
287 
290 
291  // Iterations
295 
296  // Geometry
298 };
299 } // namespace rtk
300 
301 
302 #ifndef ITK_MANUAL_INSTANTIATION
303 # include "rtkRegularizedConjugateGradientConeBeamReconstructionFilter.hxx"
304 #endif
305 
306 #endif
Applies a total variation denoising, only alm_SingularValueThresholdFilterong the dimensions specifie...
Projection geometry for a source and a 2-D flat panel.
#define itkSetMacro(name, type)
Mother class for cone beam reconstruction filters which need runtime selection of their forward and b...
Deconstructs an image, soft thresholds its wavelets coefficients, then reconstructs.