RTK  2.0.1
Reconstruction Toolkit
rtkBoxShape.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 rtkBoxShape_h
20 #define rtkBoxShape_h
21 
22 #include "RTKExport.h"
23 #include "rtkMacro.h"
24 #include "rtkConvexShape.h"
25 
26 #include <itkImageBase.h>
27 
28 namespace rtk
29 {
30 
44 class RTK_EXPORT BoxShape:
45  public ConvexShape
46 {
47 public:
49  using Self = BoxShape;
53 
55  static constexpr unsigned int Dimension = Superclass::Dimension;
58  using VectorType = Superclass::VectorType;
59  using RotationMatrixType = Superclass::RotationMatrixType;
61 
63  itkNewMacro ( Self );
64 
66  itkTypeMacro(BoxShape, ConvexShape);
67 
69  bool IsInside(const PointType & point) const override;
70 
74  bool IsIntersectedByRay(const PointType & rayOrigin,
75  const VectorType & rayDirection,
76  double &nearDist,
77  double &farDist) const override;
78 
80  void Rescale(const VectorType &r) override;
81 
83  void Translate(const VectorType &t) override;
84 
86  void Rotate(const RotationMatrixType &r) override;
87 
90  itkGetConstMacro(BoxMin, PointType);
91  itkSetMacro(BoxMin, PointType);
93 
96  itkGetConstMacro(BoxMax, PointType);
97  itkSetMacro(BoxMax, PointType);
99 
102  itkGetConstMacro(Direction, RotationMatrixType);
103  itkSetMacro(Direction, RotationMatrixType);
105 
106  itk::LightObject::Pointer InternalClone() const override;
107 
111  void SetBoxFromImage( const ImageBaseType *img, bool bWithExternalHalfPixelBorder=true );
112 
113 private:
114  BoxShape();
115 
119 };
120 
121 } // end namespace rtk
122 
123 #endif
BoxShape defines a paralleliped. The box is defined by its two opposite corners, BoxMin and BoxMax...
Definition: rtkBoxShape.h:44
Superclass::VectorType VectorType
Definition: rtkBoxShape.h:58
PointType m_BoxMax
Definition: rtkBoxShape.h:117
constexpr unsigned int Dimension
PointType m_BoxMin
Definition: rtkBoxShape.h:116
RotationMatrixType m_Direction
Definition: rtkBoxShape.h:118
Superclass::ScalarType ScalarType
Definition: rtkBoxShape.h:56
Superclass::RotationMatrixType RotationMatrixType
Definition: rtkBoxShape.h:59
Base class for a 3D convex shape.
#define itkSetMacro(name, type)