RTK  2.1.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  * 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 : public itk::InPlaceImageFilter<TInputImage, TOutputImage>
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_ASSIGN(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 
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 
108  virtual bool
109  ComputeFOVRadius(const FOVRadiusType type, double & x, double & z, double & r);
110 
114  void
115  AddCollimationConstraints(const FOVRadiusType type, _lprec * lp);
116 
117 protected:
119  ~FieldOfViewImageFilter() override = default;
120 
122  void
123  VerifyPreconditions() ITKv5_CONST override;
124 
125  void
126  BeforeThreadedGenerateData() override;
127 
130  void
131  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
132 
133 private:
134  GeometryConstPointer m_Geometry{ nullptr };
135  bool m_Mask{ false };
137  double m_Radius{ -1 };
138  double m_CenterX{ 0. };
139  double m_CenterZ{ 0. };
144  bool m_DisplacedDetector{ false };
145 };
146 
147 } // end namespace rtk
148 
149 #ifndef ITK_MANUAL_INSTANTIATION
150 # include "rtkFieldOfViewImageFilter.hxx"
151 #endif
152 
153 #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