00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __itkAutomaticTopologyMeshSource_h
00018
#define __itkAutomaticTopologyMeshSource_h
00019
00020
#include "itkArray.h"
00021
#include "itkDefaultStaticMeshTraits.h"
00022
#include "itk_hash_map.h"
00023
#include "itkHexahedronCell.h"
00024
#include "itkLineCell.h"
00025
#include "itkMesh.h"
00026
#include "itkMeshSource.h"
00027
#include "itkQuadrilateralCell.h"
00028
#include "itkStructHashFunction.h"
00029
#include "itkTriangleCell.h"
00030
#include "itkTetrahedronCell.h"
00031
#include "itkVertexCell.h"
00032
00033
namespace itk
00034 {
00035
00036 class IdentifierArrayHashFunction
00037 {
00038
public:
00039
unsigned long operator()(
00040
Array< unsigned long > identifierArray
00041 )
const;
00042 };
00043
00044 class IdentifierArrayEqualsFunction
00045 {
00046
public:
00047
bool operator()(
00048
Array< unsigned long > identifierArray1,
00049
Array< unsigned long > identifierArray2
00050 )
const;
00051 };
00052
00128
template <
class TOutputMesh>
00129 class ITK_EXPORT AutomaticTopologyMeshSource :
public MeshSource<TOutputMesh>
00130 {
00131
public:
00133 typedef AutomaticTopologyMeshSource
Self;
00134 typedef MeshSource<TOutputMesh> Superclass;
00135 typedef SmartPointer<Self> Pointer;
00136 typedef SmartPointer<const Self> ConstPointer;
00137
00139 typedef TOutputMesh
MeshType;
00140 typedef typename MeshType::PointType
PointType;
00141 typedef typename MeshType::CellType
CellType;
00142 typedef typename MeshType::Pointer
MeshPointer;
00143 typedef typename PointType::CoordRepType
CoordinateType;
00144 typedef typename CellType::CellAutoPointer
CellAutoPointer;
00145
00147 typedef VertexCell< CellType > VertexCell;
00148 typedef LineCell< CellType > LineCell;
00149 typedef TriangleCell< CellType > TriangleCell;
00150 typedef QuadrilateralCell< CellType > QuadrilateralCell;
00151 typedef TetrahedronCell< CellType > TetrahedronCell;
00152 typedef HexahedronCell< CellType > HexahedronCell;
00153
00156 typedef unsigned long IdentifierType;
00157
00159 typedef Array< IdentifierType > IdentifierArrayType;
00160
00163
typedef itk::hash_map<
00164
PointType,
00165
IdentifierType,
00166 StructHashFunction< PointType > >
PointHashMap;
00167
00169
itkStaticConstMacro(PointDimension,
unsigned int,
00170 MeshType::PointDimension);
00171
itkStaticConstMacro(MaxTopologicalDimension,
unsigned int,
00172 MeshType::MaxTopologicalDimension);
00173
00175
itkNewMacro(
Self);
00176
00178
itkTypeMacro(
BinaryMask3DMeshSource,
MeshSource);
00179
00181
IdentifierType AddPoint(
const PointType& p0 );
00182
IdentifierType AddPoint(
const CoordinateType p0[ PointDimension ] );
00183
00189
IdentifierType AddPoint(
CoordinateType x0 = 0,
CoordinateType x1 = 0,
00190
CoordinateType x2 = 0,
CoordinateType x3 = 0,
00191
CoordinateType x4 = 0,
CoordinateType x5 = 0 );
00192
00194
IdentifierType AddVertex(
const IdentifierArrayType& pointIds );
00195
IdentifierType AddVertex(
IdentifierType pointId0 );
00196
IdentifierType AddVertex(
const PointType& p0 );
00197
IdentifierType AddVertex(
const CoordinateType p0[ PointDimension ] );
00198
00203
IdentifierType AddLine(
const IdentifierArrayType& pointIds );
00204
IdentifierType AddLine(
00205
IdentifierType pointId0,
IdentifierType pointId1 );
00206
IdentifierType AddLine(
const PointType& p0,
const PointType& p1 );
00207
IdentifierType AddLine(
const CoordinateType p0[ PointDimension ],
00208
const CoordinateType p1[ PointDimension ] );
00209
00220
IdentifierType AddTriangle(
const IdentifierArrayType& pointIds );
00221
IdentifierType AddTriangle(
00222
IdentifierType pointId0,
IdentifierType pointId1,
00223
IdentifierType pointId2 );
00224
IdentifierType AddTriangle(
const PointType& p0,
const PointType& p1,
00225
const PointType& p2 );
00226
IdentifierType AddTriangle(
const CoordinateType p0[ PointDimension ],
00227
const CoordinateType p1[ PointDimension ],
00228
const CoordinateType p2[ PointDimension ] );
00229
00250
IdentifierType AddQuadrilateral(
const IdentifierArrayType& pointIds );
00251
IdentifierType AddQuadrilateral(
00252
IdentifierType pointId0,
IdentifierType pointId1,
00253
IdentifierType pointId2,
IdentifierType pointId3 );
00254
IdentifierType AddQuadrilateral(
const PointType& p0,
const PointType& p1,
00255
const PointType& p2,
const PointType& p3 );
00256
IdentifierType AddQuadrilateral(
const CoordinateType p0[ PointDimension ],
00257
const CoordinateType p1[ PointDimension ],
00258
const CoordinateType p2[ PointDimension ],
00259
const CoordinateType p3[ PointDimension ] );
00260
00273
IdentifierType AddTetrahedron(
const IdentifierArrayType& pointIds );
00274
IdentifierType AddTetrahedron(
00275
IdentifierType pointId0,
IdentifierType pointId1,
00276
IdentifierType pointId2,
IdentifierType pointId3 );
00277
IdentifierType AddTetrahedron(
const PointType& p0,
const PointType& p1,
00278
const PointType& p2,
const PointType& p3 );
00279
IdentifierType AddTetrahedron(
const CoordinateType p0[ PointDimension ],
00280
const CoordinateType p1[ PointDimension ],
00281
const CoordinateType p2[ PointDimension ],
00282
const CoordinateType p3[ PointDimension ] );
00283
00312
IdentifierType AddHexahedron(
const IdentifierArrayType& pointIds );
00313
IdentifierType AddHexahedron(
00314
IdentifierType pointId0,
IdentifierType pointId1,
00315
IdentifierType pointId2,
IdentifierType pointId3,
00316
IdentifierType pointId4,
IdentifierType pointId5,
00317
IdentifierType pointId6,
IdentifierType pointId7 );
00318
IdentifierType AddHexahedron(
00319
const PointType& p0,
const PointType& p1,
const PointType& p2,
00320
const PointType& p3,
const PointType& p4,
const PointType& p5,
00321
const PointType& p6,
const PointType& p7
00322 );
00323
IdentifierType AddHexahedron(
const CoordinateType p0[ PointDimension ],
00324
const CoordinateType p1[ PointDimension ],
00325
const CoordinateType p2[ PointDimension ],
00326
const CoordinateType p3[ PointDimension ],
00327
const CoordinateType p4[ PointDimension ],
00328
const CoordinateType p5[ PointDimension ],
00329
const CoordinateType p6[ PointDimension ],
00330
const CoordinateType p7[ PointDimension ] );
00331
00335
void Update() {};
00336
00337
protected:
00338 AutomaticTopologyMeshSource();
00339 ~AutomaticTopologyMeshSource();
00340
void PrintSelf(std::ostream& os,
Indent indent)
const;
00341
00342
00343
00344
private:
00345 AutomaticTopologyMeshSource(
const Self&);
00346
void operator=(
const Self&);
00347
00348
typedef itk::hash_map<
00349
Array< IdentifierType >,
00350
IdentifierType,
00351
IdentifierArrayHashFunction,
00352
IdentifierArrayEqualsFunction >
CellHashMap;
00353
00354
PointHashMap m_PointsHashTable;
00355
CellHashMap m_CellsHashTable;
00356
MeshPointer m_OutputMesh;
00357
00358 };
00359
00360 }
00361
00362
#ifndef ITK_MANUAL_INSTANTIATION
00363
#include "itkAutomaticTopologyMeshSource.txx"
00364
#endif
00365
00366
#endif // __itkAutomaticTopologyMeshSource_h