00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkImageToHistogramGenerator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/12/12 00:36:04 $ 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 __itkImageToHistogramGenerator_h 00018 #define __itkImageToHistogramGenerator_h 00019 00020 00021 #include "itkImageToListAdaptor.h" 00022 #include "itkListSampleToHistogramGenerator.h" 00023 #include "itkObject.h" 00024 00025 00026 namespace itk { 00027 namespace Statistics { 00028 00029 template< class TImageType > 00030 class ImageToHistogramGenerator : public Object 00031 { 00032 public: 00034 typedef ImageToHistogramGenerator Self ; 00035 typedef Object Superclass; 00036 typedef SmartPointer<Self> Pointer; 00037 typedef SmartPointer<const Self> ConstPointer; 00038 00040 itkTypeMacro(ImageToHistogramGenerator, Object) ; 00041 00043 itkNewMacro(Self) ; 00044 00045 typedef TImageType ImageType; 00046 typedef itk::Statistics::ImageToListAdaptor< 00047 ImageType 00048 > AdaptorType; 00049 typedef typename AdaptorType::Pointer AdaptorPointer; 00050 typedef typename ImageType::PixelType PixelType; 00051 typedef typename PixelType::ValueType ValueType; 00052 typedef typename NumericTraits< ValueType >::RealType ValueRealType; 00053 00054 typedef itk::Statistics::ListSampleToHistogramGenerator< 00055 AdaptorType, 00056 ValueRealType 00057 > GeneratorType; 00058 00059 typedef typename GeneratorType::Pointer GeneratorPointer; 00060 00061 typedef typename GeneratorType::HistogramType HistogramType; 00062 typedef typename HistogramType::Pointer HistogramPointer; 00063 typedef typename HistogramType::ConstPointer HistogramConstPointer; 00064 typedef typename HistogramType::SizeType SizeType; 00065 00066 public: 00067 00069 void Compute( void ); 00070 00072 void SetInput( const ImageType * ); 00073 00077 const HistogramType * GetOutput() const; 00078 00080 void SetNumberOfBins( const SizeType & size ); 00081 00083 void SetMarginalScale( double marginalScale ); 00084 00085 00086 protected: 00087 ImageToHistogramGenerator(); 00088 virtual ~ImageToHistogramGenerator() {}; 00089 void PrintSelf(std::ostream& os, Indent indent) const; 00090 00091 00092 private: 00093 00094 AdaptorPointer m_ImageToListAdaptor; 00095 00096 GeneratorPointer m_HistogramGenerator; 00097 00098 }; 00099 00100 00101 } // end of namespace Statistics 00102 } // end of namespace itk 00103 00104 #ifndef ITK_MANUAL_INSTANTIATION 00105 #include "itkImageToHistogramGenerator.txx" 00106 #endif 00107 00108 #endif