ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkArrowSpatialObject.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software 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 #ifndef itkArrowSpatialObject_h
19 #define itkArrowSpatialObject_h
20 
21 #include "itkSpatialObject.h"
22 
23 namespace itk
24 {
36 template< unsigned int TDimension = 3 >
37 class ITK_TEMPLATE_EXPORT ArrowSpatialObject:
38  public SpatialObject< TDimension >
39 {
40 public:
41 
46  typedef double ScalarType;
49  typedef typename Superclass::TransformType TransformType;
50  typedef typename TransformType::MatrixType MatrixType;
51 
53  itkNewMacro(Self);
54 
56  itkTypeMacro(ArrowSpatialObject, SpatialObject);
57 
59  void SetPosition(const PointType & p)
60  {
61  m_Position = p;
62  this->UpdateTransform();
63  }
65 
66  itkGetConstMacro(Position, PointType);
67 
68  void SetPosition(float x, float y)
69  {
70  m_Position[0] = x;
71  m_Position[1] = y;
72  this->UpdateTransform();
73  }
74 
75  void SetPosition(float x, float y, float z)
76  {
77  m_Position[0] = x;
78  m_Position[1] = y;
79  m_Position[2] = z;
80  this->UpdateTransform();
81  }
82 
84  void SetDirection(const VectorType & d)
85  {
86  m_Direction = d;
87  this->UpdateTransform();
88  }
90 
91  itkGetConstMacro(Direction, VectorType);
92 
93  void SetDirection(float x, float y)
94  {
95  m_Direction[0] = x;
96  m_Direction[1] = y;
97  this->UpdateTransform();
98  }
99 
100  void SetDirection(float x, float y, float z)
101  {
102  m_Direction[0] = x;
103  m_Direction[1] = y;
104  m_Direction[2] = z;
105  this->UpdateTransform();
106  }
107 
109  void SetLength(double length);
110 
112  itkGetConstReferenceMacro(Length, double);
113 
115  bool ComputeLocalBoundingBox() const ITK_OVERRIDE;
116 
118  bool IsInside(const PointType & point,
119  unsigned int depth, char *name) const ITK_OVERRIDE;
120 
124  virtual bool IsInside(const PointType & point) const;
125 
126 protected:
127 
129  virtual ~ArrowSpatialObject() ITK_OVERRIDE;
130 
132  void UpdateTransform();
133 
135  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
136 
137 private:
138  ITK_DISALLOW_COPY_AND_ASSIGN(ArrowSpatialObject);
139 
140  VectorType m_Direction;
141  PointType m_Position;
142  double m_Length;
143 };
144 } // end namespace itk
145 
146 #ifndef ITK_MANUAL_INSTANTIATION
147 #include "itkArrowSpatialObject.hxx"
148 #endif
149 
150 #endif // itkArrowSpatialObject_h
void SetDirection(const VectorType &d)
void SetPosition(float x, float y)
SmartPointer< Self > Pointer
SpatialObject< TDimension > Superclass
void SetDirection(float x, float y, float z)
Vector< double, TDimension > VectorType
Implementation of the composite pattern.
SmartPointer< const Self > ConstPointer
Point< double, TDimension > PointType
TransformType::MatrixType MatrixType
void SetDirection(float x, float y)
Representation of a Arrow based on the spatial object classes.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void SetPosition(const PointType &p)
void SetPosition(float x, float y, float z)
Base class for all data objects in ITK.
Superclass::TransformType TransformType