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 #ifdef itkOverrideGetNameOfClassMacro
75  itkOverrideGetNameOfClassMacro(BackProjectionImageFilter);
76 #else
78 #endif
79 
80 
82  itkGetConstObjectMacro(Geometry, GeometryType);
83  itkSetConstObjectMacro(Geometry, GeometryType);
85 
87  itkGetMacro(Transpose, bool);
88  itkSetMacro(Transpose, bool);
90 
91 protected:
93  : m_Geometry(nullptr)
94  {
95  this->SetNumberOfRequiredInputs(2);
96  this->SetInPlace(true);
97  };
98  ~BackProjectionImageFilter() override = default;
99 
101  void
102  VerifyPreconditions() const override;
103 
105  void
106  GenerateInputRequestedRegion() override;
107 
108  void
109  BeforeThreadedGenerateData() override;
110 
111  void
112  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
113 
115  virtual void
116  CylindricalDetectorCenteredOnSourceBackprojection(
117  const OutputImageRegionType & region,
118  const ProjectionMatrixType & volIndexToProjPP,
120  const ProjectionImagePointer projection);
121 
124  virtual void
125  OptimizedBackprojectionX(const OutputImageRegionType & region,
126  const ProjectionMatrixType & matrix,
127  const ProjectionImagePointer projection);
128 
131  virtual void
132  OptimizedBackprojectionY(const OutputImageRegionType & region,
133  const ProjectionMatrixType & matrix,
134  const ProjectionImagePointer projection);
135 
138  void
139  VerifyInputInformation() const override
140  {}
141 
146  template <class TProjectionImage>
147  typename TProjectionImage::Pointer
148  GetProjection(const unsigned int iProj);
149 
152  ProjectionMatrixType
153  GetIndexToIndexProjectionMatrix(const unsigned int iProj);
154 
155  ProjectionMatrixType
156  GetVolumeIndexToProjectionPhysicalPointMatrix(const unsigned int iProj);
157 
159  GetProjectionPhysicalPointToProjectionIndexMatrix(const unsigned int iProj);
160 
163 
164 private:
167  bool m_Transpose{ false };
168 };
169 
170 } // end namespace rtk
171 
172 #ifndef ITK_MANUAL_INSTANTIATION
173 # include "rtkBackProjectionImageFilter.hxx"
174 #endif
175 
176 #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