ITK  4.6.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 
22 #include "itkSpatialObject.h"
23 
24 namespace itk
25 {
37 template< unsigned int TDimension = 3 >
39  public SpatialObject< TDimension >
40 {
41 public:
42 
47  typedef double ScalarType;
51  typedef typename TransformType::MatrixType MatrixType;
52 
54  itkNewMacro(Self);
55 
57  itkTypeMacro(ArrowSpatialObject, SpatialObject);
58 
60  void SetPosition(const PointType & p)
61  {
62  m_Position = p;
63  this->UpdateTransform();
64  }
66 
67  itkGetConstMacro(Position, PointType);
68 
69  void SetPosition(float x, float y)
70  {
71  m_Position[0] = x;
72  m_Position[1] = y;
73  this->UpdateTransform();
74  }
75 
76  void SetPosition(float x, float y, float z)
77  {
78  m_Position[0] = x;
79  m_Position[1] = y;
80  m_Position[2] = z;
81  this->UpdateTransform();
82  }
83 
85  void SetDirection(const VectorType & d)
86  {
87  m_Direction = d;
88  this->UpdateTransform();
89  }
91 
92  itkGetConstMacro(Direction, VectorType);
93 
94  void SetDirection(float x, float y)
95  {
96  m_Direction[0] = x;
97  m_Direction[1] = y;
98  this->UpdateTransform();
99  }
100 
101  void SetDirection(float x, float y, float z)
102  {
103  m_Direction[0] = x;
104  m_Direction[1] = y;
105  m_Direction[2] = z;
106  this->UpdateTransform();
107  }
108 
110  void SetLength(double length);
111 
113  itkGetConstReferenceMacro(Length, double);
114 
116  bool ComputeLocalBoundingBox() const;
117 
119  bool IsInside(const PointType & point,
120  unsigned int depth, char *name) const;
121 
125  virtual bool IsInside(const PointType & point) const;
126 
127 protected:
128 
130  virtual ~ArrowSpatialObject();
131 
133  void UpdateTransform();
134 
136  virtual void PrintSelf(std::ostream & os, Indent indent) const;
137 
138 private:
139  ArrowSpatialObject(const Self &); //purposely not implemented
140  void operator=(const Self &); //purposely not implemented
141 
144  double m_Length;
145 };
146 } // end namespace itk
147 
148 #ifndef ITK_MANUAL_INSTANTIATION
149 #include "itkArrowSpatialObject.hxx"
150 #endif
151 
152 #endif // __itkArrowSpatialObject_h
void SetDirection(const VectorType &d)
void SetPosition(float x, float y)
void SetLength(double length)
SmartPointer< Self > Pointer
SpatialObject< TDimension > Superclass
bool IsInside(const PointType &point, unsigned int depth, char *name) const
virtual void PrintSelf(std::ostream &os, Indent indent) const
void SetDirection(float x, float y, float z)
Vector< double, TDimension > VectorType
Implementation of the composite pattern.
SmartPointer< const Self > ConstPointer
void operator=(const Self &)
Point< double, TDimension > PointType
TransformType::MatrixType MatrixType
void SetDirection(float x, float y)
bool ComputeLocalBoundingBox() const
Representation of a Arrow based on the spatial object classes.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ScalableAffineTransform< double, VDimension > TransformType
void SetPosition(const PointType &p)
void SetPosition(float x, float y, float z)
Base class for all data objects in ITK.
Superclass::TransformType TransformType