ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkQuadrilateralCell.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 __itkQuadrilateralCell_h
00019 #define __itkQuadrilateralCell_h
00020 
00021 #include "itkLineCell.h"
00022 #include "itkQuadrilateralCellTopology.h"
00023 
00024 namespace itk
00025 {
00038 template< typename TCellInterface >
00039 class ITK_EXPORT QuadrilateralCell:public TCellInterface, private QuadrilateralCellTopology
00040 {
00041 public:
00043   itkCellCommonTypedefs(QuadrilateralCell);
00044   itkCellInheritedTypedefs(TCellInterface);
00046 
00048   itkTypeMacro(QuadrilateralCell, CellInterface);
00049 
00051   typedef VertexCell< TCellInterface >         VertexType;
00052   typedef typename VertexType::SelfAutoPointer VertexAutoPointer;
00053 
00055   typedef LineCell< TCellInterface >         EdgeType;
00056   typedef typename EdgeType::SelfAutoPointer EdgeAutoPointer;
00057 
00059   itkStaticConstMacro(NumberOfPoints, unsigned int, 4);
00060   itkStaticConstMacro(NumberOfVertices, unsigned int, 4);
00061   itkStaticConstMacro(NumberOfEdges, unsigned int, 4);
00062   itkStaticConstMacro(CellDimension, unsigned int, 2);
00064 
00066   virtual CellGeometry GetType(void) const
00067   { return Superclass::QUADRILATERAL_CELL; }
00068   virtual void MakeCopy(CellAutoPointer &) const;
00070 
00071   virtual unsigned int GetDimension(void) const;
00072 
00073   virtual unsigned int GetNumberOfPoints(void) const;
00074 
00075   virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
00076 
00077   virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &);
00078   virtual void SetPointIds(PointIdConstIterator first);
00079 
00080   virtual void SetPointIds(PointIdConstIterator first,
00081                            PointIdConstIterator last);
00082 
00083   virtual void SetPointId(int localId, PointIdentifier);
00084   virtual PointIdIterator      PointIdsBegin(void);
00085 
00086   virtual PointIdConstIterator PointIdsBegin(void) const;
00087 
00088   virtual PointIdIterator      PointIdsEnd(void);
00089 
00090   virtual PointIdConstIterator PointIdsEnd(void) const;
00091 
00093   virtual CellFeatureCount GetNumberOfVertices(void) const;
00094 
00095   virtual CellFeatureCount GetNumberOfEdges(void) const;
00096 
00097   virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
00098   virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
00099 
00101   virtual bool EvaluatePosition(CoordRepType *,
00102                                 PointsContainer *,
00103                                 CoordRepType *,
00104                                 CoordRepType[],
00105                                 double *,
00106                                 InterpolationWeightType *);
00107 
00109   itkCellVisitMacro(Superclass::QUADRILATERAL_CELL);
00110 
00112   QuadrilateralCell()
00113   {
00114     for ( PointIdentifier i = 0; i < itkGetStaticConstMacro(NumberOfPoints); i++ )
00115       {
00116       m_PointIds[i] = NumericTraits< PointIdentifier >::max();
00117       }
00118   }
00120 
00121   ~QuadrilateralCell() {}
00122 protected:
00124   PointIdentifier m_PointIds[NumberOfPoints];
00125 
00126   void InterpolationDerivs(CoordRepType pcoords[2], CoordRepType derivs[8]);
00127   void InterpolationFunctions(CoordRepType pcoords[2], InterpolationWeightType sf[4]);
00128   void EvaluateLocation(int &itkNotUsed(subId), PointsContainer * points, CoordRepType pcoords[2],
00129                         CoordRepType x[2], InterpolationWeightType * weights);
00130 private:
00131   QuadrilateralCell(const Self &); //purposely not implemented
00132   void operator=(const Self &);    //purposely not implemented
00133 };
00134 } // end namespace itk
00135 
00136 #ifndef ITK_MANUAL_INSTANTIATION
00137 #include "itkQuadrilateralCell.hxx"
00138 #endif
00139 
00140 #endif
00141