00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkImageToHistogramGenerator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-04 15:23:50 $ 00007 Version: $Revision: 1.8 $ 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 <typename TAdaptor > 00030 struct GetAdaptorMeasurementVectorLength 00031 { 00032 itkStaticConstMacro( MeasurementVectorLength, unsigned int, TAdaptor::MeasurementVectorSize ); 00033 }; 00034 00046 template< class TImageType > 00047 class ImageToHistogramGenerator : public Object 00048 { 00049 public: 00051 typedef ImageToHistogramGenerator Self; 00052 typedef Object Superclass; 00053 typedef SmartPointer<Self> Pointer; 00054 typedef SmartPointer<const Self> ConstPointer; 00055 00057 itkTypeMacro(ImageToHistogramGenerator, Object); 00058 00060 itkNewMacro(Self); 00061 00062 typedef TImageType ImageType; 00063 typedef ImageToListAdaptor< ImageType > AdaptorType; 00064 typedef typename AdaptorType::Pointer AdaptorPointer; 00065 typedef typename ImageType::PixelType PixelType; 00066 typedef typename PixelType::ValueType ValueType; 00067 typedef typename NumericTraits< ValueType >::RealType ValueRealType; 00068 typedef DenseFrequencyContainer FrequencyContainerType; 00069 00070 typedef ListSampleToHistogramGenerator< 00071 AdaptorType, 00072 ValueRealType, 00073 FrequencyContainerType, 00074 ::itk::Statistics::GetAdaptorMeasurementVectorLength< 00075 AdaptorType >::MeasurementVectorLength 00076 > GeneratorType; 00077 00078 typedef typename GeneratorType::Pointer GeneratorPointer; 00079 00080 typedef typename GeneratorType::HistogramType HistogramType; 00081 typedef typename HistogramType::Pointer HistogramPointer; 00082 typedef typename HistogramType::ConstPointer HistogramConstPointer; 00083 typedef typename HistogramType::SizeType SizeType; 00084 typedef typename HistogramType::MeasurementVectorType MeasurementVectorType; 00085 00086 public: 00087 00089 void Compute( void ); 00090 00092 void SetInput( const ImageType * ); 00093 00097 const HistogramType * GetOutput() const; 00098 00100 void SetNumberOfBins( const SizeType & size ); 00101 00103 void SetMarginalScale( double marginalScale ); 00104 void SetHistogramMin(const MeasurementVectorType & histogramMin); 00105 void SetHistogramMax(const MeasurementVectorType & histogramMax); 00106 void SetAutoMinMax(bool autoMinMax); 00108 00109 protected: 00110 ImageToHistogramGenerator(); 00111 virtual ~ImageToHistogramGenerator() {}; 00112 void PrintSelf(std::ostream& os, Indent indent) const; 00113 00114 00115 private: 00116 00117 AdaptorPointer m_ImageToListAdaptor; 00118 00119 GeneratorPointer m_HistogramGenerator; 00120 00121 }; 00122 00123 00124 } // end of namespace Statistics 00125 } // end of namespace itk 00126 00127 #ifndef ITK_MANUAL_INSTANTIATION 00128 #include "itkImageToHistogramGenerator.txx" 00129 #endif 00130 00131 #endif 00132