ITK  4.1.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 public:
00104 
00105   void SetCoefficientsMethod(CoefficientsComputation *iMethod)
00106   {
00107     this->m_CoefficientsMethod = iMethod;
00108   }
00109 
00110   itkNewMacro(Self);
00111   itkTypeMacro(MeshParam, QuadEdgeMeshToQuadEdgeMeshFilter);
00112 
00113   itkSetObjectMacro(BorderTransform, MeshBorderTransform);
00114   itkGetObjectMacro(BorderTransform, MeshBorderTransform);
00115 protected:
00116 
00117   ParameterizationQuadEdgeMeshFilter();
00118   virtual ~ParameterizationQuadEdgeMeshFilter() {}
00119   void PrintSelf(std::ostream & os, Indent indent) const;
00120 
00121   CoefficientsComputation *m_CoefficientsMethod;
00122 
00123   MeshBorderTransformPointer m_BorderTransform;
00124 
00125   // first is the id of the input mesh and second is the corresponding id
00126   // in m_BoundaryPtMap
00127   InputMapPointIdentifier m_BoundaryPtMap;
00128 
00129   // first is the id of the input mesh and second is the corresponding id
00130   // in m_InternalPtList
00131   InputMapPointIdentifier m_InternalPtMap;
00132 
00133   std::vector< OutputPointType > m_Border;
00134 
00135   void CopyToOutputBorder();
00136 
00146   void ComputeListOfInteriorVertices();
00147 
00155   void FillMatrix(MatrixType & iM, VectorType & ioBx, VectorType & ioBy);
00156 
00167   void SolveLinearSystems(const MatrixType & iM,
00168                           const VectorType & iBx,
00169                           const VectorType & iBy,
00170                           VectorType & oX,
00171                           VectorType & oY);
00172 
00173   void GenerateData();
00174 
00175 private:
00176 
00177   ParameterizationQuadEdgeMeshFilter(const Self &); // purposely not implemented
00178   void operator=(const Self &);    // purposely not implemented
00179 };
00180 } // end namespace itk
00181 
00182 #include "itkParameterizationQuadEdgeMeshFilter.hxx"
00183 
00184 #endif
00185