ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkMeshSpatialObject.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 __itkMeshSpatialObject_h
19 #define __itkMeshSpatialObject_h
20 
21 #include "itkMesh.h"
22 #include "itkSpatialObject.h"
23 
24 namespace itk
25 {
36 template< class TMesh = Mesh< int > >
37 class ITK_EXPORT MeshSpatialObject:
38  public SpatialObject< ::itk::GetMeshDimension< TMesh >::PointDimension >
39 {
40 public:
41 
42  typedef double ScalarType;
44 
45  itkStaticConstMacro(Dimension, unsigned int, TMesh::PointDimension);
46 
50 
51  typedef TMesh MeshType;
52  typedef typename MeshType::Pointer MeshPointer;
54  typedef typename Superclass::PointType PointType;
55  typedef typename Superclass::BoundingBoxType BoundingBoxType;
56 
59 
61  itkNewMacro(Self);
62 
64  itkTypeMacro(MeshSpatialObject, SpatialObject);
65 
67  void SetMesh(MeshType *Mesh);
68 
70  MeshType * GetMesh(void);
71  const MeshType *GetMesh(void) const;
73 
76  bool IsEvaluableAt(const PointType & point,
77  unsigned int depth = 0, char *name = NULL) const;
78 
82  bool ValueAt(const PointType & point, double & value,
83  unsigned int depth = 0, char *name = NULL) const;
84 
86  bool IsInside(const PointType & point,
87  unsigned int depth, char *name) const;
88 
92  virtual bool IsInside(const PointType & point) const;
93 
95  bool ComputeLocalBoundingBox() const;
96 
98  unsigned long GetMTime(void) const;
99 
101  const char * GetPixelType()
102  {
103  return m_PixelType.c_str();
104  }
105 
112  itkSetMacro(IsInsidePrecision, double);
113  itkGetMacro(IsInsidePrecision, double);
114 protected:
116 
118  std::string m_PixelType;
120 
122  virtual ~MeshSpatialObject();
123 
124  void PrintSelf(std::ostream & os, Indent indent) const;
125 };
126 } // end of namespace itk
127 
128 #ifndef ITK_MANUAL_INSTANTIATION
129 #include "itkMeshSpatialObject.hxx"
130 #endif
131 
132 #endif //__itkMeshSpatialObject_h
133