ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkParameterizationQuadEdgeMeshFilter.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 __itkParameterizationQuadEdgeMeshFilter_h
00019 #define __itkParameterizationQuadEdgeMeshFilter_h
00020 
00021 #include "itkBorderQuadEdgeMeshFilter.h"
00022 #include "itkQuadEdgeMeshParamMatrixCoefficients.h"
00023 
00024 namespace itk
00025 {
00038 template< class TInputMesh, class TOutputMesh, class TSolverTraits >
00039 class ITK_EXPORT ParameterizationQuadEdgeMeshFilter:
00040   public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
00041 {
00042 public:
00043 
00045   typedef ParameterizationQuadEdgeMeshFilter              Self;
00046   typedef QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh,
00047                                             TOutputMesh > Superclass;
00048   typedef SmartPointer< Self >                            Pointer;
00049   typedef SmartPointer< const Self >                      ConstPointer;
00050 
00052   typedef TInputMesh                              InputMeshType;
00053   typedef typename InputMeshType::Pointer         InputMeshPointer;
00054   typedef typename InputMeshType::ConstPointer    InputMeshConstPointer;
00055   typedef typename InputMeshType::CoordRepType    InputCoordRepType;
00056   typedef typename InputMeshType::PointType       InputPointType;
00057   typedef typename InputPointType::VectorType     InputPointVectorType;
00058   typedef typename InputMeshType::PointIdentifier InputPointIdentifier;
00059   typedef typename InputMeshType::QEType          InputQEType;
00060   typedef typename InputMeshType::VectorType      InputVectorType;
00061   typedef typename InputMeshType::EdgeListType    InputEdgeListType;
00062   typedef typename InputMeshType::PixelType       InputPixelType;
00063   typedef typename InputMeshType::Traits          InputTraits;
00064 
00065   itkStaticConstMacro(InputVDimension, unsigned int, InputMeshType::PointDimension);
00066 
00067   typedef typename InputMeshType::PointsContainer               InputPointsContainer;
00068   typedef typename InputMeshType::PointsContainerConstIterator  InputPointsContainerConstIterator;
00069 
00070   typedef typename InputMeshType::CellsContainerConstIterator   InputCellsContainerConstIterator;
00071   typedef typename InputMeshType::EdgeCellType                  InputEdgeCellType;
00072   typedef typename InputMeshType::PolygonCellType               InputPolygonCellType;
00073   typedef typename InputMeshType::PointIdList                   InputPointIdList;
00074 
00075   typedef typename InputQEType::IteratorGeom                      InputQEIterator;
00076 
00077   typedef std::map< InputPointIdentifier, InputPointIdentifier >  InputMapPointIdentifier;
00078   typedef typename InputMapPointIdentifier::iterator              InputMapPoinIdentifierIterator;
00079 
00081   typedef TOutputMesh                                      OutputMeshType;
00082   typedef typename OutputMeshType::Pointer                 OutputMeshPointer;
00083   typedef typename OutputMeshType::ConstPointer            OutputMeshConstPointer;
00084   typedef typename OutputMeshType::CoordRepType            OutputCoordRepType;
00085   typedef typename OutputMeshType::PointType               OutputPointType;
00086   typedef typename OutputMeshType::PointIdentifier         OutputPointIdentifier;
00087   typedef typename OutputMeshType::QEType                  OutputQEType;
00088   typedef typename OutputMeshType::VectorType              OutputVectorType;
00089   typedef typename OutputQEType::IteratorGeom              OutputQEIterator;
00090   typedef typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator;
00091 
00092   itkStaticConstMacro(OutputVDimension, unsigned int, OutputMeshType::PointDimension);
00093 
00094   typedef TSolverTraits                     SolverTraits;
00095   typedef typename SolverTraits::ValueType  ValueType;
00096   typedef typename SolverTraits::MatrixType MatrixType;
00097   typedef typename SolverTraits::VectorType VectorType;
00098 
00099   typedef BorderQuadEdgeMeshFilter< InputMeshType, InputMeshType >  MeshBorderTransform;
00100   typedef typename MeshBorderTransform::Pointer                     MeshBorderTransformPointer;
00101 
00102   typedef MatrixCoefficients< InputMeshType >                       CoefficientsComputation;
00103 
00104 public:
00105 
00106   void SetCoefficientsMethod(CoefficientsComputation *iMethod)
00107   {
00108     this->m_CoefficientsMethod = iMethod;
00109   }
00110 
00111   itkNewMacro(Self);
00112   itkTypeMacro(ParameterizationQuadEdgeMeshFilter, QuadEdgeMeshToQuadEdgeMeshFilter);
00113 
00114   itkSetObjectMacro(BorderTransform, MeshBorderTransform);
00115   itkGetObjectMacro(BorderTransform, MeshBorderTransform);
00116 
00117 protected:
00118 
00119   ParameterizationQuadEdgeMeshFilter();
00120   virtual ~ParameterizationQuadEdgeMeshFilter() {}
00121   void PrintSelf(std::ostream & os, Indent indent) const;
00122 
00123   CoefficientsComputation *m_CoefficientsMethod;
00124 
00125   MeshBorderTransformPointer m_BorderTransform;
00126 
00127   // first is the id of the input mesh and second is the corresponding id
00128   // in m_BoundaryPtMap
00129   InputMapPointIdentifier m_BoundaryPtMap;
00130 
00131   // first is the id of the input mesh and second is the corresponding id
00132   // in m_InternalPtList
00133   InputMapPointIdentifier m_InternalPtMap;
00134 
00135   std::vector< OutputPointType > m_Border;
00136 
00137   void CopyToOutputBorder();
00138 
00148   void ComputeListOfInteriorVertices();
00149 
00157   void FillMatrix(MatrixType & iM, VectorType & ioBx, VectorType & ioBy);
00158 
00169   void SolveLinearSystems(const MatrixType & iM,
00170                           const VectorType & iBx,
00171                           const VectorType & iBy,
00172                           VectorType & oX,
00173                           VectorType & oY);
00174 
00175   void GenerateData();
00176 
00177 private:
00178 
00179   ParameterizationQuadEdgeMeshFilter(const Self &); // purposely not implemented
00180   void operator=(const Self &);    // purposely not implemented
00181 };
00182 } // end namespace itk
00183 
00184 #include "itkParameterizationQuadEdgeMeshFilter.hxx"
00185 
00186 #endif
00187