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

itkContourSpatialObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkContourSpatialObject.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006-06-06 15:42:16 $
00007   Version:   $Revision: 1.4 $
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 
00018 #ifndef __itkContourSpatialObject_h
00019 #define __itkContourSpatialObject_h
00020 
00021 #include <list>
00022 
00023 #include "itkPointBasedSpatialObject.h"
00024 #include "itkSpatialObjectPoint.h"
00025 #include "itkContourSpatialObjectPoint.h"
00026 
00027 namespace itk 
00028 {
00029 
00039 template < unsigned int TDimension = 3 >
00040 class ContourSpatialObject 
00041   :public PointBasedSpatialObject<  TDimension >
00042 {
00043 
00044 public:
00045 
00046   typedef ContourSpatialObject                     Self;
00047   typedef PointBasedSpatialObject< TDimension>     Superclass;
00048   typedef SmartPointer < Self >                    Pointer;
00049   typedef SmartPointer < const Self >              ConstPointer;
00050   typedef double                                   ScalarType;
00051   typedef ContourSpatialObjectPoint< TDimension >  ControlPointType;
00052   typedef SpatialObjectPoint< TDimension >         InterpolatedPointType;
00053   typedef std::vector < ControlPointType >         ControlPointListType;
00054   typedef std::vector < InterpolatedPointType >    InterpolatedPointListType;
00055 
00056   typedef typename Superclass::SpatialObjectPointType SpatialObjectPointType;
00057   typedef typename Superclass::PointType              PointType;
00058   typedef typename Superclass::TransformType          TransformType;
00059   typedef typename Superclass::BoundingBoxType        BoundingBoxType;
00060   typedef VectorContainer<unsigned long,PointType>    PointContainerType;
00061   typedef SmartPointer<PointContainerType>            PointContainerPointer;
00062 
00064   itkNewMacro( Self );
00065 
00067   itkTypeMacro( ContourSpatialObject, PointBasedSpatialObject );
00068 
00070   ControlPointListType & GetControlPoints( void );
00071 
00073   const ControlPointListType & GetControlPoints( void ) const;
00074 
00076   void SetControlPoints( ControlPointListType & newPoints );
00077 
00079   const ControlPointType* GetControlPoint(unsigned long id) const 
00080     {return &(m_ControlPoints[id]);}
00081 
00083   ControlPointType* GetControlPoint(unsigned long id) 
00084     {return &(m_ControlPoints[id]);}
00085 
00087   unsigned long GetNumberOfControlPoints(void) const 
00088     {return m_ControlPoints.size();}
00089 
00091   InterpolatedPointListType & GetInterpolatedPoints( void );
00092 
00094   const InterpolatedPointListType & GetInterpolatedPoints( void ) const;
00095 
00097   void SetInterpolatedPoints( InterpolatedPointListType & newPoints );
00098 
00100   const InterpolatedPointType* GetInterpolatedPoint(unsigned long id) const 
00101     {return &(m_InterpolatedPoints[id]);}
00102 
00104   InterpolatedPointType* GetInterpolatedPoint(unsigned long id) 
00105     {return &(m_InterpolatedPoints[id]);}
00106 
00108   unsigned long GetNumberOfInterpolatedPoints(void) const 
00109     {return m_InterpolatedPoints.size();}
00110 
00111   enum InterpolationType {NO_INTERPOLATION=0,
00112     EXPLICIT_INTERPOLATION, BEZIER_INTERPOLATION, 
00113     LINEAR_INTERPOLATION
00114     };
00115 
00117   InterpolationType GetInterpolationType() const
00118     { return m_InterpolationType; }
00119   void SetInterpolationType(InterpolationType interpolation)
00120     {m_InterpolationType = interpolation;}
00122 
00124   itkSetMacro(Closed,bool);
00125   itkGetConstMacro(Closed,bool);
00127 
00129   itkSetMacro(DisplayOrientation,int);
00130   itkGetConstMacro(DisplayOrientation,int);
00132 
00135   itkSetMacro(AttachedToSlice,int);
00136   itkGetConstMacro(AttachedToSlice,int);
00138 
00141   bool IsEvaluableAt( const PointType & point, 
00142                       unsigned int depth=0, char *name = NULL ) const;
00143 
00148   bool ValueAt( const PointType & point, double & value,
00149                 unsigned int depth=0, char *name = NULL ) const;
00150 
00152   bool IsInside( const PointType & point,
00153                  unsigned int depth, char *name) const;
00154 
00158   virtual bool IsInside( const PointType & point) const;
00159 
00161   bool ComputeLocalBoundingBox( void ) const;
00162 
00163 protected:
00164   ContourSpatialObject(const Self&); //purposely not implemented
00165   void operator=(const Self&); //purposely not implemented
00166    
00167   ControlPointListType        m_ControlPoints;
00168   InterpolatedPointListType   m_InterpolatedPoints;
00169   InterpolationType           m_InterpolationType;
00170   bool                        m_Closed;
00171   int                         m_DisplayOrientation;
00172   long int                    m_AttachedToSlice;
00173 
00174   ContourSpatialObject();
00175   virtual ~ContourSpatialObject();
00176 
00178   virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00179 };
00180 
00181 } // end namespace itk
00182 
00183 #ifndef ITK_MANUAL_INSTANTIATION 
00184 #include "itkContourSpatialObject.txx" 
00185 #endif 
00186 
00187 #endif // __itkContourSpatialObject_h
00188 

Generated at Mon Apr 14 12:06:24 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000