RTK  2.6.0
Reconstruction Toolkit
rtkDrawBoxImageFilter.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 rtkDrawBoxImageFilter_h
20 #define rtkDrawBoxImageFilter_h
21 
23 #include "rtkConfiguration.h"
24 #include "rtkBoxShape.h"
25 
26 namespace rtk
27 {
28 
38 template <class TInputImage, class TOutputImage>
39 class ITK_TEMPLATE_EXPORT DrawBoxImageFilter : public DrawConvexImageFilter<TInputImage, TOutputImage>
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_MOVE(DrawBoxImageFilter);
43 
49 
56 
58  itkNewMacro(Self);
59 
61  itkOverrideGetNameOfClassMacro(DrawBoxImageFilter);
62 
64  itkGetMacro(Density, ScalarType);
65  itkSetMacro(Density, ScalarType);
67 
69  itkGetConstReferenceMacro(PlaneDirections, std::vector<VectorType>);
70  itkGetConstReferenceMacro(PlanePositions, std::vector<ScalarType>);
72 
74  void
75  AddClipPlane(const VectorType & dir, const ScalarType & pos);
76 
78  void
79  SetBoxFromImage(const ImageBaseType * img, bool bWithExternalHalfPixelBorder = true);
80 
82  itkGetMacro(BoxMin, VectorType);
83  itkSetMacro(BoxMin, VectorType);
84  itkGetMacro(BoxMax, VectorType);
85  itkSetMacro(BoxMax, VectorType);
86  itkGetMacro(Direction, RotationMatrixType);
87  itkSetMacro(Direction, RotationMatrixType);
89 
90 protected:
92  ~DrawBoxImageFilter() = default;
93 
94  void
95  BeforeThreadedGenerateData() override;
96 
97 private:
98  ScalarType m_Density{ 1. };
99  std::vector<VectorType> m_PlaneDirections;
100  std::vector<ScalarType> m_PlanePositions;
101 
102  VectorType m_BoxMin{ 0. };
103  VectorType m_BoxMax{ 0. };
105 };
106 
107 } // end namespace rtk
108 
109 #ifndef ITK_MANUAL_INSTANTIATION
110 # include "rtkDrawBoxImageFilter.hxx"
111 #endif
112 
113 #endif
std::vector< ScalarType > m_PlanePositions
Superclass::VectorType VectorType
Definition: rtkBoxShape.h:57
BoxShape::ScalarType ScalarType
RotationMatrixType m_Direction
itk::ImageBase< Dimension > ImageBaseType
Definition: rtkBoxShape.h:59
#define itkSetMacro(name, type)
Draws a 3D image user defined BoxShape.
BoxShape::RotationMatrixType RotationMatrixType
std::vector< VectorType > m_PlaneDirections
Superclass::PointType PointType
Definition: rtkBoxShape.h:56
Superclass::ScalarType ScalarType
Definition: rtkBoxShape.h:55
Superclass::RotationMatrixType RotationMatrixType
Definition: rtkBoxShape.h:58
Draws a rtk::ConvexShape in a 3D image.
BoxShape::VectorType VectorType