RTK  2.5.0
Reconstruction Toolkit
rtkProjectGeometricPhantomImageFilter.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 rtkProjectGeometricPhantomImageFilter_h
20 #define rtkProjectGeometricPhantomImageFilter_h
21 
22 #include <itkInPlaceImageFilter.h>
23 #include <itkAddImageFilter.h>
24 #include "rtkGeometricPhantom.h"
26 
27 namespace rtk
28 {
29 
39 template <class TInputImage, class TOutputImage>
40 class ITK_TEMPLATE_EXPORT ProjectGeometricPhantomImageFilter : public itk::InPlaceImageFilter<TInputImage, TOutputImage>
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_MOVE(ProjectGeometricPhantomImageFilter);
44 
50 
55  using StringType = std::string;
59 
61  itkNewMacro(Self);
62 
64 #ifdef itkOverrideGetNameOfClassMacro
65  itkOverrideGetNameOfClassMacro(ProjectGeometricPhantomImageFilter);
66 #else
68 #endif
69 
70 
72  itkGetConstObjectMacro(GeometricPhantom, GeometricPhantom);
73  itkSetConstObjectMacro(GeometricPhantom, GeometricPhantom);
75 
77  itkGetConstObjectMacro(Geometry, GeometryType);
78  itkSetConstObjectMacro(Geometry, GeometryType);
80 
82  itkSetMacro(ConfigFile, StringType);
83  itkGetMacro(ConfigFile, StringType);
85 
87  itkSetMacro(PhantomScale, VectorType);
88  itkGetMacro(PhantomScale, VectorType);
90 
92  virtual void
94  {
95  SetPhantomScale(VectorType(_arg));
96  }
97 
100  itkSetMacro(OriginOffset, VectorType);
101  itkGetMacro(OriginOffset, VectorType);
103 
106  itkSetMacro(IsForbildConfigFile, bool);
107  itkGetConstMacro(IsForbildConfigFile, bool);
108  itkBooleanMacro(IsForbildConfigFile);
110 
112  itkSetMacro(RotationMatrix, RotationMatrixType);
113  itkGetMacro(RotationMatrix, RotationMatrixType);
115 
118  void
119  AddClipPlane(const VectorType & dir, const ScalarType & pos);
120  void
121  SetClipPlanes(const std::vector<VectorType> & dir, const std::vector<ScalarType> & pos);
123 
124 protected:
126  ~ProjectGeometricPhantomImageFilter() override = default;
127 
129  void
130  VerifyPreconditions() ITKv5_CONST override;
131 
132  void
133  GenerateData() override;
134 
135 private:
136  GeometricPhantomConstPointer m_GeometricPhantom;
138  StringType m_ConfigFile;
139  VectorType m_PhantomScale{ 1. };
140  VectorType m_OriginOffset{ 0. };
141  bool m_IsForbildConfigFile{ false };
143  std::vector<VectorType> m_PlaneDirections;
144  std::vector<ScalarType> m_PlanePositions;
145 };
146 
147 } // end namespace rtk
148 
149 #ifndef ITK_MANUAL_INSTANTIATION
150 # include "rtkProjectGeometricPhantomImageFilter.hxx"
151 #endif
152 
153 #endif
Container for a geometric phantom, i.e., a set of ConvexShapes.
itk::Vector< ScalarType, Dimension > VectorType
Analytical projection a GeometricPhantom.
itk::SmartPointer< const Self > ConstPointer
Projection geometry for a source and a 2-D flat panel.
#define itkSetMacro(name, type)
itk::Matrix< ScalarType, Dimension, Dimension > RotationMatrixType