00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkThresholdSegmentationLevelSetFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/11/19 17:54:42 $ 00007 Version: $Revision: 1.7 $ 00008 00009 Copyright (c) 2002 Insight Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkThresholdSegmentationLevelSetFunction_h_ 00018 #define __itkThresholdSegmentationLevelSetFunction_h_ 00019 00020 #include "itkSegmentationLevelSetFunction.h" 00021 00022 namespace itk { 00023 00045 template <class TImageType, class TFeatureImageType = TImageType> 00046 class ITK_EXPORT ThresholdSegmentationLevelSetFunction 00047 : public SegmentationLevelSetFunction<TImageType, TFeatureImageType> 00048 { 00049 public: 00051 typedef ThresholdSegmentationLevelSetFunction Self; 00052 typedef SegmentationLevelSetFunction<TImageType> Superclass; 00053 typedef SmartPointer<Self> Pointer; 00054 typedef SmartPointer<const Self> ConstPointer; 00055 typedef TFeatureImageType FeatureImageType; 00056 00058 itkNewMacro(Self); 00059 00061 itkTypeMacro( ThresholdSegmentationLevelSetFunction, SegmentationLevelSetFunction ); 00062 00064 typedef typename Superclass::ImageType ImageType; 00065 typedef typename Superclass::ScalarValueType ScalarValueType; 00066 typedef typename Superclass::FeatureScalarType FeatureScalarType; 00067 typedef typename Superclass::RadiusType RadiusType; 00068 00070 itkStaticConstMacro(ImageDimension, unsigned int, 00071 Superclass::ImageDimension); 00072 00074 void SetUpperThreshold(FeatureScalarType f) 00075 { m_UpperThreshold = f; } 00076 FeatureScalarType GetUpperThreshold() const 00077 { return m_UpperThreshold; } 00078 void SetLowerThreshold(FeatureScalarType f) 00079 { m_LowerThreshold = f; } 00080 FeatureScalarType GetLowerThreshold() const 00081 { return m_LowerThreshold; } 00082 00083 virtual void CalculateSpeedImage(); 00084 00085 virtual void Initialize(const RadiusType &r) 00086 { 00087 Superclass::Initialize(r); 00088 00089 this->SetAdvectionWeight( NumericTraits<ScalarValueType>::Zero); 00090 this->SetPropagationWeight(-1.0 * NumericTraits<ScalarValueType>::One); 00091 this->SetCurvatureWeight(NumericTraits<ScalarValueType>::One); 00092 } 00093 00094 protected: 00095 ThresholdSegmentationLevelSetFunction() 00096 { 00097 this->SetAdvectionWeight(0.0); 00098 this->SetPropagationWeight(1.0); 00099 this->SetCurvatureWeight(1.0); 00100 } 00101 virtual ~ThresholdSegmentationLevelSetFunction() {} 00102 00103 ThresholdSegmentationLevelSetFunction(const Self&); //purposely not implemented 00104 void operator=(const Self&); //purposely not implemented 00105 00106 void PrintSelf(std::ostream& os, Indent indent) const 00107 { 00108 Superclass::PrintSelf(os, indent ); 00109 os << indent << "UpperThreshold: " << m_UpperThreshold << std::endl; 00110 os << indent << "LowerThreshold: " << m_LowerThreshold << std::endl; 00111 } 00112 00113 FeatureScalarType m_UpperThreshold; 00114 FeatureScalarType m_LowerThreshold; 00115 }; 00116 00117 } // end namespace itk 00118 00119 #ifndef ITK_MANUAL_INSTANTIATION 00120 #include "itkThresholdSegmentationLevelSetFunction.txx" 00121 #endif 00122 00123 #endif