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  itkOverrideGetNameOfClassMacro(FieldOfViewImageFilter);
72 
74  itkGetConstObjectMacro(Geometry, GeometryType);
75  itkSetConstObjectMacro(Geometry, GeometryType);
77 
81  itkGetMacro(Mask, bool);
82  itkSetMacro(Mask, bool);
84 
88  itkGetMacro(ProjectionsStack, ProjectionsStackPointer);
89  itkSetObjectMacro(ProjectionsStack, ProjectionsStackType);
91 
94  itkGetMacro(DisplacedDetector, bool);
95  itkSetMacro(DisplacedDetector, bool);
97 
99  itkGetMacro(InsideValue, double);
100  itkSetMacro(InsideValue, double);
102 
104  itkGetMacro(OutsideValue, double);
105  itkSetMacro(OutsideValue, double);
107 
118  virtual bool
119  ComputeFOVRadius(const FOVRadiusType type, double & x, double & z, double & r);
120 
124  void
125  AddCollimationConstraints(const FOVRadiusType type, _lprec * lp);
126 
127 protected:
129  ~FieldOfViewImageFilter() override = default;
130 
132  void
133  VerifyPreconditions() const override;
134 
135  void
136  BeforeThreadedGenerateData() override;
137 
140  void
141  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
142 
143 private:
144  GeometryConstPointer m_Geometry{ nullptr };
145  bool m_Mask{ false };
147  double m_Radius{ -1 };
148  double m_CenterX{ 0. };
149  double m_CenterZ{ 0. };
154  bool m_DisplacedDetector{ false };
155  double m_InsideValue{ 1. };
156  double m_OutsideValue{ 0. };
157 };
158 
159 } // end namespace rtk
160 
161 #ifndef ITK_MANUAL_INSTANTIATION
162 # include "rtkFieldOfViewImageFilter.hxx"
163 #endif
164 
165 #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