RTK  2.0.1
Reconstruction Toolkit
rtkFieldOfViewImageFilter.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 rtkFieldOfViewImageFilter_h
20 #define rtkFieldOfViewImageFilter_h
21 
22 #include <itkInPlaceImageFilter.h>
23 
25 #include "rtkConfiguration.h"
26 
27 struct _lprec;
28 
29 namespace rtk
30 {
31 
47 template <class TInputImage, class TOutputImage>
48 class ITK_EXPORT FieldOfViewImageFilter:
49  public itk::InPlaceImageFilter<TInputImage,TOutputImage>
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_ASSIGN(FieldOfViewImageFilter);
53 
59 
60  using OutputImageRegionType = typename TOutputImage::RegionType;
61  using ProjectionsStackType = typename TInputImage::Superclass;
62  using ProjectionsStackPointer = typename ProjectionsStackType::Pointer;
65  using FOVRadiusType = enum {RADIUSINF,RADIUSSUP,RADIUSBOTH};
66 
67 
69  itkNewMacro(Self);
70 
73 
75  itkGetConstObjectMacro(Geometry, GeometryType);
76  itkSetConstObjectMacro(Geometry, GeometryType);
78 
82  itkGetMacro(Mask, bool);
83  itkSetMacro(Mask, bool);
85 
89  itkGetMacro(ProjectionsStack, ProjectionsStackPointer);
90  itkSetObjectMacro(ProjectionsStack, ProjectionsStackType);
92 
95  itkGetMacro(DisplacedDetector, bool);
96  itkSetMacro(DisplacedDetector, bool);
98 
109  virtual bool ComputeFOVRadius(const FOVRadiusType type, double &x, double &z, double &r);
110 
114  void AddCollimationConstraints(const FOVRadiusType type, _lprec *lp);
115 
116 protected:
118  ~FieldOfViewImageFilter() override = default;
119 
120  void BeforeThreadedGenerateData() override;
121 
124 #if ITK_VERSION_MAJOR<5
125  void ThreadedGenerateData( const OutputImageRegionType& outputRegionForThread, ThreadIdType threadId ) override;
126 #else
127  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
128 #endif
129 
130 
131 private:
132  GeometryConstPointer m_Geometry{nullptr};
133  bool m_Mask{false};
135  double m_Radius{-1};
136  double m_CenterX{0.};
137  double m_CenterZ{0.};
142  bool m_DisplacedDetector{false};
143 };
144 
145 } // end namespace rtk
146 
147 #ifndef ITK_MANUAL_INSTANTIATION
148 #include "rtkFieldOfViewImageFilter.hxx"
149 #endif
150 
151 #endif
typename ProjectionsStackType::Pointer ProjectionsStackPointer
typename TOutputImage::RegionType OutputImageRegionType
typename GeometryType::ConstPointer GeometryConstPointer
typename TInputImage::Superclass ProjectionsStackType
Projection geometry for a source and a 2-D flat panel.
Computes the field of view mask for circular 3D geometry.
unsigned int ThreadIdType
ProjectionsStackPointer m_ProjectionsStack
enum{RADIUSINF, RADIUSSUP, RADIUSBOTH} FOVRadiusType
#define itkSetMacro(name, type)