Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkArrowSpatialObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkArrowSpatialObject.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-04-19 22:31:05 $
00007   Version:   $Revision: 1.6 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkArrowSpatialObject_h
00018 #define __itkArrowSpatialObject_h
00019 
00020 #if defined(_MSC_VER)
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023 
00024 #include "itkSpatialObject.h"
00025 
00026 namespace itk 
00027 {
00028 
00039 template < unsigned int TDimension = 3 >
00040 class ArrowSpatialObject 
00041   :public SpatialObject< TDimension >
00042 {
00043 
00044 public:
00045 
00046   typedef ArrowSpatialObject                     Self;
00047   typedef SpatialObject< TDimension >            Superclass;
00048   typedef SmartPointer < Self >                  Pointer;
00049   typedef SmartPointer < const Self >            ConstPointer;
00050   typedef double                                 ScalarType;
00051   typedef Vector<double,TDimension>              VectorType;
00052   typedef Point<double,TDimension>               PointType;
00053   typedef typename Superclass::TransformType     TransformType;
00054   typedef typename TransformType::MatrixType     MatrixType;
00055 
00056 
00058   itkNewMacro( Self );
00059 
00061   itkTypeMacro( ArrowSpatialObject, SpatialObject );
00062 
00063 
00065   void SetPosition(const PointType & p)
00066     {
00067     m_Position = p;
00068     this->UpdateTransform();
00069     }
00071 
00072   itkGetConstMacro(Position,PointType);
00073 
00074   void SetPosition(float x, float y)
00075     {
00076     m_Position[0] = x;
00077     m_Position[1] = y;
00078     this->UpdateTransform();
00079     }
00080 
00081   void SetPosition(float x, float y,float z)
00082     {
00083     m_Position[0] = x;
00084     m_Position[1] = y;
00085     m_Position[2] = z;
00086     this->UpdateTransform();
00087     }
00088 
00090   void SetDirection(const VectorType & d)
00091     {
00092     m_Direction = d;
00093     this->UpdateTransform();
00094     }
00096 
00097   itkGetConstMacro(Direction,VectorType);
00098   
00099   void SetDirection(float x, float y)
00100     {
00101     m_Direction[0] = x;
00102     m_Direction[1] = y;
00103     this->UpdateTransform();
00104     }
00105 
00106   void SetDirection(float x, float y,float z)
00107     {
00108     m_Direction[0] = x;
00109     m_Direction[1] = y;
00110     m_Direction[2] = z;
00111     this->UpdateTransform();
00112     }
00113 
00115   void SetLength(double length);
00116   void SetLenght(double length)
00117   {
00118   itkWarningMacro("Please change your code to use SetLength rather than SetLenght. The latter method name was mispelled and the ITK developers failed to correct it before it was released. The mispelled method name is retained in order to maintain backward compatibility.");
00119   this->SetLength(length);
00120   return;
00121   }
00123 
00125   itkGetMacro(Length,double);
00126 
00129   double GetLenght() {return this->GetLength();}
00130 
00132   bool ComputeLocalBoundingBox() const;
00133 
00135   bool IsInside( const PointType & point, 
00136                  unsigned int depth, char * name) const;
00137 
00141   virtual bool IsInside( const PointType & point) const;
00142 
00143 
00144 protected:
00145 
00146   ArrowSpatialObject();
00147   virtual ~ArrowSpatialObject();
00148 
00150   void UpdateTransform();
00151 
00153   virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00154 
00155 private:
00156   ArrowSpatialObject(const Self&); //purposely not implemented
00157   void operator=(const Self&); //purposely not implemented
00158    
00159   VectorType   m_Direction;
00160   PointType    m_Position;
00161   double       m_Length;
00162 
00163 };
00164 
00165 } // end namespace itk
00166 
00167 #ifndef ITK_MANUAL_INSTANTIATION 
00168 #include "itkArrowSpatialObject.txx" 
00169 #endif 
00170 
00171 #endif // __itkArrowSpatialObject_h
00172 

Generated at Tue Jul 29 19:07:18 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000