ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkSurfaceSpatialObject.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkSurfaceSpatialObject_h
00019 #define __itkSurfaceSpatialObject_h
00020 
00021 #include <list>
00022 
00023 #include "itkPointBasedSpatialObject.h"
00024 #include "itkSurfaceSpatialObjectPoint.h"
00025 
00026 namespace itk
00027 {
00038 template< unsigned int TDimension = 3 >
00039 class ITK_EXPORT SurfaceSpatialObject:
00040   public PointBasedSpatialObject<  TDimension >
00041 {
00042 public:
00043 
00044   typedef SurfaceSpatialObject                         Self;
00045   typedef PointBasedSpatialObject< TDimension >        Superclass;
00046   typedef SmartPointer< Self >                         Pointer;
00047   typedef SmartPointer< const Self >                   ConstPointer;
00048   typedef double                                       ScalarType;
00049   typedef SurfaceSpatialObjectPoint< TDimension >      SurfacePointType;
00050   typedef std::vector< SurfacePointType >              PointListType;
00051   typedef typename Superclass::SpatialObjectPointType  SpatialObjectPointType;
00052   typedef typename Superclass::PointType               PointType;
00053   typedef typename Superclass::TransformType           TransformType;
00054   typedef VectorContainer< IdentifierType, PointType > PointContainerType;
00055   typedef SmartPointer< PointContainerType >           PointContainerPointer;
00056   typedef typename Superclass::BoundingBoxType         BoundingBoxType;
00057   typedef typename Superclass::CovariantVectorType     CovariantVectorType;
00058 
00060   itkNewMacro(Self);
00061 
00063   itkTypeMacro(SurfaceSpatialObject, PointBasedSpatialObject);
00064 
00066   PointListType & GetPoints(void);
00067   const PointListType & GetPoints(void) const;
00069 
00071   const SpatialObjectPointType * GetPoint(IdentifierType id) const
00072   {
00073     return &( m_Points[id] );
00074   }
00075 
00077   SpatialObjectPointType * GetPoint(IdentifierType id) { return &( m_Points[id] ); }
00078 
00080   SizeValueType GetNumberOfPoints(void) const { return m_Points.size(); }
00081 
00083   void SetPoints(PointListType & newPoints);
00084 
00087   bool IsEvaluableAt(const PointType & point,
00088                      unsigned int depth = 0, char *name = NULL) const;
00089 
00094   bool ValueAt(const PointType & point, double & value,
00095                unsigned int depth = 0, char *name = NULL) const;
00096 
00098   bool IsInside(const PointType & point,
00099                 unsigned int depth, char *name) const;
00100 
00104   virtual bool IsInside(const PointType & point) const;
00105 
00107   bool ComputeLocalBoundingBox() const;
00108 
00110   bool Approximate3DNormals();
00111 
00112 protected:
00113   SurfaceSpatialObject(const Self &); //purposely not implemented
00114   void operator=(const Self &);       //purposely not implemented
00115 
00116   PointListType m_Points;
00117 
00118   SurfaceSpatialObject();
00119   virtual ~SurfaceSpatialObject();
00120 
00122   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00123 };
00124 } // end namespace itk
00125 
00126 #ifndef ITK_MANUAL_INSTANTIATION
00127 #include "itkSurfaceSpatialObject.hxx"
00128 #endif
00129 
00130 #endif // __itkSurfaceSpatialObject_h
00131