RTK  2.6.0
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  * 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 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_TEMPLATE_EXPORT FieldOfViewImageFilter : public itk::InPlaceImageFilter<TInputImage, TOutputImage>
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_MOVE(FieldOfViewImageFilter);
52 
58 
59  using OutputImageRegionType = typename TOutputImage::RegionType;
60  using ProjectionsStackType = typename TInputImage::Superclass;
61  using ProjectionsStackPointer = typename ProjectionsStackType::Pointer;
64  using FOVRadiusType = enum { RADIUSINF, RADIUSSUP, RADIUSBOTH };
65 
66 
68  itkNewMacro(Self);
69 
71 #ifdef itkOverrideGetNameOfClassMacro
72  itkOverrideGetNameOfClassMacro(FieldOfViewImageFilter);
73 #else
75 #endif
76 
77 
79  itkGetConstObjectMacro(Geometry, GeometryType);
80  itkSetConstObjectMacro(Geometry, GeometryType);
82 
86  itkGetMacro(Mask, bool);
87  itkSetMacro(Mask, bool);
89 
93  itkGetMacro(ProjectionsStack, ProjectionsStackPointer);
94  itkSetObjectMacro(ProjectionsStack, ProjectionsStackType);
96 
99  itkGetMacro(DisplacedDetector, bool);
100  itkSetMacro(DisplacedDetector, bool);
102 
104  itkGetMacro(InsideValue, double);
105  itkSetMacro(InsideValue, double);
107 
109  itkGetMacro(OutsideValue, double);
110  itkSetMacro(OutsideValue, double);
112 
123  virtual bool
124  ComputeFOVRadius(const FOVRadiusType type, double & x, double & z, double & r);
125 
129  void
130  AddCollimationConstraints(const FOVRadiusType type, _lprec * lp);
131 
132 protected:
134  ~FieldOfViewImageFilter() override = default;
135 
137  void
138  VerifyPreconditions() const override;
139 
140  void
141  BeforeThreadedGenerateData() override;
142 
145  void
146  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
147 
148 private:
149  GeometryConstPointer m_Geometry{ nullptr };
150  bool m_Mask{ false };
152  double m_Radius{ -1 };
153  double m_CenterX{ 0. };
154  double m_CenterZ{ 0. };
159  bool m_DisplacedDetector{ false };
160  double m_InsideValue{ 1. };
161  double m_OutsideValue{ 0. };
162 };
163 
164 } // end namespace rtk
165 
166 #ifndef ITK_MANUAL_INSTANTIATION
167 # include "rtkFieldOfViewImageFilter.hxx"
168 #endif
169 
170 #endif
typename ProjectionsStackType::Pointer ProjectionsStackPointer
typename GeometryType::ConstPointer GeometryConstPointer
typename TInputImage::Superclass ProjectionsStackType
Projection geometry for a source and a 2-D flat panel.
#define itkSetMacro(name, type)
typename OutputImageType::RegionType OutputImageRegionType
Computes the field of view mask for circular 3D geometry.
ProjectionsStackPointer m_ProjectionsStack
enum { RADIUSINF, RADIUSSUP, RADIUSBOTH } FOVRadiusType