Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkVectorThresholdSegmentationLevelSetFunction_h
00018 #define __itkVectorThresholdSegmentationLevelSetFunction_h
00019
00020 #include "itkSegmentationLevelSetFunction.h"
00021 #include "itkNumericTraits.h"
00022 #include "itkMahalanobisDistanceMembershipFunction.h"
00023 namespace itk {
00024
00054 template <class TImageType, class TFeatureImageType>
00055 class ITK_EXPORT VectorThresholdSegmentationLevelSetFunction
00056 : public SegmentationLevelSetFunction<TImageType, TFeatureImageType>
00057 {
00058 public:
00060 typedef VectorThresholdSegmentationLevelSetFunction Self;
00061 typedef SegmentationLevelSetFunction<TImageType, TFeatureImageType>
00062 Superclass;
00063 typedef SmartPointer<Self> Pointer;
00064 typedef SmartPointer<const Self> ConstPointer;
00065 typedef TFeatureImageType FeatureImageType;
00066
00067
00068
00070 itkNewMacro(Self);
00071
00073 itkTypeMacro( VectorThresholdSegmentationLevelSetFunction, SegmentationLevelSetFunction );
00074
00076 typedef typename Superclass::ImageType ImageType;
00077 typedef typename Superclass::ScalarValueType ScalarValueType;
00078 typedef typename Superclass::FeatureScalarType FeatureScalarType;
00079 typedef typename Superclass::RadiusType RadiusType;
00080
00082 itkStaticConstMacro(ImageDimension, unsigned int,
00083 Superclass::ImageDimension);
00084
00086 typedef typename FeatureImageType::PixelType FeatureImagePixelType;
00087 itkStaticConstMacro(NumberOfComponents, unsigned int,
00088 FeatureImagePixelType::Dimension);
00089
00090
00091 typedef Statistics::MahalanobisDistanceMembershipFunction<FeatureScalarType>
00092 MahalanobisFunctionType;
00093 typedef typename MahalanobisFunctionType::Pointer MahalanobisFunctionPointer;
00094 typedef typename MahalanobisFunctionType::MeanVectorType MeanVectorType;
00095 typedef typename MahalanobisFunctionType::CovarianceMatrixType CovarianceMatrixType;
00096
00098 void SetMean(const MeanVectorType &mean)
00099 { m_Mahalanobis->SetMean(mean); }
00100 const MeanVectorType & GetMean() const
00101 { return m_Mahalanobis->GetMean(); }
00103
00104
00105 void SetCovariance(const CovarianceMatrixType &cov)
00106 { m_Mahalanobis->SetCovariance(cov); }
00107 const CovarianceMatrixType & GetCovariance() const
00108 { return m_Mahalanobis->GetCovariance(); }
00109
00111 void SetThreshold(ScalarValueType thr)
00112 {
00113 m_Threshold = thr;
00114 }
00115 ScalarValueType GetThreshold()
00116 {
00117 return m_Threshold;
00118 }
00120
00121 virtual void CalculateSpeedImage();
00122
00123 virtual void Initialize(const RadiusType &r)
00124 {
00125 Superclass::Initialize(r);
00126
00127 this->SetAdvectionWeight( NumericTraits<ScalarValueType>::Zero);
00128 this->SetPropagationWeight(-1.0 * NumericTraits<ScalarValueType>::One);
00129 this->SetCurvatureWeight(NumericTraits<ScalarValueType>::One);
00130 }
00131
00132
00133 protected:
00134 VectorThresholdSegmentationLevelSetFunction()
00135 {
00136 MeanVectorType mean( NumberOfComponents );
00137 CovarianceMatrixType covariance( NumberOfComponents, NumberOfComponents );
00138
00139 mean.fill(NumericTraits<ITK_TYPENAME FeatureScalarType::ValueType>::Zero);
00140 covariance.fill(NumericTraits<ITK_TYPENAME FeatureScalarType::ValueType>::Zero);
00141
00142 m_Mahalanobis = MahalanobisFunctionType::New();
00143 m_Mahalanobis->SetMean(mean);
00144 m_Mahalanobis->SetCovariance(covariance);
00145
00146 this->SetAdvectionWeight(0.0);
00147 this->SetPropagationWeight(1.0);
00148 this->SetThreshold(1.8);
00149 }
00150 virtual ~VectorThresholdSegmentationLevelSetFunction(){}
00151
00152 VectorThresholdSegmentationLevelSetFunction(const Self&);
00153 void operator=(const Self&);
00154
00155 void PrintSelf(std::ostream& os, Indent indent) const
00156 {
00157 Superclass::PrintSelf(os, indent );
00158 os << indent << "MahalanobisFunction: " << m_Mahalanobis << std::endl;
00159 os << indent << "ThresholdValue: " << m_Threshold << std::endl;
00160 }
00161
00162
00163 MahalanobisFunctionPointer m_Mahalanobis;
00164 ScalarValueType m_Threshold;
00165
00166 };
00167
00168 }
00169
00170 #ifndef ITK_MANUAL_INSTANTIATION
00171 #include "itkVectorThresholdSegmentationLevelSetFunction.txx"
00172 #endif
00173
00174 #endif
00175