ITK
4.1.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 /*========================================================================= 00019 * 00020 * Portions of this file are subject to the VTK Toolkit Version 3 copyright. 00021 * 00022 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00023 * 00024 * For complete copyright, license and disclaimer of warranty information 00025 * please refer to the NOTICE file at the top of the ITK source tree. 00026 * 00027 *=========================================================================*/ 00028 #ifndef __itkDeformableSimplexMesh3DFilter_h 00029 #define __itkDeformableSimplexMesh3DFilter_h 00030 00031 #include "itkMeshToMeshFilter.h" 00032 #include "itkSimplexMesh.h" 00033 #include "itkSphereSpatialFunction.h" 00034 #include "itkFloodFilledSpatialFunctionConditionalIterator.h" 00035 #include "itkVectorGradientMagnitudeImageFilter.h" 00036 #include "itkBinaryThresholdImageFilter.h" 00037 #include "itkArray.h" 00038 00039 #include <set> 00040 00041 namespace itk 00042 { 00075 template< class TInputMesh, class TOutputMesh > 00076 class ITK_EXPORT DeformableSimplexMesh3DFilter:public MeshToMeshFilter< TInputMesh, TOutputMesh > 00077 { 00078 public: 00080 typedef DeformableSimplexMesh3DFilter Self; 00081 00083 typedef MeshToMeshFilter< TInputMesh, TOutputMesh > Superclass; 00084 00086 typedef SmartPointer< Self > Pointer; 00087 typedef SmartPointer< const Self > ConstPointer; 00088 00090 itkNewMacro(Self); 00091 00093 itkTypeMacro(DeformableSimplexMesh3DFilter, MeshToMeshFilter); 00094 00096 typedef TInputMesh InputMeshType; 00097 typedef TOutputMesh OutputMeshType; 00098 00099 typedef typename InputMeshType::PointsContainerPointer InputPointsContainerPointer; 00100 typedef typename InputMeshType::PointsContainer InputPointsContainer; 00101 typedef typename InputMeshType::PointsContainer::ConstIterator InputPointsContainerConstIterator; 00102 00104 typedef typename SimplexMeshGeometry::PointType PointType; 00105 typedef typename PointType::VectorType VectorType; 00106 typedef CovariantVector< typename VectorType::ValueType, 3 > CovariantVectorType; 00107 typedef typename InputMeshType::PixelType PixelType; 00108 00110 typedef CovariantVector< PixelType, 3 > GradientType; 00111 typedef Image< GradientType, 3 > GradientImageType; 00112 typedef Image< unsigned char, 3 > BinaryOutput; 00113 typedef Image< float, 3 > MagnitudeOutput; 00114 00115 typedef typename GradientImageType::Pointer GradientImagePointer; 00116 typedef typename GradientImageType::IndexType GradientIndexType; 00117 typedef typename GradientImageType::PixelType GradientPixelType; 00118 typedef typename GradientIndexType::IndexValueType GradientIndexValueType; 00119 typedef typename GradientImageType::SizeType GradientImageSizeType; 00120 00121 /* Mesh pointer definition. */ 00122 typedef typename InputMeshType::Pointer InputMeshPointer; 00123 typedef typename OutputMeshType::Pointer OutputMeshPointer; 00124 00125 typedef typename InputMeshType::PointType MeshPointType; 00126 typedef typename InputMeshType::CellsContainerPointer CellsContainerPointer; 00127 typedef typename InputMeshType::CellsContainer::Iterator CellsContainerIterator; 00128 typedef typename InputMeshType::NeighborListType InputNeighbors; 00129 typedef typename InputMeshType::NeighborListType::iterator InputNeighborsIterator; 00130 00131 typedef std::set< IdentifierType > NeighborSetType; 00132 typedef std::set< IdentifierType > IndexSetType; 00133 typedef itk::MapContainer< IdentifierType, NeighborSetType > VertexNeighborListType; 00134 typedef typename NeighborSetType::iterator NeighborSetIterator; 00135 typedef typename IndexSetType::iterator IndexSetIterator; 00136 00137 typedef typename InputMeshType::GeometryMapType GeometryMapType; 00138 typedef typename GeometryMapType::Pointer GeometryMapPointer; 00139 typedef typename GeometryMapType::Iterator GeometryMapIterator; 00140 00148 void SetGradient( const GradientImageType * gradientImage ); 00149 00153 const GradientImageType * GetGradient() const; 00154 00158 itkSetMacro(Iterations, int); 00159 itkGetConstMacro(Iterations, int); 00161 00163 itkSetMacro(Alpha, double); 00164 00166 itkGetConstMacro(Alpha, double); 00167 00169 itkSetMacro(Beta, double); 00170 00172 itkGetConstMacro(Beta, double); 00173 00175 itkSetMacro(Gamma, double); 00176 00178 itkGetConstMacro(Gamma, double); 00179 00181 itkSetMacro(Damping, double); 00182 00184 itkGetConstMacro(Damping, double); 00185 00187 itkSetMacro(Rigidity, unsigned int); 00188 00190 itkGetConstMacro(Rigidity, unsigned int); 00191 00192 itkSetObjectMacro(Data, GeometryMapType); 00193 itkGetConstObjectMacro(Data, GeometryMapType); 00194 00196 itkGetConstMacro(ImageWidth, int); 00197 itkGetConstMacro(ImageHeight, int); 00198 itkGetConstMacro(ImageDepth, int); 00200 00202 itkGetConstMacro(Step, int); 00203 protected: 00204 DeformableSimplexMesh3DFilter(); 00205 ~DeformableSimplexMesh3DFilter(); 00206 DeformableSimplexMesh3DFilter(const Self &); //purposely not implemented 00207 void operator=(const Self &); //purposely not implemented 00209 00210 void PrintSelf(std::ostream & os, Indent indent) const; 00211 00213 virtual void GenerateData(); 00214 00220 virtual void Initialize(); 00221 00227 virtual void ComputeGeometry(); 00228 00234 virtual void ComputeDisplacement(); 00235 00239 virtual void ComputeInternalForce(SimplexMeshGeometry *data); 00240 00244 virtual void ComputeExternalForce(SimplexMeshGeometry *data); 00245 00250 virtual void ComputeOutput(); 00251 00255 virtual void UpdateReferenceMetrics(); 00256 00260 double L_Func(double r, double d, double phi); 00261 00265 PointType ComputeBarycentricCoordinates(PointType p, SimplexMeshGeometry *data); 00266 00274 double m_Alpha; 00275 00282 double m_Beta; 00283 00290 double m_Gamma; 00291 double m_Damping; 00292 00299 unsigned int m_Rigidity; 00300 00301 // definition of internal parameters 00303 int m_Step; 00304 00306 int m_ImageWidth; 00307 00309 int m_ImageHeight; 00310 00312 int m_ImageDepth; 00313 00315 int m_Iterations; 00316 00320 GeometryMapPointer m_Data; 00321 00322 }; // end of class 00323 } // end namespace itk 00324 00325 #ifndef ITK_MANUAL_INSTANTIATION 00326 #include "itkDeformableSimplexMesh3DFilter.hxx" 00327 #endif 00328 00329 #endif //__itkDeformableSimplexMesh3DFilter_h 00330