RTK  2.5.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 #ifdef itkOverrideGetNameOfClassMacro
62  itkOverrideGetNameOfClassMacro(DrawBoxImageFilter);
63 #else
65 #endif
66 
67 
69  itkGetMacro(Density, ScalarType);
70  itkSetMacro(Density, ScalarType);
72 
74  itkGetConstReferenceMacro(PlaneDirections, std::vector<VectorType>);
75  itkGetConstReferenceMacro(PlanePositions, std::vector<ScalarType>);
77 
79  void
80  AddClipPlane(const VectorType & dir, const ScalarType & pos);
81 
83  void
84  SetBoxFromImage(const ImageBaseType * img, bool bWithExternalHalfPixelBorder = true);
85 
87  itkGetMacro(BoxMin, VectorType);
88  itkSetMacro(BoxMin, VectorType);
89  itkGetMacro(BoxMax, VectorType);
90  itkSetMacro(BoxMax, VectorType);
91  itkGetMacro(Direction, RotationMatrixType);
92  itkSetMacro(Direction, RotationMatrixType);
94 
95 protected:
97  ~DrawBoxImageFilter() = default;
98 
99  void
100  BeforeThreadedGenerateData() override;
101 
102 private:
103  ScalarType m_Density{ 1. };
104  std::vector<VectorType> m_PlaneDirections;
105  std::vector<ScalarType> m_PlanePositions;
106 
107  VectorType m_BoxMin{ 0. };
108  VectorType m_BoxMax{ 0. };
110 };
111 
112 } // end namespace rtk
113 
114 #ifndef ITK_MANUAL_INSTANTIATION
115 # include "rtkDrawBoxImageFilter.hxx"
116 #endif
117 
118 #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