ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkSimplexMesh_h 00019 #define __itkSimplexMesh_h 00020 00021 00022 #include "itkMesh.h" 00023 #include "itkSimplexMeshGeometry.h" 00024 #include "itkVertexCell.h" 00025 #include "itkTriangleCell.h" 00026 #include "itkFixedArray.h" 00027 #include <vector> 00028 #include <algorithm> 00029 #include <set> 00030 00031 namespace itk 00032 { 00044 template< typename TPixelType, unsigned int VDimension = 3, 00045 typename TMeshTraits = 00046 DefaultStaticMeshTraits< TPixelType, VDimension, VDimension, TPixelType, TPixelType, TPixelType > 00047 > 00048 class SimplexMesh:public Mesh< TPixelType, VDimension, TMeshTraits > 00049 { 00050 public: 00052 typedef SimplexMesh Self; 00053 00055 typedef Mesh< TPixelType, VDimension, TMeshTraits > Superclass; 00056 00058 typedef SmartPointer< Self > Pointer; 00059 00061 typedef SmartPointer< const Self > ConstPointer; 00062 00064 typedef typename SimplexMeshGeometry::IndexArray IndexArray; 00065 00067 typedef std::set< SizeValueType > NeighborSetType; 00068 00070 typedef typename NeighborSetType::iterator NeighborSetIterator; 00071 00073 typedef std::vector< SizeValueType > NeighborListType; 00074 00076 typedef typename TMeshTraits::PointType PointType; 00077 00079 typedef typename TMeshTraits::PointIdentifier PointIdentifier; 00080 00082 typedef typename PointType::VectorType VectorType; 00083 00085 typedef CovariantVector< typename VectorType::ValueType, 3 > CovariantVectorType; 00086 00088 typedef typename Superclass::CellType CellType; 00089 00091 typedef typename CellType::CellAutoPointer CellAutoPointer; 00092 00094 typedef itk::LineCell< CellType > LineType; 00095 00098 typedef itk::MapContainer< SizeValueType, SimplexMeshGeometry * > GeometryMapType; 00099 00101 typedef typename GeometryMapType::Pointer GeometryMapPointer; 00102 00104 typedef typename GeometryMapType::Iterator GeometryMapIterator; 00105 typedef typename GeometryMapType::ConstIterator GeometryMapConstIterator; 00106 00108 itkNewMacro(Self); 00109 00111 itkTypeMacro(SimplexMesh, Mesh); 00112 00114 typedef TMeshTraits MeshTraits; 00115 typedef typename MeshTraits::PixelType PixelType; 00116 typedef typename MeshTraits::PointsContainer PointsContainer; 00117 typedef typename Superclass::PointsContainerPointer PointsContainerPointer; 00118 typedef typename Superclass::PointsContainer::Iterator PointsContainerIterator; 00119 typedef typename Superclass::PointsContainerConstIterator PointsContainerConstIterator; 00120 typedef typename Superclass::CellsContainerPointer CellsContainerPointer; 00121 typedef typename Superclass::CellsContainerConstPointer CellsContainerConstPointer; 00122 typedef typename Superclass::CellsContainerIterator CellsContainerIterator; 00123 typedef typename Superclass::CellsContainerConstIterator CellsContainerConstIterator; 00124 typedef typename Superclass::CellIdentifier CellIdentifier; 00125 00127 itkSetMacro(GeometryData, GeometryMapPointer); 00128 00130 itkGetConstReferenceMacro(GeometryData, GeometryMapPointer); 00131 00133 itkSetMacro(LastCellId, CellIdentifier); 00134 00136 itkGetConstMacro(LastCellId, CellIdentifier); 00137 00142 virtual void CopyInformation(const DataObject *data); 00143 00150 CellIdentifier AddEdge(PointIdentifier startPointId, PointIdentifier endPointId); 00151 00159 CellIdentifier AddFace(CellAutoPointer & cellPointer); 00160 00165 CellIdentifier ReplaceFace(CellIdentifier replaceIndex, CellAutoPointer & cellPointer); 00166 00170 IndexArray GetNeighbors(PointIdentifier pointId) const; 00171 00175 NeighborListType * GetNeighbors(PointIdentifier pointId, unsigned int radius, NeighborListType *list = NULL) const; 00176 00182 void AddNeighbor(PointIdentifier pointId, PointIdentifier neighborId); 00183 00187 void ReplaceNeighbor(PointIdentifier pointId, PointIdentifier oldNeighborId, PointIdentifier newNeighborIdx); 00188 00192 void SwapNeighbors(PointIdentifier pointId, PointIdentifier firstNeighborId, PointIdentifier secondNeighborId); 00193 00197 void SetGeometryData(PointIdentifier pointId, SimplexMeshGeometry *); 00198 00202 void SetBarycentricCoordinates(PointIdentifier idx, PointType values); 00203 00207 PointType GetBarycentricCoordinates(PointIdentifier idx) const; 00208 00212 void SetReferenceMetrics(PointIdentifier idx, PointType values); 00213 00217 PointType GetReferenceMetrics(PointIdentifier idx) const; 00218 00222 void SetPhi(PointIdentifier idx, double values); 00223 00227 double GetPhi(PointIdentifier idx) const; 00228 00232 void SetMeanCurvature(PointIdentifier idx, double values); 00233 00237 double GetMeanCurvature(PointIdentifier idx) const; 00238 00242 void SetRadius(PointIdentifier idx, double values); 00243 00247 double GetRadius(PointIdentifier idx) const; 00248 00252 void SetDistance(PointIdentifier idx, double values); 00253 00257 double GetDistance(PointIdentifier idx) const; 00258 00260 CovariantVectorType ComputeNormal(PointIdentifier idx) const; 00261 00262 protected: 00264 SimplexMesh(); 00265 virtual ~SimplexMesh(); 00266 void PrintSelf(std::ostream & os, Indent indent) const; 00268 00272 GeometryMapPointer m_GeometryData; 00273 00280 CellIdentifier m_LastCellId; 00281 00282 private: 00283 SimplexMesh(const Self &); //purposely not implemented 00284 // void operator=(const Self&); //purposely not implemented 00285 }; // End Class: SimplexMesh 00286 } // end namespace itk 00287 00288 #ifndef ITK_MANUAL_INSTANTIATION 00289 #include "itkSimplexMesh.hxx" 00290 #endif 00291 00292 #endif 00293