ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkBorderQuadEdgeMeshFilter.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 __itkBorderQuadEdgeMeshFilter_h
00019 #define __itkBorderQuadEdgeMeshFilter_h
00020 
00021 #include "itkQuadEdgeMesh.h"
00022 #include "itkQuadEdgeMeshToQuadEdgeMeshFilter.h"
00023 #include "itkQuadEdgeMeshBoundaryEdgesMeshFunction.h"
00024 
00025 namespace itk
00026 {
00049 template< class TInputMesh, class TOutputMesh=TInputMesh >
00050 class ITK_EXPORT BorderQuadEdgeMeshFilter:
00051   public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
00052 {
00053 public:
00054 
00056   typedef BorderQuadEdgeMeshFilter    Self;
00057   typedef QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh,
00058                                             TOutputMesh >
00059                                       Superclass;
00060   typedef SmartPointer< Self >        Pointer;
00061   typedef SmartPointer< const Self >  ConstPointer;
00062 
00063   typedef TInputMesh                                  InputMeshType;
00064   typedef typename InputMeshType::ConstPointer        InputMeshConstPointer;
00065   typedef typename InputMeshType::CoordRepType        InputCoordRepType;
00066   typedef typename InputMeshType::PointType           InputPointType;
00067   typedef typename InputMeshType::Traits              InputTraits;
00068   typedef typename InputMeshType::PointIdentifier     InputPointIdentifier;
00069   typedef typename InputMeshType::QEType              InputQEType;
00070   typedef typename InputQEType::IteratorGeom          InputIteratorGeom;
00071   typedef typename InputMeshType::VectorType          InputVectorType;
00072   typedef typename InputMeshType::EdgeListType        InputEdgeListType;
00073   typedef typename InputMeshType::EdgeListPointerType InputEdgeListPointerType;
00074   typedef typename InputEdgeListType::iterator        InputEdgeListIterator;
00075   typedef typename InputMeshType::EdgeCellType        InputEdgeCellType;
00076   typedef typename InputMeshType::PolygonCellType     InputPolygonCellType;
00077   typedef typename InputMeshType::PointIdList         InputPointIdList;
00078   typedef typename InputMeshType::PointsContainer     InputPointsContainer;
00079   typedef typename InputMeshType::PointsContainerConstIterator
00080   InputPointsContainerConstIterator;
00081   typedef typename InputMeshType::CellsContainerConstIterator
00082   InputCellsContainerConstIterator;
00083 
00084   typedef TOutputMesh                              OutputMeshType;
00085   typedef typename OutputMeshType::Pointer         OutputMeshPointer;
00086   typedef typename OutputMeshType::CoordRepType    OutputCoordRepType;
00087   typedef typename OutputMeshType::PointType       OutputPointType;
00088   typedef typename OutputMeshType::Traits          OutputTraits;
00089   typedef typename OutputMeshType::PointIdentifier OutputPointIdentifier;
00090   typedef typename OutputMeshType::QEType          OutputQEType;
00091   typedef typename OutputMeshType::VectorType      OutputVectorType;
00092   typedef typename OutputMeshType::EdgeListType    OutputEdgeListType;
00093   typedef typename OutputMeshType::EdgeCellType    OutputEdgeCellType;
00094   typedef typename OutputMeshType::PolygonCellType OutputPolygonCellType;
00095   typedef typename OutputMeshType::PointIdList     OutputPointIdList;
00096   typedef typename OutputMeshType::PointsContainer OutputPointsContainer;
00097   typedef typename OutputMeshType::PointsContainerConstIterator
00098   OutputPointsContainerConstIterator;
00099   typedef typename OutputMeshType::CellsContainerConstIterator
00100   OutputCellsContainerConstIterator;
00101 
00102   itkNewMacro(Self);
00103   itkTypeMacro(BorderQuadEdgeMeshFilter, QuadEdgeMeshToQuadEdgeMeshFilter);
00104   itkStaticConstMacro(PointDimension, unsigned int,
00105                       InputTraits::PointDimension);
00106 
00107   typedef std::vector< InputPointType >                           InputVectorPointType;
00108   typedef std::map< InputPointIdentifier, OutputPointIdentifier > MapPointIdentifier;
00109   typedef typename MapPointIdentifier::iterator                   MapPointIdentifierIterator;
00110 
00111   typedef QuadEdgeMeshBoundaryEdgesMeshFunction< InputMeshType > BoundaryRepresentativeEdgesType;
00112   typedef typename BoundaryRepresentativeEdgesType::Pointer      BoundaryRepresentativeEdgesPointer;
00113 
00114 public:
00115 
00116   enum BorderTransformType {
00117     SQUARE_BORDER_TRANSFORM = 0,
00118     DISK_BORDER_TRANSFORM
00119     };
00120 
00121   enum BorderPickType {
00122     LONGEST = 0,
00123     LARGEST
00124     };
00125 
00126   itkSetMacro(TransformType, BorderTransformType);
00127   itkGetConstMacro(TransformType, BorderTransformType);
00128 
00129   itkSetMacro( BorderPick, BorderPickType );
00130   itkGetConstMacro( BorderPick, BorderPickType );
00131 
00132   itkSetMacro(Radius, InputCoordRepType);
00133   itkGetConstMacro(Radius, InputCoordRepType);
00134 
00135   void ComputeTransform();
00136 
00137   MapPointIdentifier GetBoundaryPtMap();
00138 
00139   InputVectorPointType GetBorder();
00140 
00141 protected:
00143   BorderQuadEdgeMeshFilter();
00144 
00146   ~BorderQuadEdgeMeshFilter() {}
00147 
00148   void PrintSelf(std::ostream & os, Indent indent) const;
00149 
00150   BorderTransformType m_TransformType;
00151   BorderPickType      m_BorderPick;
00152 
00153   InputCoordRepType m_Radius;
00154 
00155   InputVectorPointType m_Border;
00156 
00157   MapPointIdentifier m_BoundaryPtMap;
00158 
00159   void GenerateData();
00160 
00161   void ComputeBoundary();
00162 
00163   InputQEType* ComputeLongestBorder();
00164 
00165   InputQEType* ComputeLargestBorder();
00166 
00167   void DiskTransform();
00168 
00169   InputPointType GetMeshBarycentre();
00170 
00171   InputCoordRepType RadiusMaxSquare();
00172 
00173   void ArcLengthSquareTransform();
00174 
00175 private:
00177   BorderQuadEdgeMeshFilter(const Self &);
00178 
00180   void operator=(const Self &);
00181 };
00182 }
00183 #include "itkBorderQuadEdgeMeshFilter.hxx"
00184 
00185 #endif
00186