![]() |
ITK
4.2.0
Insight Segmentation and Registration Toolkit
|
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 __itkDiscreteCurvatureQuadEdgeMeshFilter_h 00019 #define __itkDiscreteCurvatureQuadEdgeMeshFilter_h 00020 00021 #include "itkQuadEdgeMeshToQuadEdgeMeshFilter.h" 00022 #include "itkConceptChecking.h" 00023 #include "itkTriangleHelper.h" 00024 00025 namespace itk 00026 { 00034 template< class TInputMesh, class TOutputMesh=TInputMesh > 00035 class ITK_EXPORT DiscreteCurvatureQuadEdgeMeshFilter: 00036 public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh > 00037 { 00038 public: 00039 typedef DiscreteCurvatureQuadEdgeMeshFilter Self; 00040 typedef SmartPointer< Self > Pointer; 00041 typedef SmartPointer< const Self > ConstPointer; 00042 typedef QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh > Superclass; 00043 00044 typedef TInputMesh InputMeshType; 00045 typedef typename InputMeshType::Pointer InputMeshPointer; 00046 00047 typedef TOutputMesh OutputMeshType; 00048 typedef typename OutputMeshType::Pointer OutputMeshPointer; 00049 typedef typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer; 00050 typedef typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator; 00051 typedef typename OutputMeshType::PointType OutputPointType; 00052 typedef typename OutputPointType::CoordRepType OutputCoordType; 00053 typedef typename OutputMeshType::PointIdentifier OutputPointIdentifier; 00054 typedef typename OutputMeshType::CellIdentifier OutputCellIdentifier; 00055 typedef typename OutputMeshType::QEType OutputQEType; 00056 typedef typename OutputMeshType::MeshTraits OutputMeshTraits; 00057 typedef typename OutputMeshTraits::PixelType OutputCurvatureType; 00058 00059 typedef TriangleHelper< OutputPointType > TriangleType; 00060 00062 itkTypeMacro(DiscreteCurvatureQuadEdgeMeshFilter, QuadEdgeMeshToQuadEdgeMeshFilter); 00063 00064 #ifdef ITK_USE_CONCEPT_CHECKING 00065 00066 itkConceptMacro( OutputIsFloatingPointCheck, 00067 ( Concept::IsFloatingPoint< OutputCurvatureType > ) ); 00068 00070 #endif 00071 00072 protected: 00073 DiscreteCurvatureQuadEdgeMeshFilter() {} 00074 virtual ~DiscreteCurvatureQuadEdgeMeshFilter() {} 00075 00076 virtual OutputCurvatureType EstimateCurvature(const OutputPointType & iP) = 0; 00077 00078 OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2) 00079 { 00080 OutputMeshPointer output = this->GetOutput(); 00081 00082 OutputPointIdentifier id[3]; 00083 00084 id[0] = iQE1->GetOrigin(); 00085 id[1] = iQE1->GetDestination(); 00086 id[2] = iQE2->GetDestination(); 00087 00088 OutputPointType p[3]; 00089 00090 for ( int i = 0; i < 3; i++ ) 00091 { 00092 p[i] = output->GetPoint(id[i]); 00093 } 00094 00095 return static_cast< OutputCurvatureType >( TriangleType::ComputeMixedArea( p[0], p[1], p[2] ) ); 00096 } 00097 00098 virtual void GenerateData() 00099 { 00100 this->CopyInputMeshToOutputMesh(); 00101 00102 OutputMeshPointer output = this->GetOutput(); 00103 00104 OutputPointsContainerPointer points = output->GetPoints(); 00105 OutputPointsContainerIterator p_it = points->Begin(); 00106 00107 OutputCurvatureType curvature; 00108 00109 while ( p_it != points->End() ) 00110 { 00111 curvature = this->EstimateCurvature( p_it->Value() ); 00112 output->SetPointData(p_it->Index(), curvature); 00113 ++p_it; 00114 } 00115 } 00116 00117 private: 00118 DiscreteCurvatureQuadEdgeMeshFilter(const Self &); // purposely not 00119 // implemented 00120 void operator=(const Self &); // purposely not 00121 // implemented 00122 }; 00123 } // end namespace itk 00124 00125 #endif 00126
1.7.6.1