RTK  2.0.1
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  * 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 
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>
51  public itk::InPlaceImageFilter<TInputImage,TOutputImage>
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_ASSIGN(BackProjectionImageFilter);
55 
61  using InputPixelType = typename TInputImage::PixelType;
62  using InternalInputPixelType = typename TInputImage::InternalPixelType;
63  using OutputImageRegionType = typename TOutputImage::RegionType;
64 
68  using ProjectionImageType = itk::Image<InputPixelType, TInputImage::ImageDimension-1>;
69  using ProjectionImagePointer = typename ProjectionImageType::Pointer;
70 
72  itkNewMacro(Self);
73 
76 
78  itkGetConstObjectMacro(Geometry, GeometryType);
79  itkSetConstObjectMacro(Geometry, GeometryType);
81 
83  itkGetMacro(Transpose, bool);
84  itkSetMacro(Transpose, bool);
86 
87 protected:
89  this->SetNumberOfRequiredInputs(2); this->SetInPlace( true );
90  };
91  ~BackProjectionImageFilter() override = default;
92 
94  void GenerateInputRequestedRegion() override;
95 
96  void BeforeThreadedGenerateData() override;
97 
98 #if ITK_VERSION_MAJOR<5
99  void ThreadedGenerateData( const OutputImageRegionType& outputRegionForThread, ThreadIdType threadId ) override;
100 #else
101  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
102 #endif
103 
106  const ProjectionMatrixType& volIndexToProjPP,
108  const ProjectionImagePointer projection);
109 
112  virtual void OptimizedBackprojectionX(const OutputImageRegionType& region, const ProjectionMatrixType& matrix,
113  const ProjectionImagePointer projection);
114 
117  virtual void OptimizedBackprojectionY(const OutputImageRegionType& region, const ProjectionMatrixType& matrix,
118  const ProjectionImagePointer projection);
119 
122 #if ITK_VERSION_MAJOR<5
123  void VerifyInputInformation() override {}
124 #else
125  void VerifyInputInformation() const override {}
126 #endif
127 
128 
133  template<class TProjectionImage>
134  typename TProjectionImage::Pointer GetProjection(const unsigned int iProj);
135 
138  ProjectionMatrixType GetIndexToIndexProjectionMatrix(const unsigned int iProj);
139 
141 
143 
146 
147 private:
150  bool m_Transpose{false};
151 };
152 
153 } // end namespace rtk
154 
155 #ifndef ITK_MANUAL_INSTANTIATION
156 #include "rtkBackProjectionImageFilter.hxx"
157 #endif
158 
159 #endif
void GenerateInputRequestedRegion() override
virtual void CylindricalDetectorCenteredOnSourceBackprojection(const OutputImageRegionType &region, const ProjectionMatrixType &volIndexToProjPP, const itk::Matrix< double, TInputImage::ImageDimension, TInputImage::ImageDimension > &projPPToProjIndex, const ProjectionImagePointer projection)
void BeforeThreadedGenerateData() override
typename itk::Matrix< double, TDimension, TDimension+1 > MatrixType
ProjectionMatrixType GetVolumeIndexToProjectionPhysicalPointMatrix(const unsigned int iProj)
itk::Matrix< double, TInputImage::ImageDimension, TInputImage::ImageDimension > GetProjectionPhysicalPointToProjectionIndexMatrix(const unsigned int iProj)
Projection geometry for a source and a 2-D flat panel.
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override
virtual void OptimizedBackprojectionY(const OutputImageRegionType &region, const ProjectionMatrixType &matrix, const ProjectionImagePointer projection)
unsigned int ThreadIdType
ProjectionMatrixType GetIndexToIndexProjectionMatrix(const unsigned int iProj)
TProjectionImage::Pointer GetProjection(const unsigned int iProj)
~BackProjectionImageFilter() override=default
#define itkSetMacro(name, type)
virtual void OptimizedBackprojectionX(const OutputImageRegionType &region, const ProjectionMatrixType &matrix, const ProjectionImagePointer projection)