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

itkAutomaticTopologyMeshSource.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkAutomaticTopologyMeshSource.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/01/01 20:55:33 $
00007   Version:   $Revision: 1.10 $
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      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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 
00341   // void GenerateData();
00342 
00343 private:
00344   AutomaticTopologyMeshSource(const Self&);  //purposely not implemented
00345   void operator=(const Self&);               //purposely not implemented
00346 
00347   typedef itk::hash_map<
00348     Array< IdentifierType >,
00349     IdentifierType,
00350     IdentifierArrayHashFunction,
00351     IdentifierArrayEqualsFunction >          CellHashMap;
00352 
00353   PointHashMap m_PointsHashTable;
00354   CellHashMap  m_CellsHashTable;
00355   MeshPointer  m_OutputMesh;   // Retained for convenience.
00356   
00357 };
00358 
00359 } // end namespace itk
00360 
00361 #ifndef ITK_MANUAL_INSTANTIATION
00362 #include "itkAutomaticTopologyMeshSource.txx"
00363 #endif
00364 
00365 #endif // __itkAutomaticTopologyMeshSource_h

Generated at Sun Jan 25 13:19:28 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000