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 #ifndef __itkUpdateWhitakerSparseLevelSet_h 00020 #define __itkUpdateWhitakerSparseLevelSet_h 00021 00022 #include "itkImage.h" 00023 #include "itkDiscreteLevelSetImageBase.h" 00024 #include "itkWhitakerSparseLevelSetImage.h" 00025 #include "itkImageRegionIteratorWithIndex.h" 00026 #include "itkShapedNeighborhoodIterator.h" 00027 #include "itkNeighborhoodAlgorithm.h" 00028 #include "itkLabelMapToLabelImageFilter.h" 00029 #include "itkLabelImageToLabelMapFilter.h" 00030 00031 namespace itk 00032 { 00042 template< unsigned int VDimension, 00043 typename TLevelSetValueType, 00044 class TEquationContainer > 00045 class UpdateWhitakerSparseLevelSet : public Object 00046 { 00047 public: 00048 typedef UpdateWhitakerSparseLevelSet Self; 00049 typedef SmartPointer< Self > Pointer; 00050 typedef SmartPointer< const Self > ConstPointer; 00051 typedef Object Superclass; 00052 00054 itkNewMacro( Self ); 00055 00057 itkTypeMacro( UpdateWhitakerSparseLevelSet, Object ); 00058 00059 itkStaticConstMacro( ImageDimension, unsigned int, VDimension ); 00060 00061 typedef TLevelSetValueType LevelSetOutputType; 00062 00063 typedef WhitakerSparseLevelSetImage< LevelSetOutputType, ImageDimension > 00064 LevelSetType; 00065 typedef typename LevelSetType::Pointer LevelSetPointer; 00066 typedef typename LevelSetType::InputType LevelSetInputType; 00067 00068 typedef typename LevelSetType::LabelMapType LevelSetLabelMapType; 00069 typedef typename LevelSetType::LabelMapPointer LevelSetLabelMapPointer; 00070 00071 typedef typename LevelSetType::LabelObjectType LevelSetLabelObjectType; 00072 typedef typename LevelSetType::LabelObjectPointer LevelSetLabelObjectPointer; 00073 typedef typename LevelSetType::LabelObjectLengthType LevelSetLabelObjectLengthType; 00074 typedef typename LevelSetType::LabelObjectLineType LevelSetLabelObjectLineType; 00075 00076 typedef typename LevelSetType::LayerIdType LevelSetLayerIdType; 00077 typedef typename LevelSetType::LayerType LevelSetLayerType; 00078 typedef typename LevelSetType::LayerIterator LevelSetLayerIterator; 00079 typedef typename LevelSetType::LayerConstIterator LevelSetLayerConstIterator; 00080 typedef typename LevelSetType::OutputRealType LevelSetOutputRealType; 00081 00082 typedef typename LevelSetType::LayerMapType LevelSetLayerMapType; 00083 typedef typename LevelSetType::LayerMapIterator LevelSetLayerMapIterator; 00084 typedef typename LevelSetType::LayerMapConstIterator LevelSetLayerMapConstIterator; 00085 00086 typedef TEquationContainer EquationContainerType; 00087 typedef typename EquationContainerType::Pointer EquationContainerPointer; 00088 00089 typedef typename EquationContainerType::TermContainerType TermContainerType; 00090 typedef typename EquationContainerType::TermContainerPointer TermContainerPointer; 00091 00092 typedef Image< LevelSetLayerIdType, ImageDimension > LabelImageType; 00093 typedef typename LabelImageType::Pointer LabelImagePointer; 00094 00095 typedef LabelMapToLabelImageFilter< LevelSetLabelMapType, LabelImageType > LabelMapToLabelImageFilterType; 00096 typedef LabelImageToLabelMapFilter< LabelImageType, LevelSetLabelMapType > LabelImageToLabelMapFilterType; 00097 00098 itkGetObjectMacro( OutputLevelSet, LevelSetType ); 00099 00101 void Update(); 00102 00104 itkSetObjectMacro( InputLevelSet, LevelSetType ); 00105 itkGetObjectMacro( InputLevelSet, LevelSetType ); 00107 00109 itkSetMacro( TimeStep, LevelSetOutputType ); 00110 itkGetMacro( TimeStep, LevelSetOutputType ); 00112 00114 itkGetMacro( RMSChangeAccumulator, LevelSetOutputType ); 00115 00117 itkSetObjectMacro( EquationContainer, EquationContainerType ); 00118 itkGetObjectMacro( EquationContainer, EquationContainerType ); 00120 00122 itkSetMacro( CurrentLevelSetId, IdentifierType ); 00123 itkGetMacro( CurrentLevelSetId, IdentifierType ); 00125 00127 void SetUpdate( const LevelSetLayerType& iUpdate ); 00128 00129 00130 protected: 00131 UpdateWhitakerSparseLevelSet(); 00132 virtual ~UpdateWhitakerSparseLevelSet(); 00133 00135 void UpdateLayerZero(); 00136 00138 void UpdateLayerMinus1(); 00139 00141 void UpdateLayerPlus1(); 00142 00144 void UpdateLayerMinus2(); 00145 00147 void UpdateLayerPlus2(); 00148 00150 void MovePointIntoZeroLevelSet(); 00151 00153 void MovePointFromMinus1(); 00154 00156 void MovePointFromPlus1(); 00157 00159 void MovePointFromMinus2(); 00160 00162 void MovePointFromPlus2(); 00163 00164 private: 00165 UpdateWhitakerSparseLevelSet( const Self& ); // purposely not implemented 00166 void operator = ( const Self& ); // purposely not implemented 00167 00168 LevelSetOutputType m_TimeStep; 00169 LevelSetOutputType m_RMSChangeAccumulator; 00170 IdentifierType m_CurrentLevelSetId; 00171 00172 EquationContainerPointer m_EquationContainer; 00173 00174 LevelSetLayerType m_Update; 00175 LevelSetPointer m_InputLevelSet; 00176 LevelSetPointer m_OutputLevelSet; 00177 00178 LevelSetPointer m_TempLevelSet; 00179 LevelSetLayerType m_TempPhi; 00180 00181 LevelSetLayerIdType m_MinStatus; 00182 LevelSetLayerIdType m_MaxStatus; 00183 00184 LabelImagePointer m_InternalImage; 00185 00186 typedef ShapedNeighborhoodIterator< LabelImageType > NeighborhoodIteratorType; 00187 00188 typedef std::pair< LevelSetInputType, LevelSetOutputType > NodePairType; 00189 }; 00190 } 00191 00192 #ifndef ITK_MANUAL_INSTANTIATION 00193 #include "itkUpdateWhitakerSparseLevelSet.hxx" 00194 #endif 00195 #endif // __itkUpdateWhitakerSparseLevelSet_h 00196