00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkOtsuThresholdImageCalculator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-23 03:53:36 $ 00007 Version: $Revision: 1.9 $ 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 __itkOtsuThresholdImageCalculator_h 00018 #define __itkOtsuThresholdImageCalculator_h 00019 00020 #include "itkObject.h" 00021 #include "itkObjectFactory.h" 00022 #include "itkNumericTraits.h" 00023 00024 namespace itk 00025 { 00026 00042 template <class TInputImage> 00043 class ITK_EXPORT OtsuThresholdImageCalculator : public Object 00044 { 00045 public: 00047 typedef OtsuThresholdImageCalculator Self; 00048 typedef Object Superclass; 00049 typedef SmartPointer<Self> Pointer; 00050 typedef SmartPointer<const Self> ConstPointer; 00051 00053 itkNewMacro(Self); 00054 00056 itkTypeMacro(OtsuThresholdImageCalculator, Object); 00057 00059 typedef TInputImage ImageType; 00060 00062 typedef typename TInputImage::Pointer ImagePointer; 00063 00065 typedef typename TInputImage::ConstPointer ImageConstPointer; 00066 00068 typedef typename TInputImage::PixelType PixelType; 00069 00071 typedef typename TInputImage::RegionType RegionType; 00072 00074 itkSetConstObjectMacro(Image,ImageType); 00075 00077 void Compute(void); 00078 00080 itkGetConstMacro(Threshold,PixelType); 00081 00083 itkSetClampMacro( NumberOfHistogramBins, unsigned long, 1, 00084 NumericTraits<unsigned long>::max() ); 00085 itkGetConstMacro( NumberOfHistogramBins, unsigned long ); 00087 00089 void SetRegion( const RegionType & region ); 00090 00091 protected: 00092 OtsuThresholdImageCalculator(); 00093 virtual ~OtsuThresholdImageCalculator() {}; 00094 void PrintSelf(std::ostream& os, Indent indent) const; 00095 00096 private: 00097 OtsuThresholdImageCalculator(const Self&); //purposely not implemented 00098 void operator=(const Self&); //purposely not implemented 00099 00100 PixelType m_Threshold; 00101 unsigned long m_NumberOfHistogramBins; 00102 ImageConstPointer m_Image; 00103 RegionType m_Region; 00104 bool m_RegionSetByUser; 00105 00106 }; 00107 00108 } // end namespace itk 00109 00110 00111 #ifndef ITK_MANUAL_INSTANTIATION 00112 #include "itkOtsuThresholdImageCalculator.txx" 00113 #endif 00114 00115 #endif 00116