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

itkMesh.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMesh.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/10/15 15:46:05 $ 00007 Version: $Revision: 1.88 $ 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 Portions of this code are covered under the VTK copyright. 00013 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00014 00015 This software is distributed WITHOUT ANY WARRANTY; without even 00016 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 PURPOSE. See the above copyright notices for more information. 00018 00019 =========================================================================*/ 00020 #ifndef __itkMesh_h 00021 #define __itkMesh_h 00022 00023 #if defined(_MSC_VER) 00024 #pragma warning ( disable : 4786 ) 00025 #endif 00026 00027 #include "itkPointSet.h" 00028 #include "itkCellInterface.h" 00029 #include "itkMapContainer.h" 00030 #include <vector> 00031 #include <set> 00032 00033 00034 namespace itk 00035 { 00036 00043 template <typename TMesh> 00044 struct GetMeshDimension 00045 { 00046 itkStaticConstMacro(MaxTopologicalDimension, unsigned int, TMesh::MaxTopologicalDimension); 00047 itkStaticConstMacro(PointDimension, unsigned int, TMesh::PointDimension); 00048 }; 00049 00050 00110 template < 00111 typename TPixelType, 00112 unsigned int VDimension = 3, 00113 typename TMeshTraits = DefaultStaticMeshTraits< TPixelType , VDimension, VDimension > 00114 > 00115 class ITK_EXPORT Mesh : public PointSet<TPixelType, VDimension, TMeshTraits> 00116 { 00117 public: 00119 typedef Mesh Self; 00120 typedef PointSet<TPixelType, VDimension, TMeshTraits> Superclass; 00121 typedef SmartPointer<Self> Pointer; 00122 typedef SmartPointer<const Self> ConstPointer; 00123 00124 typedef typename Superclass::RegionType RegionType; 00125 00127 itkNewMacro(Self); 00128 00130 itkTypeMacro(Mesh, PointSet); 00131 00133 typedef TMeshTraits MeshTraits; 00134 typedef typename MeshTraits::PixelType PixelType; 00135 typedef typename MeshTraits::CellPixelType CellPixelType; 00136 00138 itkStaticConstMacro(PointDimension, unsigned int, 00139 TMeshTraits::PointDimension); 00140 itkStaticConstMacro(MaxTopologicalDimension, unsigned int, 00141 TMeshTraits::MaxTopologicalDimension); 00142 00145 typedef enum { CellsAllocationMethodUndefined, 00146 CellsAllocatedAsStaticArray, 00147 CellsAllocatedAsADynamicArray, 00148 CellsAllocatedDynamicallyCellByCell 00149 } CellsAllocationMethodType; 00150 00152 typedef typename MeshTraits::CoordRepType CoordRepType; 00153 typedef typename MeshTraits::InterpolationWeightType InterpolationWeightType; 00154 typedef typename MeshTraits::PointIdentifier PointIdentifier; 00155 typedef typename MeshTraits::CellIdentifier CellIdentifier; 00156 typedef typename MeshTraits::CellFeatureIdentifier CellFeatureIdentifier; 00157 typedef typename MeshTraits::PointType PointType; 00158 typedef typename MeshTraits::PointsContainer PointsContainer; 00159 typedef typename MeshTraits::CellTraits CellTraits; 00160 typedef typename MeshTraits::CellsContainer CellsContainer; 00161 typedef typename MeshTraits::PointCellLinksContainer PointCellLinksContainer; 00162 typedef typename MeshTraits::CellLinksContainer CellLinksContainer; 00163 typedef typename MeshTraits::PointDataContainer PointDataContainer; 00164 typedef typename MeshTraits::CellDataContainer CellDataContainer; 00165 00167 typedef PointLocator<PointIdentifier,itkGetStaticConstMacro(PointDimension), 00168 CoordRepType,PointsContainer> PointLocatorType; 00169 typedef BoundingBox<PointIdentifier,itkGetStaticConstMacro(PointDimension), 00170 CoordRepType,PointsContainer> BoundingBoxType; 00171 00173 typedef typename PointsContainer::Pointer PointsContainerPointer; 00174 typedef typename CellsContainer::Pointer CellsContainerPointer; 00175 typedef typename CellLinksContainer::Pointer CellLinksContainerPointer; 00176 typedef typename PointDataContainer::Pointer PointDataContainerPointer; 00177 typedef typename CellDataContainer::Pointer CellDataContainerPointer; 00178 typedef typename PointLocatorType::Pointer PointLocatorPointer; 00179 typedef typename BoundingBoxType::Pointer BoundingBoxPointer; 00180 00182 typedef typename 00183 PointsContainer::ConstIterator PointsContainerConstIterator; 00184 typedef typename 00185 PointsContainer::Iterator PointsContainerIterator; 00186 typedef typename 00187 CellsContainer::ConstIterator CellsContainerConstIterator; 00188 typedef typename 00189 CellsContainer::Iterator CellsContainerIterator; 00190 typedef typename 00191 CellLinksContainer::ConstIterator CellLinksContainerIterator; 00192 typedef typename 00193 PointDataContainer::ConstIterator PointDataContainerIterator; 00194 typedef typename 00195 CellDataContainer::ConstIterator CellDataContainerIterator; 00196 typedef typename 00197 PointCellLinksContainer::const_iterator PointCellLinksContainerIterator; 00198 00200 typedef CellFeatureIdentifier CellFeatureCount; 00201 00203 typedef CellInterface<CellPixelType,CellTraits> CellType; 00204 typedef typename CellType::CellAutoPointer CellAutoPointer; 00205 00207 typedef typename CellType::MultiVisitor CellMultiVisitorType; 00208 00209 00210 00218 class BoundaryAssignmentIdentifier 00219 { 00220 public: 00222 typedef BoundaryAssignmentIdentifier Self; 00223 00226 BoundaryAssignmentIdentifier() {} 00227 BoundaryAssignmentIdentifier(CellIdentifier cellId, 00228 CellFeatureIdentifier featureId): 00229 m_CellId(cellId), m_FeatureId(featureId) {} 00230 00232 CellIdentifier m_CellId; 00233 00235 CellFeatureIdentifier m_FeatureId; 00236 00239 bool operator < (const Self& r) const 00240 { 00241 return ((m_CellId < r.m_CellId) || 00242 ((m_CellId == r.m_CellId) && (m_FeatureId < r.m_FeatureId))); 00243 } 00244 00247 bool operator == (const Self& r) const 00248 { 00249 return ((m_CellId == r.m_CellId) && (m_FeatureId == r.m_FeatureId)); 00250 } 00251 }; // End Class: Mesh::BoundaryAssignmentIdentifier 00252 00253 00261 typedef MapContainer< BoundaryAssignmentIdentifier , CellIdentifier > 00262 BoundaryAssignmentsContainer; 00263 typedef typename BoundaryAssignmentsContainer::Pointer 00264 BoundaryAssignmentsContainerPointer; 00265 typedef std::vector< BoundaryAssignmentsContainerPointer > 00266 BoundaryAssignmentsContainerVector; 00267 00268 00269 protected: 00270 00273 CellsContainerPointer m_CellsContainer; 00274 00279 CellDataContainerPointer m_CellDataContainer; 00280 00284 CellLinksContainerPointer m_CellLinksContainer; 00285 00295 BoundaryAssignmentsContainerVector m_BoundaryAssignmentsContainers; 00296 00297 public: 00299 unsigned long GetNumberOfCells() const; 00300 void PassStructure(Self* inputMesh); 00301 virtual void Initialize(); 00302 00307 void SetCellLinks(CellLinksContainer*); 00308 CellLinksContainerPointer GetCellLinks(); 00309 const CellLinksContainerPointer GetCellLinks() const; 00310 00313 void SetCells(CellsContainer*); 00314 CellsContainerPointer GetCells(); 00315 const CellsContainerPointer GetCells() const; 00316 00321 void SetCellData(CellDataContainer*); 00322 CellDataContainerPointer GetCellData(); 00323 const CellDataContainerPointer GetCellData() const; 00324 00333 void SetBoundaryAssignments(int dimension, 00334 BoundaryAssignmentsContainer*); 00335 BoundaryAssignmentsContainerPointer GetBoundaryAssignments(int dimension); 00336 const BoundaryAssignmentsContainerPointer GetBoundaryAssignments( 00337 int dimension) const; 00338 00344 void SetCell(CellIdentifier, CellAutoPointer & ); 00345 bool GetCell(CellIdentifier, CellAutoPointer & ) const; 00346 00349 void SetCellData(CellIdentifier, CellPixelType); 00350 bool GetCellData(CellIdentifier, CellPixelType*) const; 00351 00364 void SetBoundaryAssignment(int dimension, CellIdentifier cellId, 00365 CellFeatureIdentifier featureId, 00366 CellIdentifier boundaryId); 00367 00376 bool GetBoundaryAssignment(int dimension, CellIdentifier cellId, 00377 CellFeatureIdentifier featureId, 00378 CellIdentifier* boundaryId) const; 00379 bool RemoveBoundaryAssignment(int dimension, CellIdentifier cellId, 00380 CellFeatureIdentifier featureId); 00381 00383 CellFeatureCount GetNumberOfCellBoundaryFeatures(int dimension, 00384 CellIdentifier) const; 00385 00388 bool GetCellBoundaryFeature(int dimension, CellIdentifier, 00389 CellFeatureIdentifier, CellAutoPointer& ) const; 00390 00395 unsigned long GetCellBoundaryFeatureNeighbors( 00396 int dimension, CellIdentifier, CellFeatureIdentifier, 00397 std::set<CellIdentifier>* cellSet); 00398 00403 unsigned long GetCellNeighbors( CellIdentifier cellId, 00404 std::set<CellIdentifier>* cellSet ); 00405 00413 bool GetAssignedCellBoundaryIfOneExists(int dimension, CellIdentifier, 00414 CellFeatureIdentifier, 00415 CellAutoPointer& ) const; 00416 00419 void BuildCellLinks(); 00420 00424 BoundingBoxPointer GetCellBoundingBox(CellIdentifier cellId, 00425 BoundingBoxPointer bbox); 00426 00430 virtual void Accept(CellMultiVisitorType* mv); 00431 00433 virtual void UpdateOutputInformation(); 00434 virtual void SetRequestedRegionToLargestPossibleRegion(); 00435 virtual void CopyInformation(const DataObject *data); 00436 virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); 00437 virtual bool VerifyRequestedRegion(); 00438 00441 int GetMaximumNumberOfRegions() const 00442 {return m_MaximumNumberOfRegions;} 00443 00448 virtual void SetRequestedRegion(DataObject *data); 00449 00451 virtual void SetRequestedRegion( const RegionType & region ); 00452 itkGetMacro( RequestedRegion, RegionType ); 00453 00458 itkSetMacro( CellsAllocationMethod, CellsAllocationMethodType ); 00459 itkGetConstMacro( CellsAllocationMethod, CellsAllocationMethodType ); 00460 00461 protected: 00463 Mesh(); 00464 ~Mesh(); 00465 void PrintSelf(std::ostream& os, Indent indent) const; 00466 00470 void ReleaseCellsMemory(); 00471 00472 private: 00473 Mesh(const Self&); //purposely not implemented 00474 void operator=(const Self&); //purposely not implemented 00475 00476 CellsAllocationMethodType m_CellsAllocationMethod; 00477 00478 }; // End Class: Mesh 00479 00480 } // end namespace itk 00481 00482 #ifndef ITK_MANUAL_INSTANTIATION 00483 #include "itkMesh.txx" 00484 #endif 00485 00486 #endif 00487 00488 00489

Generated at Sun Apr 1 02:37:46 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000