![]() |
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 00019 00020 #ifndef __itkLevelSetEvolutionBase_h 00021 #define __itkLevelSetEvolutionBase_h 00022 00023 #include <list> 00024 00025 #include "itkImage.h" 00026 #include "itkDiscreteLevelSetImageBase.h" 00027 #include "itkImageRegionIteratorWithIndex.h" 00028 #include "itkBinaryThresholdImageFilter.h" 00029 #include "itkSignedMaurerDistanceMapImageFilter.h" 00030 #include "itkNumericTraits.h" 00031 #include "itkLevelSetEvolutionStoppingCriterionBase.h" 00032 00033 namespace itk 00034 { 00042 template< class TEquationContainer, class TLevelSet > 00043 class LevelSetEvolutionBase : public Object 00044 { 00045 public: 00046 typedef LevelSetEvolutionBase Self; 00047 typedef SmartPointer< Self > Pointer; 00048 typedef SmartPointer< const Self > ConstPointer; 00049 typedef Object Superclass; 00050 00052 itkTypeMacro( LevelSetEvolutionBase, Object ); 00053 00054 typedef TEquationContainer EquationContainerType; 00055 typedef typename EquationContainerType::Pointer EquationContainerPointer; 00056 typedef typename EquationContainerType::TermContainerType 00057 TermContainerType; 00058 typedef typename TermContainerType::Pointer TermContainerPointer; 00059 00060 typedef typename TermContainerType::TermType TermType; 00061 typedef typename TermType::Pointer TermPointer; 00062 00063 typedef typename TermContainerType::InputImageType InputImageType; 00064 typedef typename InputImageType::PixelType InputImagePixelType; 00065 typedef typename InputImageType::ConstPointer InputImageConstPointer; 00066 typedef typename InputImageType::RegionType InputImageRegionType; 00067 typedef typename NumericTraits< InputImagePixelType >::RealType 00068 InputPixelRealType; 00069 00070 itkStaticConstMacro ( ImageDimension, unsigned int, InputImageType::ImageDimension ); 00071 00072 typedef typename TermContainerType::LevelSetContainerType LevelSetContainerType; 00073 00074 typedef typename LevelSetContainerType::LevelSetIdentifierType LevelSetIdentifierType; 00075 00076 typedef TLevelSet LevelSetType; 00077 typedef typename LevelSetType::InputType LevelSetInputType; 00078 typedef typename LevelSetType::OutputType LevelSetOutputType; 00079 typedef typename LevelSetType::OutputRealType LevelSetOutputRealType; 00080 typedef typename LevelSetType::LevelSetDataType LevelSetDataType; 00081 00082 typedef typename LevelSetContainerType::IdListType IdListType; 00083 typedef typename LevelSetContainerType::IdListIterator IdListIterator; 00084 typedef typename LevelSetContainerType::IdListConstIterator IdListConstIterator; 00085 typedef typename LevelSetContainerType::IdListImageType IdListImageType; 00086 typedef typename LevelSetContainerType::CacheImageType CacheImageType; 00087 00088 typedef typename LevelSetContainerType::DomainMapImageFilterType DomainMapImageFilterType; 00089 00090 typedef LevelSetEvolutionStoppingCriterionBase< LevelSetContainerType > 00091 StoppingCriterionType; 00092 typedef typename StoppingCriterionType::Pointer StoppingCriterionPointer; 00093 00094 itkSetObjectMacro( LevelSetContainer, LevelSetContainerType ); 00095 itkGetObjectMacro( LevelSetContainer, LevelSetContainerType ); 00096 00098 itkSetMacro( Alpha, LevelSetOutputRealType ); 00099 itkGetMacro( Alpha, LevelSetOutputRealType ); 00101 00103 void SetTimeStep( const LevelSetOutputRealType& iDt ); 00104 00106 itkSetObjectMacro( EquationContainer, EquationContainerType ); 00107 itkGetObjectMacro( EquationContainer, EquationContainerType ); 00109 00111 itkGetObjectMacro( StoppingCriterion, StoppingCriterionType ); 00112 itkSetObjectMacro( StoppingCriterion, StoppingCriterionType ); 00114 00116 itkGetConstMacro( NumberOfIterations, IdentifierType ); 00117 00121 void Update(); 00122 00123 protected: 00124 LevelSetEvolutionBase(); 00125 00126 virtual ~LevelSetEvolutionBase(); 00127 00128 void CheckSetUp(); 00129 00131 void InitializeIteration(); 00132 00137 void Evolve(); 00138 00141 virtual void AllocateUpdateBuffer(); 00142 00145 virtual void ComputeIteration(); 00146 00148 virtual void ComputeTimeStepForNextIteration(); 00149 00150 virtual void UpdateLevelSets() = 0; 00151 00152 virtual void UpdateEquations() = 0; 00153 00154 StoppingCriterionPointer m_StoppingCriterion; 00155 00156 EquationContainerPointer m_EquationContainer; 00157 typename LevelSetContainerType::Pointer m_LevelSetContainer; 00158 00159 LevelSetOutputRealType m_Alpha; 00160 LevelSetOutputRealType m_Dt; 00161 LevelSetOutputRealType m_RMSChangeAccumulator; 00162 bool m_UserGloballyDefinedTimeStep; 00163 IdentifierType m_NumberOfIterations; 00164 00166 typename LevelSetContainerType::Iterator m_LevelSetContainerIteratorToProcessWhenThreading; 00167 typename LevelSetContainerType::Iterator m_LevelSetUpdateContainerIteratorToProcessWhenThreading; 00168 00169 private: 00170 LevelSetEvolutionBase( const Self& ); // purposely not implemented 00171 void operator = ( const Self& ); // purposely not implemented 00172 }; 00173 } 00174 00175 #ifndef ITK_MANUAL_INSTANTIATION 00176 #include "itkLevelSetEvolutionBase.hxx" 00177 #endif 00178 00179 #endif // __itkLevelSetEvolutionBase_h 00180
1.7.6.1