RTK  2.7.0
Reconstruction Toolkit
rtkSARTConeBeamReconstructionFilter.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 rtkSARTConeBeamReconstructionFilter_h
20 #define rtkSARTConeBeamReconstructionFilter_h
21 
25 #include "rtkConstantImageSource.h"
29 
30 #include <itkExtractImageFilter.h>
31 #include <itkMultiplyImageFilter.h>
32 #include <itkSubtractImageFilter.h>
33 #include <itkAddImageAdaptor.h>
34 #include <itkAddImageFilter.h>
35 #include <itkDivideOrZeroOutImageFilter.h>
36 #include <itkThresholdImageFilter.h>
37 
38 namespace rtk
39 {
40 
140 template <class TVolumeImage, class TProjectionImage = TVolumeImage>
141 class ITK_TEMPLATE_EXPORT SARTConeBeamReconstructionFilter
142  : public rtk::IterativeConeBeamReconstructionFilter<TVolumeImage, TProjectionImage>
143 {
144 public:
145  ITK_DISALLOW_COPY_AND_MOVE(SARTConeBeamReconstructionFilter);
146 
150  using Pointer = itk::SmartPointer<Self>;
151  using ConstPointer = itk::SmartPointer<const Self>;
152 
154  using VolumeType = TVolumeImage;
155  using ProjectionType = TProjectionImage;
156  using ProjectionPixelType = typename ProjectionType::PixelType;
157 
159  using ExtractFilterType = itk::ExtractImageFilter<ProjectionType, ProjectionType>;
160  using MultiplyFilterType = itk::MultiplyImageFilter<ProjectionType, ProjectionType, ProjectionType>;
162  using SubtractFilterType = itk::SubtractImageFilter<ProjectionType, ProjectionType>;
163  using AddFilterType = itk::AddImageFilter<VolumeType, VolumeType>;
167  using DivideProjectionFilterType = itk::DivideOrZeroOutImageFilter<ProjectionType, ProjectionType, ProjectionType>;
168  using DivideVolumeFilterType = itk::DivideOrZeroOutImageFilter<VolumeType, VolumeType, VolumeType>;
171  using ThresholdFilterType = itk::ThresholdImageFilter<VolumeType>;
173  using GatingWeightsFilterType = itk::MultiplyImageFilter<ProjectionType, ProjectionType, ProjectionType>;
174 
177 
179  itkNewMacro(Self);
180 
182  itkOverrideGetNameOfClassMacro(SARTConeBeamReconstructionFilter);
183 
185  itkGetModifiableObjectMacro(Geometry, ThreeDCircularProjectionGeometry);
186  itkSetObjectMacro(Geometry, ThreeDCircularProjectionGeometry);
188 
190  itkGetMacro(NumberOfIterations, unsigned int);
191  itkSetMacro(NumberOfIterations, unsigned int);
193 
195  itkGetMacro(NumberOfProjectionsPerSubset, unsigned int);
196  itkSetMacro(NumberOfProjectionsPerSubset, unsigned int);
198 
200  itkGetMacro(Lambda, double);
201  itkSetMacro(Lambda, double);
203 
205  itkGetMacro(EnforcePositivity, bool);
206  itkSetMacro(EnforcePositivity, bool);
208 
210  void
211  SetGatingWeights(std::vector<float> weights);
212 
214  itkSetMacro(DisableDisplacedDetectorFilter, bool);
215  itkGetMacro(DisableDisplacedDetectorFilter, bool);
217 
222  itkSetMacro(DivisionThreshold, ProjectionPixelType);
223  itkGetMacro(DivisionThreshold, ProjectionPixelType);
225 
229  itkSetMacro(ResetNesterovEvery, int);
230  itkGetMacro(ResetNesterovEvery, int);
232 
233 protected:
235  ~SARTConeBeamReconstructionFilter() override = default;
236 
238  void
239  VerifyPreconditions() const override;
240 
241  void
242  GenerateInputRequestedRegion() override;
243 
244  void
245  GenerateOutputInformation() override;
246 
247  void
248  GenerateData() override;
249 
252  void
253  VerifyInputInformation() const override
254  {}
255 
257  typename ExtractFilterType::Pointer m_ExtractFilter;
258  typename ExtractFilterType::Pointer m_ExtractFilterRayBox;
259  typename MultiplyFilterType::Pointer m_ZeroMultiplyFilter;
261  typename SubtractFilterType::Pointer m_SubtractFilter;
262  typename AddFilterType::Pointer m_AddFilter;
263  typename MultiplyFilterType::Pointer m_MultiplyFilter;
267  typename DivideProjectionFilterType::Pointer m_DivideProjectionFilter;
268  typename DivideVolumeFilterType::Pointer m_DivideVolumeFilter;
272  typename ThresholdFilterType::Pointer m_ThresholdFilter;
274  typename GatingWeightsFilterType::Pointer m_GatingWeightsFilter;
276 
278 
280  bool m_DisableDisplacedDetectorFilter{};
281 
282 private:
285  unsigned int m_NumberOfProjectionsPerSubset{ 1 };
286 
289 
291  unsigned int m_NumberOfIterations;
292 
295  double m_Lambda;
296 
299  bool m_IsGated{};
300  std::vector<float> m_GatingWeights;
301 
303  int m_ResetNesterovEvery{ 1 };
304 }; // end of class
305 
306 } // end namespace rtk
307 
308 #ifndef ITK_MANUAL_INSTANTIATION
309 # include "rtkSARTConeBeamReconstructionFilter.hxx"
310 #endif
311 
312 #endif
DisplacedDetectorFilterType::Pointer m_DisplacedDetectorFilter
RayBoxIntersectionFilterType::Pointer m_RayBoxFilter
Base class for forward projection, i.e. accumulation along x-ray lines.
BackProjectionFilterType::Pointer m_BackProjectionNormalizationFilter
ThreeDCircularProjectionGeometry::Pointer m_Geometry
itk::AddImageFilter< VolumeType, VolumeType > AddFilterType
ForwardProjectionFilterType::Pointer m_ForwardProjectionFilter
Applies Nesterov&#39;s momentum technique.
itk::ExtractImageFilter< ProjectionType, ProjectionType > ExtractFilterType
Generate an n-dimensional image with constant pixel values.
typename Superclass::BackProjectionType BackProjectionType
Weigting for displaced detectors.
ConstantProjectionSourceType::Pointer m_ConstantProjectionStackSource
Analytical projection of a BoxShape.
itk::DivideOrZeroOutImageFilter< VolumeType, VolumeType, VolumeType > DivideVolumeFilterType
ConstantProjectionSourceType::Pointer m_OneConstantProjectionStackSource
Projection geometry for a source and a 2-D flat panel.
itk::DivideOrZeroOutImageFilter< ProjectionType, ProjectionType, ProjectionType > DivideProjectionFilterType
#define itkSetMacro(name, type)
BackProjectionFilterType::Pointer m_BackProjectionFilter
typename ProjectionType::PixelType ProjectionPixelType
itk::SubtractImageFilter< ProjectionType, ProjectionType > SubtractFilterType
itk::MultiplyImageFilter< ProjectionType, ProjectionType, ProjectionType > MultiplyFilterType
itk::MultiplyImageFilter< ProjectionType, ProjectionType, ProjectionType > GatingWeightsFilterType
Implements the Simultaneous Algebraic Reconstruction Technique [Andersen, 1984].
typename Superclass::ForwardProjectionType ForwardProjectionType
itk::SmartPointer< Self > Pointer
DivideProjectionFilterType::Pointer m_DivideProjectionFilter
Mother class for cone beam reconstruction filters which need runtime selection of their forward and b...
ConstantVolumeSourceType::Pointer m_ConstantVolumeSource
itk::ThresholdImageFilter< VolumeType > ThresholdFilterType