RTK  2.0.1
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  * 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 #ifndef rtkRegularizedConjugateGradientConeBeamReconstructionFilter_h
19 #define rtkRegularizedConjugateGradientConeBeamReconstructionFilter_h
20 
22 #ifdef RTK_USE_CUDA
24 #else
26 #endif
28 
30 
31 namespace rtk
32 {
101 template< typename TImage>
103 {
104 public:
105  ITK_DISALLOW_COPY_AND_ASSIGN(RegularizedConjugateGradientConeBeamReconstructionFilter);
106 
112 
113 #ifdef RTK_USE_CUDA
114  using GradientImageType = itk::CudaImage<CovariantVectorForSpatialGradient, TImage::ImageDimension>;
115 #else
117 #endif
118 
121 
123  itkNewMacro(Self)
124 
125 
127 
129  void SetInputVolume(const TImage* Volume);
130  typename TImage::ConstPointer GetInputVolume();
132 
134  void SetInputProjectionStack(const TImage* Projection);
135  typename TImage::Pointer GetInputProjectionStack();
137 
139  void SetInputWeights(const TImage* Projection);
140  typename TImage::Pointer GetInputWeights();
142 
144  void SetSupportMask(const TImage *SupportMask);
145  typename TImage::ConstPointer GetSupportMask();
147 
153 
156 
158  void SetBackProjectionFilter(BackProjectionType bptype) override;
159 
160  // Regularization steps to perform
161  itkSetMacro(PerformPositivity, bool)
162  itkGetMacro(PerformPositivity, bool)
163  itkSetMacro(PerformTVSpatialDenoising, bool)
164  itkGetMacro(PerformTVSpatialDenoising, bool)
165  itkSetMacro(PerformWaveletsSpatialDenoising, bool)
166  itkGetMacro(PerformWaveletsSpatialDenoising, bool)
167  itkSetMacro(PerformSoftThresholdOnImage, bool)
168  itkGetMacro(PerformSoftThresholdOnImage, bool)
169 
170  // Regularization parameters
171  itkSetMacro(GammaTV, float)
172  itkGetMacro(GammaTV, float)
173  itkSetMacro(SoftThresholdWavelets, float)
174  itkGetMacro(SoftThresholdWavelets, float)
175  itkSetMacro(SoftThresholdOnImage, float)
176  itkGetMacro(SoftThresholdOnImage, float)
177 
179  itkGetMacro(NumberOfLevels, unsigned int)
180  itkSetMacro(NumberOfLevels, unsigned int)
181 
183  itkGetMacro(Order, unsigned int)
184  itkSetMacro(Order, unsigned int)
185 
187  itkSetMacro(IterationCosts, bool)
188  itkGetMacro(IterationCosts, bool)
189 
190  // Iterations
191  itkSetMacro(MainLoop_iterations, int)
192  itkGetMacro(MainLoop_iterations, int)
193  itkSetMacro(CG_iterations, int)
194  itkGetMacro(CG_iterations, int)
195  itkSetMacro(TV_iterations, int)
196  itkGetMacro(TV_iterations, int)
197 
198  // Geometry
199  itkSetObjectMacro(Geometry, ThreeDCircularProjectionGeometry)
200  itkGetModifiableObjectMacro(Geometry, ThreeDCircularProjectionGeometry)
201 
203  itkSetMacro(Preconditioned, bool)
204  itkGetMacro(Preconditioned, bool)
205 
207  itkSetMacro(Tikhonov, float)
208  itkGetMacro(Tikhonov, float)
209  itkSetMacro(Gamma, float)
210  itkGetMacro(Gamma, float)
211 
213  itkSetMacro(CudaConjugateGradient, bool)
214  itkGetMacro(CudaConjugateGradient, bool)
215 
217  itkSetMacro(DisableDisplacedDetectorFilter, bool)
218  itkGetMacro(DisableDisplacedDetectorFilter, bool)
219 
220 protected:
221  RegularizedConjugateGradientConeBeamReconstructionFilter();
222  ~RegularizedConjugateGradientConeBeamReconstructionFilter() override = default;
223 
225  void GenerateData() override;
226 
227  void GenerateOutputInformation() override;
228 
229  void GenerateInputRequestedRegion() override;
230 
231  // Inputs are not supposed to occupy the same physical space,
232  // so there is nothing to verify
233 #if ITK_VERSION_MAJOR<5
234  void VerifyInputInformation() override {}
235 #else
236  void VerifyInputInformation() const override {}
237 #endif
238 
245 
246  // Booleans for each regularization (should it be performed or not)
247  // as well as to choose whether CG should be on GPU or not
253 
254  // Regularization parameters
255  float m_GammaTV;
256  float m_Gamma;
257  float m_Tikhonov;
260  bool m_DimensionsProcessedForTV[TImage::ImageDimension];
263 
265  unsigned int m_Order;
266  unsigned int m_NumberOfLevels;
267 
271 
272  // Iterations
276 
277  // Geometry
279 };
280 } //namespace ITK
281 
282 
283 #ifndef ITK_MANUAL_INSTANTIATION
284 #include "rtkRegularizedConjugateGradientConeBeamReconstructionFilter.hxx"
285 #endif
286 
287 #endif
Applies a total variation denoising, only alm_SingularValueThresholdFilterong the dimensions specifie...
Projection geometry for a source and a 2-D flat panel.
void SetBackProjectionFilter(BackProjectionType bptype) override
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.
#define itkSetMacro(name, type)
void SetForwardProjectionFilter(ForwardProjectionType fwtype) override