ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkFastMarchingQuadEdgeMeshFilterBase.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 
00019 #ifndef __itkFastMarchingQuadEdgeMeshFilterBase_h
00020 #define __itkFastMarchingQuadEdgeMeshFilterBase_h
00021 
00022 #include "itkFastMarchingBase.h"
00023 #include "itkFastMarchingTraits.h"
00024 
00025 namespace itk
00026 {
00043 template< class TInput, class TOutput >
00044 class FastMarchingQuadEdgeMeshFilterBase :
00045     public FastMarchingBase< TInput, TOutput >
00046 {
00047 public:
00048   typedef FastMarchingQuadEdgeMeshFilterBase     Self;
00049   typedef FastMarchingBase< TInput, TOutput >    Superclass;
00050   typedef SmartPointer< Self >                   Pointer;
00051   typedef SmartPointer< const Self >             ConstPointer;
00052   typedef typename Superclass::Traits            Traits;
00053 
00055   itkNewMacro(Self);
00056 
00058   itkTypeMacro(FastMarchingQuadEdgeMeshFilterBase, FastMarchingBase);
00059 
00060   typedef typename Superclass::InputDomainType     InputMeshType;
00061   typedef typename Superclass::InputDomainPointer  InputMeshPointer;
00062   typedef typename Superclass::InputPixelType      InputPixelType;
00063   typedef typename InputMeshType::PointType        InputPointType;
00064   typedef typename InputMeshType::PointIdentifier  InputPointIdentifierType;
00065 
00066   typedef typename Superclass::OutputDomainType     OutputMeshType;
00067   typedef typename Superclass::OutputDomainPointer  OutputMeshPointer;
00068   typedef typename Superclass::OutputPixelType      OutputPixelType;
00069   typedef typename OutputMeshType::PointType        OutputPointType;
00070   typedef typename OutputPointType::VectorType      OutputVectorType;
00071   typedef typename OutputVectorType::RealValueType  OutputVectorRealType;
00072   typedef typename OutputMeshType::QEType           OutputQEType;
00073   typedef typename OutputMeshType::PointIdentifier  OutputPointIdentifierType;
00074   typedef typename OutputMeshType::PointsContainer  OutputPointsContainer;
00075   typedef typename OutputPointsContainer::Pointer   OutputPointsContainerPointer;
00076   typedef typename OutputPointsContainer::Iterator  OutputPointsContainerIterator;
00077   typedef typename OutputMeshType::PointDataContainer
00078                                                     OutputPointDataContainer;
00079   typedef typename OutputPointDataContainer::Pointer
00080                                                     OutputPointDataContainerPointer;
00081 
00082   typedef typename OutputMeshType::CellsContainer   OutputCellsContainer;
00083   typedef typename OutputCellsContainer::Pointer    OutputCellsContainerPointer;
00084   typedef typename OutputCellsContainer::ConstIterator
00085                                                     OutputCellsContainerConstIterator;
00086   typedef typename OutputMeshType::CellType         OutputCellType;
00087 
00088 
00089   typedef typename Traits::NodeType                 NodeType;
00090   typedef typename Traits::NodePairType             NodePairType;
00091   typedef typename Traits::NodePairContainerType    NodePairContainerType;
00092   typedef typename Traits::NodePairContainerPointer NodePairContainerPointer;
00093   typedef typename Traits::NodePairContainerConstIterator
00094     NodePairContainerConstIterator;
00095 
00096 //  typedef typename Traits::NodeContainerType        NodeContainerType;
00097 //  typedef typename Traits::NodeContainerPointer     NodeContainerPointer;
00098 //  typedef typename Traits::NodeContainerConstIterator
00099 //    NodeContainerConstIterator;
00100 
00101   typedef typename Superclass::LabelType LabelType;
00102 
00103   typedef std::map< NodeType, LabelType >           NodeLabelMapType;
00104   typedef typename NodeLabelMapType::iterator       NodeLabelMapIterator;
00105   typedef typename NodeLabelMapType::const_iterator NodeLabelMapConstIterator;
00106 
00107 protected:
00108 
00109   FastMarchingQuadEdgeMeshFilterBase();
00110   virtual ~FastMarchingQuadEdgeMeshFilterBase();
00111 
00112   NodeLabelMapType m_Label;
00113 
00114   IdentifierType GetTotalNumberOfNodes() const;
00115 
00116   void SetOutputValue( OutputMeshType* oMesh,
00117                       const NodeType& iNode,
00118                       const OutputPixelType& iValue );
00119 
00120   const OutputPixelType GetOutputValue( OutputMeshType* oMesh,
00121                                   const NodeType& iNode ) const;
00122 
00123   unsigned char GetLabelValueForGivenNode( const NodeType& iNode ) const;
00124 
00125   void SetLabelValueForGivenNode( const NodeType& iNode,
00126                                   const LabelType& iLabel );
00127 
00128   void UpdateNeighbors( OutputMeshType* oMesh,
00129                         const NodeType& iNode );
00130 
00131   void UpdateValue( OutputMeshType* oMesh,
00132                     const NodeType& iNode );
00133 
00134   const OutputVectorRealType
00135   Solve( OutputMeshType* oMesh,
00136          const NodeType& iId, const OutputPointType& iCurrentPoint,
00137          const OutputVectorRealType& iF,
00138          const NodeType& iId1, const OutputPointType& iP1,
00139          const bool& iIsFar1, const OutputVectorRealType iVal1,
00140          const NodeType& iId2, const OutputPointType& iP2,
00141          const bool& iIsFar2, const OutputVectorRealType& iVal2 )
00142   const;
00143 
00144 
00145   const OutputVectorRealType
00146   ComputeUpdate(
00147     const OutputVectorRealType& iVal1, const OutputVectorRealType& iVal2,
00148     const OutputVectorRealType& iNorm1, const OutputVectorRealType& iSqNorm1,
00149     const OutputVectorRealType& iNorm2, const OutputVectorRealType& iSqNorm2,
00150     const OutputVectorRealType& iDot, const OutputVectorRealType& iF )
00151     const;
00152 
00153   bool UnfoldTriangle(
00154     OutputMeshType* oMesh,
00155     const OutputPointIdentifierType& iId, const OutputPointType& iP,
00156     const OutputPointIdentifierType& iId1, const OutputPointType& iP1,
00157     const OutputPointIdentifierType& iId2, const OutputPointType &iP2,
00158     OutputVectorRealType& oNorm, OutputVectorRealType& oSqNorm,
00159     OutputVectorRealType& oDot1, OutputVectorRealType& oDot2,
00160     OutputPointIdentifierType& oId ) const;
00161 
00162   bool CheckTopology( OutputMeshType* oMesh,
00163                       const NodeType& iNode );
00164 
00165   void InitializeOutput( OutputMeshType* oMesh );
00166 
00167 
00168 private:
00169   FastMarchingQuadEdgeMeshFilterBase( const Self& );
00170   void operator = ( const Self& );
00171 };
00172 }
00173 
00174 #include "itkFastMarchingQuadEdgeMeshFilterBase.hxx"
00175 #endif // __itkFastMarchingQuadEdgeMeshFilterBase_h
00176