| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkDefaultStaticMeshTraits.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:34 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
|
#ifndef __itkDefaultStaticMeshTraits_h |
| 18 |
|
#define __itkDefaultStaticMeshTraits_h |
| 19 |
|
|
| 20 |
|
#include "itkCellInterface.h" |
| 21 |
|
#include "itkVectorContainer.h" |
| 22 |
|
#include "itkPoint.h" |
| 23 |
|
#include <set> |
| 24 |
|
|
| 25 |
|
namespace itk |
| 26 |
|
{ |
| 27 |
|
|
| 28 |
|
/** \class DefaultStaticMeshTraits |
| 29 |
|
* DefaultStaticMeshTraits is a simple structure that holds type information |
| 30 |
|
* for a mesh and its cells. It is used to avoid the passing of many |
| 31 |
|
* template parameters while still enjoying the benefits of generic |
| 32 |
|
* programming. |
| 33 |
|
* |
| 34 |
|
* Template parameters for DefaultStaticMeshTraits: |
| 35 |
|
* |
| 36 |
|
* TPixelType = |
| 37 |
|
* The type stored as data for an entity (cell, point, or boundary). |
| 38 |
|
* |
| 39 |
|
* VPointDimension = |
| 40 |
|
* Geometric dimension of space. |
| 41 |
|
* |
| 42 |
|
* VMaxTopologicalDimension = |
| 43 |
|
* Max topological dimension of a cell that can be inserted into this mesh. |
| 44 |
|
* |
| 45 |
|
* TCoordRep = |
| 46 |
|
* Numerical type with which to represent each coordinate value. |
| 47 |
|
* |
| 48 |
|
* TInterpolationWeight = |
| 49 |
|
* Numerical type to store interpolation weights. |
| 50 |
|
* |
| 51 |
|
* \ingroup MeshObjects |
| 52 |
|
*/ |
| 53 |
|
template < |
| 54 |
|
typename TPixelType, |
| 55 |
|
unsigned int VPointDimension = 3, |
| 56 |
|
unsigned int VMaxTopologicalDimension = VPointDimension, |
| 57 |
|
typename TCoordRep = float, |
| 58 |
|
typename TInterpolationWeight = float, |
| 59 |
|
typename TCellPixelType = TPixelType |
| 60 |
IND |
**> |
| 61 |
|
class DefaultStaticMeshTraits |
| 62 |
|
{ |
| 63 |
|
public: |
| 64 |
|
/** Standard class typedefs. */ |
| 65 |
|
typedef DefaultStaticMeshTraits Self; |
| 66 |
|
|
| 67 |
|
/** Just save all the template parameters. */ |
| 68 |
|
typedef TPixelType PixelType; |
| 69 |
|
typedef TCellPixelType CellPixelType; |
| 70 |
TDA |
typedef TCoordRep CoordRepType; |
| 71 |
TDA |
typedef TInterpolationWeight InterpolationWeightType; |
| 72 |
|
|
| 73 |
|
/** Just save all the template parameters. */ |
| 74 |
|
itkStaticConstMacro(PointDimension, unsigned int, VPointDimension); |
| 75 |
|
itkStaticConstMacro(MaxTopologicalDimension, unsigned int, |
| 76 |
|
VMaxTopologicalDimension); |
| 77 |
|
|
| 78 |
|
/** The type to be used to identify a point. This should be the index type |
| 79 |
|
* to the PointsContainer. */ |
| 80 |
|
typedef unsigned long PointIdentifier; |
| 81 |
|
|
| 82 |
|
/** The type to be used to identify a cell. This should be the index type |
| 83 |
|
* to the CellsContainer. */ |
| 84 |
|
typedef unsigned long CellIdentifier; |
| 85 |
|
|
| 86 |
|
/** A type that can be used to identifiy individual boundary features on |
| 87 |
|
* the cells. Since this will probably be an index into a static array, |
| 88 |
|
* this will probably never change from an integer setting. */ |
| 89 |
|
typedef unsigned long CellFeatureIdentifier; |
| 90 |
|
|
| 91 |
|
/** The type of point used by the mesh. This should never change from |
| 92 |
|
* this setting, regardless of the mesh type. */ |
| 93 |
|
typedef Point< CoordRepType, VPointDimension > PointType; |
| 94 |
|
|
| 95 |
|
/** The container type for use in storing points. It must conform to |
| 96 |
|
* the IndexedContainer interface. */ |
| 97 |
|
typedef VectorContainer< PointIdentifier , PointType > PointsContainer; |
| 98 |
|
|
| 99 |
|
/** The container type that will be used to store boundary links |
| 100 |
|
* back to cells. This must conform to the STL "set" interface. */ |
| 101 |
|
typedef std::set< CellIdentifier > UsingCellsContainer; |
| 102 |
|
|
| 103 |
|
/** The information needed for a cell type is now defined, so we can |
| 104 |
|
* define the cell type. We use a macro defined in itkCellInterface. */ |
| 105 |
|
typedef itkMakeCellTraitsMacro CellTraits; |
| 106 |
|
|
| 107 |
|
/** The interface to cells to be used by the mesh. |
| 108 |
|
* This should not be changed. */ |
| 109 |
|
typedef CellInterface< CellPixelType , CellTraits > CellType; |
| 110 |
TDA |
typedef typename CellType::CellRawPointer CellRawPointer; |
| 111 |
TDA |
typedef typename CellType::CellAutoPointer CellAutoPointer; |
| 112 |
|
|
| 113 |
|
/** The container type for use in storing cells. It must conform to |
| 114 |
|
* the IndexedContainer interface. */ |
| 115 |
|
typedef VectorContainer< CellIdentifier , CellType * > |
| 116 |
IND |
********CellsContainer; |
| 117 |
|
|
| 118 |
|
/** The CellLinks container should be a container of PointCellLinksContainer, |
| 119 |
|
* which should be a container conforming to the STL "set" interface. */ |
| 120 |
|
typedef std::set< CellIdentifier > PointCellLinksContainer; |
| 121 |
|
|
| 122 |
|
/** The container type for use in storing point links back to cells. |
| 123 |
|
* It must conform to the IndexedContainer interface. */ |
| 124 |
|
typedef VectorContainer< PointIdentifier , PointCellLinksContainer > |
| 125 |
IND |
********CellLinksContainer; |
| 126 |
|
|
| 127 |
|
/** The container type for use in storing point data. It must conform to |
| 128 |
|
* the IndexedContainer interface. */ |
| 129 |
|
typedef VectorContainer< PointIdentifier , PixelType > |
| 130 |
IND |
********PointDataContainer; |
| 131 |
|
|
| 132 |
|
/** The container type for use in storing cell data. It must conform to |
| 133 |
|
* the IndexedContainer interface. */ |
| 134 |
|
typedef VectorContainer< CellIdentifier , CellPixelType > |
| 135 |
IND |
********CellDataContainer; |
| 136 |
|
|
| 137 |
|
}; |
| 138 |
|
|
| 139 |
|
} // end namespace itk |
| 140 |
|
|
| 141 |
|
#endif |
| 142 |
|
|