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 #ifndef __itkShapePriorSegmentationLevelSetFunction_h 00019 #define __itkShapePriorSegmentationLevelSetFunction_h 00020 00021 #include "itkSegmentationLevelSetFunction.h" 00022 #include "itkShapeSignedDistanceFunction.h" 00023 00024 namespace itk 00025 { 00054 template< class TImageType, class TFeatureImageType = TImageType > 00055 class ITK_EXPORT ShapePriorSegmentationLevelSetFunction: 00056 public SegmentationLevelSetFunction< TImageType, TFeatureImageType > 00057 { 00058 public: 00060 typedef ShapePriorSegmentationLevelSetFunction Self; 00061 typedef SegmentationLevelSetFunction< TImageType, TFeatureImageType > 00062 Superclass; 00063 typedef SmartPointer< Self > Pointer; 00064 typedef SmartPointer< const Self > ConstPointer; 00065 typedef TFeatureImageType FeatureImageType; 00066 00068 itkNewMacro(Self); 00069 00071 itkTypeMacro(ShapePriorSegmentationLevelSetFunction, SegmentationLevelSetFunction); 00072 00074 typedef typename Superclass::ImageType ImageType; 00075 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00076 typedef typename Superclass::ScalarValueType ScalarValueType; 00077 typedef typename Superclass::FeatureScalarType FeatureScalarType; 00078 typedef typename Superclass::RadiusType RadiusType; 00079 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00080 typedef typename Superclass::VectorImageType VectorImageType; 00081 typedef typename Superclass::PixelType PixelType; 00082 typedef typename Superclass::TimeStepType TimeStepType; 00083 typedef typename Superclass::IndexType IndexType; 00084 typedef typename Superclass::ContinuousIndexType ContinuousIndexType; 00085 00087 itkStaticConstMacro(ImageDimension, unsigned int, 00088 Superclass::ImageDimension); 00089 00091 typedef ShapeSignedDistanceFunction< double, 00092 itkGetStaticConstMacro(ImageDimension) > ShapeFunctionType; 00093 typedef typename ShapeFunctionType::ConstPointer ShapeFunctionPointer; 00094 00096 void SetShapePriorWeight(const ScalarValueType p) 00097 { m_ShapePriorWeight = p; } 00098 ScalarValueType GetShapePriorWeight() const 00099 { return m_ShapePriorWeight; } 00101 00104 void SetShapeFunction(const ShapeFunctionType *ptr) 00105 { m_ShapeFunction = ptr; } 00106 const ShapeFunctionType * GetShapeFunction() const 00107 { return m_ShapeFunction; } 00109 00111 virtual PixelType ComputeUpdate( const NeighborhoodType & neighborhood, 00112 void *globalData, 00113 const FloatOffsetType & = FloatOffsetType(0.0) ); 00114 00116 virtual TimeStepType ComputeGlobalTimeStep(void *globalData) const; 00117 00120 typedef typename Superclass::GlobalDataStruct GlobalDataStruct; 00121 struct ShapePriorGlobalDataStruct:public GlobalDataStruct { 00122 ScalarValueType m_MaxShapePriorChange; 00123 }; 00124 00126 virtual void * GetGlobalDataPointer() const 00127 { 00128 ShapePriorGlobalDataStruct *ans = new ShapePriorGlobalDataStruct(); 00129 00130 ans->m_MaxAdvectionChange = NumericTraits< ScalarValueType >::Zero; 00131 ans->m_MaxPropagationChange = NumericTraits< ScalarValueType >::Zero; 00132 ans->m_MaxCurvatureChange = NumericTraits< ScalarValueType >::Zero; 00133 ans->m_MaxShapePriorChange = NumericTraits< ScalarValueType >::Zero; 00134 return ans; 00135 } 00136 00138 virtual void ReleaseGlobalDataPointer(void *GlobalData) const 00139 { delete (ShapePriorGlobalDataStruct *)GlobalData; } 00140 protected: 00141 ShapePriorSegmentationLevelSetFunction(); 00142 virtual ~ShapePriorSegmentationLevelSetFunction() {} 00144 00145 ShapePriorSegmentationLevelSetFunction(const Self &); //purposely not 00146 // implemented 00147 void operator=(const Self &); //purposely not 00148 // implemented 00149 00150 void PrintSelf(std::ostream & os, Indent indent) const; 00151 00152 private: 00153 00154 ShapeFunctionPointer m_ShapeFunction; 00155 ScalarValueType m_ShapePriorWeight; 00156 }; 00157 } // end namespace itk 00158 00159 #ifndef ITK_MANUAL_INSTANTIATION 00160 #include "itkShapePriorSegmentationLevelSetFunction.hxx" 00161 #endif 00162 00163 #endif 00164