RTK  2.6.0
Reconstruction Toolkit
rtkBackProjectionImageFilter.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 rtkBackProjectionImageFilter_h
20 #define rtkBackProjectionImageFilter_h
21 
22 #include "rtkConfiguration.h"
23 
24 #include <itkInPlaceImageFilter.h>
25 #include <itkConceptChecking.h>
26 
28 
29 #include <type_traits>
30 #include <typeinfo>
31 
32 namespace rtk
33 {
34 
49 template <class TInputImage, class TOutputImage>
50 class ITK_TEMPLATE_EXPORT BackProjectionImageFilter : public itk::InPlaceImageFilter<TInputImage, TOutputImage>
51 {
52 public:
53  ITK_DISALLOW_COPY_AND_MOVE(BackProjectionImageFilter);
54 
60  using InputPixelType = typename TInputImage::PixelType;
61  using InternalInputPixelType = typename TInputImage::InternalPixelType;
62  using OutputImageRegionType = typename TOutputImage::RegionType;
63 
67  using ProjectionImageType = itk::Image<InputPixelType, TInputImage::ImageDimension - 1>;
69 
71  itkNewMacro(Self);
72 
74  itkOverrideGetNameOfClassMacro(BackProjectionImageFilter);
75 
77  itkGetConstObjectMacro(Geometry, GeometryType);
78  itkSetConstObjectMacro(Geometry, GeometryType);
80 
82  itkGetMacro(Transpose, bool);
83  itkSetMacro(Transpose, bool);
85 
86 protected:
88  : m_Geometry(nullptr)
89  {
90  this->SetNumberOfRequiredInputs(2);
91  this->SetInPlace(true);
92  };
93  ~BackProjectionImageFilter() override = default;
94 
96  void
97  VerifyPreconditions() const override;
98 
100  void
101  GenerateInputRequestedRegion() override;
102 
103  void
104  BeforeThreadedGenerateData() override;
105 
106  void
107  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
108 
110  virtual void
111  CylindricalDetectorCenteredOnSourceBackprojection(
112  const OutputImageRegionType & region,
113  const ProjectionMatrixType & volIndexToProjPP,
115  const ProjectionImagePointer projection);
116 
119  virtual void
120  OptimizedBackprojectionX(const OutputImageRegionType & region,
121  const ProjectionMatrixType & matrix,
122  const ProjectionImagePointer projection);
123 
126  virtual void
127  OptimizedBackprojectionY(const OutputImageRegionType & region,
128  const ProjectionMatrixType & matrix,
129  const ProjectionImagePointer projection);
130 
133  void
134  VerifyInputInformation() const override
135  {}
136 
141  template <class TProjectionImage>
142  typename TProjectionImage::Pointer
143  GetProjection(const unsigned int iProj);
144 
147  ProjectionMatrixType
148  GetIndexToIndexProjectionMatrix(const unsigned int iProj);
149 
150  ProjectionMatrixType
151  GetVolumeIndexToProjectionPhysicalPointMatrix(const unsigned int iProj);
152 
154  GetProjectionPhysicalPointToProjectionIndexMatrix(const unsigned int iProj);
155 
158 
159 private:
162  bool m_Transpose{ false };
163 };
164 
165 } // end namespace rtk
166 
167 #ifndef ITK_MANUAL_INSTANTIATION
168 # include "rtkBackProjectionImageFilter.hxx"
169 #endif
170 
171 #endif
typename itk::Matrix< double, TDimension, TDimension+1 > MatrixType
Projection geometry for a source and a 2-D flat panel.
#define itkSetMacro(name, type)
typename OutputImageType::RegionType OutputImageRegionType