00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkRobustAutomaticThresholdCalculator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-23 03:43:42 $ 00007 Version: $Revision: 1.2 $ 00008 00009 Copyright (c) Insight Software 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 __itkRobustAutomaticThresholdCalculator_h 00018 #define __itkRobustAutomaticThresholdCalculator_h 00019 00020 #include "itkMacro.h" 00021 #include "itkImage.h" 00022 00023 namespace itk 00024 { 00025 00031 template < class TInputImage, class TGradientImage > 00032 class ITK_EXPORT RobustAutomaticThresholdCalculator : public Object 00033 { 00034 public: 00036 typedef RobustAutomaticThresholdCalculator Self; 00037 typedef Object Superclass; 00038 typedef SmartPointer<Self> Pointer; 00039 typedef SmartPointer<const Self> ConstPointer; 00040 00042 itkNewMacro(Self); 00043 00045 itkTypeMacro(RobustAutomaticThresholdCalculator, Object); 00046 00048 itkStaticConstMacro(ImageDimension, unsigned int, 00049 TInputImage::ImageDimension); 00050 00052 typedef TInputImage InputImageType; 00053 typedef TGradientImage GradientImageType; 00054 00056 typedef typename InputImageType::Pointer InputImagePointer; 00057 typedef typename InputImageType::ConstPointer InputImageConstPointer; 00058 typedef typename GradientImageType::Pointer GradientImagePointer; 00059 typedef typename GradientImageType::ConstPointer GradientImageConstPointer; 00060 typedef typename InputImageType::PixelType InputPixelType; 00061 typedef typename GradientImageType::PixelType GradientPixelType; 00062 00064 virtual void SetInput( const InputImageType * image ) 00065 { 00066 if ( m_Input != image ) 00067 { 00068 m_Input = image; 00069 this->Modified(); 00070 m_Valid = false; 00071 } 00072 } 00074 00075 virtual void SetGradient( const GradientImageType * image ) 00076 { 00077 if ( m_Gradient != image ) 00078 { 00079 m_Gradient = image; 00080 this->Modified(); 00081 m_Valid = false; 00082 } 00083 } 00084 00085 itkSetMacro(Pow, double); 00086 itkGetConstMacro(Pow, double); 00087 00093 void Compute( void ); 00094 00095 const InputPixelType & GetOutput() const; 00096 00097 protected: 00098 RobustAutomaticThresholdCalculator(); 00099 virtual ~RobustAutomaticThresholdCalculator() {}; 00100 void PrintSelf(std::ostream& os, Indent indent) const; 00101 00102 private: 00103 RobustAutomaticThresholdCalculator(const Self&); //purposely not implemented 00104 void operator=(const Self&); //purposely not implemented 00105 00106 bool m_Valid; // Have moments been computed yet? 00107 double m_Pow; 00108 InputPixelType m_Output; 00109 00110 InputImageConstPointer m_Input; 00111 GradientImageConstPointer m_Gradient; 00112 00113 }; // class RobustAutomaticThresholdCalculator 00114 00115 } // end namespace itk 00116 00117 00118 #ifndef ITK_MANUAL_INSTANTIATION 00119 #include "itkRobustAutomaticThresholdCalculator.txx" 00120 #endif 00121 00122 #endif /* __itkRobustAutomaticThresholdCalculator_h */ 00123