00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html 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 00018 #ifndef HISTOGRAM_GENERATOR_H_HEADER_INCLUDED 00019 #define HISTOGRAM_GENERATOR_H_HEADER_INCLUDED 00020 00021 #include <itkObject.h> 00022 #include <itkHistogram.h> 00023 #include <itkImage.h> 00024 #include "mitkImage.h" 00025 00026 namespace mitk { 00027 00028 //##Documentation 00029 //## @brief Provides an easy way to calculate an itk::Histogram for a mitk::Image 00030 //## 00031 class MITK_CORE_EXPORT HistogramGenerator : public itk::Object 00032 { 00033 public: 00034 mitkClassMacro(HistogramGenerator,itk::Object); 00035 00036 itkNewMacro(Self); 00037 typedef itk::Statistics::Histogram<double> HistogramType; 00038 00039 itkSetMacro(Image,mitk::Image::ConstPointer); 00040 itkSetMacro(Size,int); 00041 itkGetConstMacro(Size,int); 00042 itkGetConstObjectMacro(Histogram,HistogramType); 00043 00044 // TODO: calculate if needed in GetHistogram() 00045 void ComputeHistogram(); 00046 float GetMaximumFrequency() const; 00047 static float CalculateMaximumFrequency(const HistogramType* histogram); 00048 protected: 00049 HistogramGenerator(); 00050 00051 virtual ~HistogramGenerator(); 00052 00053 mitk::Image::ConstPointer m_Image; 00054 int m_Size; 00055 HistogramType::ConstPointer m_Histogram; 00056 }; 00057 00058 } // namespace mitk 00059 00060 #endif /* HISTOGRAM_GENERATOR_H_HEADER_INCLUDED */