Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkOtsuMultipleThresholdsImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkOtsuMultipleThresholdsImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-01-26 21:45:54 $
00007   Version:   $Revision: 1.4 $
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 __itkOtsuMultipleThresholdsImageFilter_h
00018 #define __itkOtsuMultipleThresholdsImageFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkFixedArray.h"
00022 #include "itkOtsuMultipleThresholdsCalculator.h"
00023 #include "itkScalarImageToHistogramGenerator.h"
00024 
00025 namespace itk {
00026 
00045 template<class TInputImage, class TOutputImage>
00046 class ITK_EXPORT OtsuMultipleThresholdsImageFilter : 
00047     public ImageToImageFilter<TInputImage, TOutputImage>
00048 {
00049 public:
00051   typedef OtsuMultipleThresholdsImageFilter             Self;
00052   typedef ImageToImageFilter<TInputImage,TOutputImage>  Superclass;
00053   typedef SmartPointer<Self>                            Pointer;
00054   typedef SmartPointer<const Self>                      ConstPointer;
00055 
00057   itkNewMacro(Self);  
00058 
00060   itkTypeMacro(OtsuMultipleThresholdsImageFilter, ImageToImageFilter);
00061 
00063   typedef typename TInputImage::PixelType  InputPixelType;
00064   typedef typename TOutputImage::PixelType OutputPixelType;
00065 
00067   typedef typename TInputImage::Pointer  InputImagePointer;
00068   typedef typename TOutputImage::Pointer OutputImagePointer;
00069 
00070   typedef typename TInputImage::SizeType    InputSizeType;
00071   typedef typename TInputImage::IndexType   InputIndexType;
00072   typedef typename TInputImage::RegionType  InputImageRegionType;
00073   typedef typename TOutputImage::SizeType   OutputSizeType;
00074   typedef typename TOutputImage::IndexType  OutputIndexType;
00075   typedef typename TOutputImage::RegionType OutputImageRegionType;
00076 
00078   typedef itk::Statistics::ScalarImageToHistogramGenerator<TInputImage>
00079                                                             HistogramGeneratorType;
00080   typedef typename HistogramGeneratorType::HistogramType    HistogramType;
00081   typedef OtsuMultipleThresholdsCalculator< HistogramType > OtsuCalculatorType;
00082   typedef typename OtsuCalculatorType::OutputType           ThresholdVectorType;
00083 
00085   itkStaticConstMacro(InputImageDimension, unsigned int,
00086                       TInputImage::ImageDimension );
00087   itkStaticConstMacro(OutputImageDimension, unsigned int,
00088                       TOutputImage::ImageDimension );
00090 
00092   itkSetClampMacro( NumberOfHistogramBins, unsigned long, 1, NumericTraits<unsigned long>::max() );
00093   itkGetConstMacro( NumberOfHistogramBins, unsigned long );
00095 
00097   itkSetClampMacro(NumberOfThresholds, unsigned long, 1, NumericTraits<unsigned long>::max() );
00098   itkGetConstMacro(NumberOfThresholds,unsigned long);
00100 
00102   itkSetClampMacro(LabelOffset,OutputPixelType, NumericTraits<OutputPixelType>::Zero,NumericTraits<OutputPixelType>::max() );
00103   itkGetConstMacro(LabelOffset,OutputPixelType);
00105 
00107   const ThresholdVectorType & GetThresholds() const
00108     {
00109     return m_Thresholds;
00110     }
00111 
00112 #ifdef ITK_USE_CONCEPT_CHECKING
00113 
00114   itkConceptMacro(OutputComparableCheck,
00115     (Concept::Comparable<OutputPixelType>));
00116   itkConceptMacro(OutputOStreamWritableCheck,
00117     (Concept::OStreamWritable<OutputPixelType>));
00118 
00120 #endif
00121 
00122 protected:
00123   OtsuMultipleThresholdsImageFilter();
00124   ~OtsuMultipleThresholdsImageFilter(){};
00125   void PrintSelf(std::ostream& os, Indent indent) const;
00126 
00127   void GenerateInputRequestedRegion();
00128   void GenerateData ();
00129 
00130 private:
00131   OtsuMultipleThresholdsImageFilter(const Self&); //purposely not implemented
00132   void operator=(const Self&); //purposely not implemented
00133 
00134   unsigned long           m_NumberOfHistogramBins;
00135   unsigned long           m_NumberOfThresholds;
00136   OutputPixelType         m_LabelOffset;
00137   ThresholdVectorType     m_Thresholds;
00138 
00139 
00140 }; // end of class
00141 
00142 } // end namespace itk
00143   
00144 #ifndef ITK_MANUAL_INSTANTIATION
00145 #include "itkOtsuMultipleThresholdsImageFilter.txx"
00146 #endif
00147 
00148 #endif
00149 

Generated at Sat Feb 28 13:13:33 2009 for ITK by doxygen 1.5.6 written by Dimitri van Heesch, © 1997-2000