ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMeshSpatialObject.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 __itkMeshSpatialObject_h
00019 #define __itkMeshSpatialObject_h
00020 
00021 #include "itkMesh.h"
00022 #include "itkSpatialObject.h"
00023 
00024 namespace itk
00025 {
00036 template< class TMesh = Mesh< int > >
00037 class ITK_EXPORT MeshSpatialObject:
00038   public SpatialObject< ::itk::GetMeshDimension< TMesh >::PointDimension >
00039 {
00040 public:
00041 
00042   typedef double                     ScalarType;
00043   typedef MeshSpatialObject< TMesh > Self;
00044 
00045   itkStaticConstMacro(Dimension, unsigned int, TMesh::PointDimension);
00046 
00047   typedef SpatialObject< itkGetStaticConstMacro(Dimension) > Superclass;
00048   typedef SmartPointer< Self >                               Pointer;
00049   typedef SmartPointer< const Self >                         ConstPointer;
00050 
00051   typedef TMesh                                MeshType;
00052   typedef typename MeshType::Pointer           MeshPointer;
00053   typedef typename Superclass::TransformType   TransformType;
00054   typedef typename Superclass::PointType       PointType;
00055   typedef typename Superclass::BoundingBoxType BoundingBoxType;
00056 
00057   typedef VectorContainer< IdentifierType, PointType > PointContainerType;
00058   typedef typename PointContainerType::Pointer         PointContainerPointer;
00059 
00061   itkNewMacro(Self);
00062 
00064   itkTypeMacro(MeshSpatialObject, SpatialObject);
00065 
00067   void SetMesh(MeshType *Mesh);
00068 
00070   MeshType * GetMesh(void);
00071   const MeshType *GetMesh(void) const;
00073 
00076   bool IsEvaluableAt(const PointType & point,
00077                      unsigned int depth = 0, char *name = NULL) const;
00078 
00082   bool ValueAt(const PointType & point, double & value,
00083                unsigned int depth = 0, char *name = NULL) const;
00084 
00086   bool IsInside(const PointType & point,
00087                 unsigned int depth, char *name) const;
00088 
00092   virtual bool IsInside(const PointType & point) const;
00093 
00095   bool ComputeLocalBoundingBox() const;
00096 
00098   unsigned long GetMTime(void) const;
00099 
00101   const char * GetPixelType()
00102   {
00103     return m_PixelType.c_str();
00104   }
00105 
00112   itkSetMacro(IsInsidePrecision, double);
00113   itkGetMacro(IsInsidePrecision, double);
00114 protected:
00116 
00117   MeshPointer m_Mesh;
00118   std::string m_PixelType;
00119   double      m_IsInsidePrecision;
00120 
00121   MeshSpatialObject();
00122   virtual ~MeshSpatialObject();
00123 
00124   void PrintSelf(std::ostream & os, Indent indent) const;
00125 };
00126 } // end of namespace itk
00127 
00128 #ifndef ITK_MANUAL_INSTANTIATION
00129 #include "itkMeshSpatialObject.hxx"
00130 #endif
00131 
00132 #endif //__itkMeshSpatialObject_h
00133