ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkHexahedronCell.h
Go to the documentation of this file.
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 __itkHexahedronCell_h
00019 #define __itkHexahedronCell_h
00020 
00021 #include "itkQuadrilateralCell.h"
00022 #include "itkHexahedronCellTopology.h"
00023 
00024 namespace itk
00025 {
00043 template< typename TCellInterface >
00044 class ITK_EXPORT HexahedronCell:public TCellInterface, private HexahedronCellTopology
00045 {
00046 public:
00048   itkCellCommonTypedefs(HexahedronCell);
00049   itkCellInheritedTypedefs(TCellInterface);
00051 
00053   itkTypeMacro(HexahedronCell, CellInterface);
00054 
00056   typedef VertexCell< TCellInterface >         VertexType;
00057   typedef typename VertexType::SelfAutoPointer VertexAutoPointer;
00058 
00060   typedef LineCell< TCellInterface >         EdgeType;
00061   typedef typename EdgeType::SelfAutoPointer EdgeAutoPointer;
00062 
00064   typedef QuadrilateralCell< TCellInterface > FaceType;
00065   typedef typename FaceType::SelfAutoPointer  FaceAutoPointer;
00066 
00068   enum { NumberOfPoints   =  8,
00069          NumberOfVertices =  8,
00070          NumberOfEdges    = 12,
00071          NumberOfFaces    =  6,
00072          CellDimension    =  3 };
00073 
00075   virtual CellGeometry GetType(void) const
00076   { return Superclass::HEXAHEDRON_CELL; }
00077   virtual void MakeCopy(CellAutoPointer &) const;
00079 
00080   virtual unsigned int GetDimension(void) const;
00081 
00082   virtual unsigned int GetNumberOfPoints(void) const;
00083 
00084   virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
00085 
00086   virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &);
00087   virtual void SetPointIds(PointIdConstIterator first);
00088 
00089   virtual void SetPointIds(PointIdConstIterator first, PointIdConstIterator last);
00090 
00091   virtual void SetPointId(int localId, PointIdentifier);
00092   virtual PointIdIterator      PointIdsBegin(void);
00093 
00094   virtual PointIdConstIterator PointIdsBegin(void) const;
00095 
00096   virtual PointIdIterator      PointIdsEnd(void);
00097 
00098   virtual PointIdConstIterator PointIdsEnd(void) const;
00099 
00101   virtual CellFeatureCount GetNumberOfVertices(void) const;
00102 
00103   virtual CellFeatureCount GetNumberOfEdges(void) const;
00104 
00105   virtual CellFeatureCount GetNumberOfFaces(void) const;
00106 
00107   virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
00108   virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
00109   virtual bool GetFace(CellFeatureIdentifier, FaceAutoPointer &);
00110 
00112   virtual bool EvaluatePosition(CoordRepType *,
00113                                 PointsContainer *,
00114                                 CoordRepType *,
00115                                 CoordRepType[],
00116                                 double *,
00117                                 InterpolationWeightType *);
00118 
00120   itkCellVisitMacro(Superclass::HEXAHEDRON_CELL);
00121 protected:
00122 
00124   PointIdentifier m_PointIds[NumberOfPoints];
00125 
00126   void InterpolationDerivs(CoordRepType pcoords[3], CoordRepType derivs[24]);
00127   void InterpolationFunctions(CoordRepType pcoords[3], InterpolationWeightType sf[8]);
00128   void EvaluateLocation(int &itkNotUsed(subId), PointsContainer * points, CoordRepType pcoords[3],
00129                         CoordRepType x[3], InterpolationWeightType * weights);
00130 public:
00131   HexahedronCell()
00132   {
00133     for ( unsigned int i = 0; i < itkGetStaticConstMacro(NumberOfPoints); i++ )
00134       {
00135       m_PointIds[i] = NumericTraits< PointIdentifier >::max();
00136       }
00137   }
00138 
00139   ~HexahedronCell() {}
00140 private:
00141   HexahedronCell(const Self &); //purposely not implemented
00142   void operator=(const Self &); //purposely not implemented
00143 };
00144 } // end namespace itk
00145 
00146 #ifndef ITK_MANUAL_INSTANTIATION
00147 #include "itkHexahedronCell.hxx"
00148 #endif
00149 
00150 #endif
00151