RTK  1.4.0
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 "rtkWin32Header.h"
23 #include "rtkMacro.h"
24 #include "rtkConvexShape.h"
25 
26 #include <itkImageBase.h>
27 
28 namespace rtk
29 {
30 
45  public ConvexShape
46 {
47 public:
49  typedef BoxShape Self;
53 
55  itkStaticConstMacro(Dimension, unsigned int, Superclass::Dimension);
61 
63  itkNewMacro ( Self );
64 
66  itkTypeMacro(BoxShape, ConvexShape);
67 
69  virtual bool IsInside(const PointType & point) const ITK_OVERRIDE;
70 
74  virtual bool IsIntersectedByRay(const PointType & rayOrigin,
75  const VectorType & rayDirection,
76  double &nearDist,
77  double &farDist) const ITK_OVERRIDE;
78 
80  virtual void Rescale(const VectorType &r) ITK_OVERRIDE;
81 
83  virtual void Translate(const VectorType &t) ITK_OVERRIDE;
84 
86  virtual void Rotate(const RotationMatrixType &r) ITK_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  virtual itk::LightObject::Pointer InternalClone() const ITK_OVERRIDE;
107 
111  void SetBoxFromImage( const ImageBaseType *img, bool bWithExternalHalfPixelBorder=true );
112 
113 private:
114  BoxShape();
115 
116  PointType m_BoxMin;
117  PointType m_BoxMax;
118  RotationMatrixType m_Direction;
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::RotationMatrixType RotationMatrixType
Definition: rtkBoxShape.h:59
itk::SmartPointer< Self > Pointer
Definition: rtkBoxShape.h:51
itk::SmartPointer< const Self > ConstPointer
Definition: rtkBoxShape.h:52
Superclass::ScalarType ScalarType
Definition: rtkBoxShape.h:56
ConvexShape Superclass
Definition: rtkBoxShape.h:50
Superclass::PointType PointType
Definition: rtkBoxShape.h:57
BoxShape Self
Definition: rtkBoxShape.h:49
#define RTK_EXPORT
itk::ImageBase< Dimension > ImageBaseType
Definition: rtkBoxShape.h:60
Base class for a 3D convex shape.
#define itkSetMacro(name, type)
Superclass::VectorType VectorType
Definition: rtkBoxShape.h:58