Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
itkMITKScalarImageToHistogramGenerator.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef itkMITKScalarImageToHistogramGenerator_h
14 #define itkMITKScalarImageToHistogramGenerator_h
15 
16 #include <itkImageToListSampleAdaptor.h>
17 #include <itkObject.h>
18 #include <itkSampleToHistogramFilter.h>
19 
20 namespace itk
21 {
22  namespace Statistics
23  {
34  template <class TImageType, class TMeasurementType = typename TImageType::PixelType>
36  {
37  public:
40  typedef Object Superclass;
43 
45  itkTypeMacro(MITKScalarImageToHistogramGenerator, Object);
46 
48  itkFactorylessNewMacro(Self);
49  itkCloneMacro(Self);
50 
51  typedef TImageType ImageType;
52  typedef itk::Statistics::ImageToListSampleAdaptor<ImageType> AdaptorType;
53  typedef typename AdaptorType::Pointer AdaptorPointer;
54  typedef typename ImageType::PixelType PixelType;
55 
56  typedef itk::Statistics::Histogram<TMeasurementType, itk::Statistics::DenseFrequencyContainer2> HistogramType;
57  typedef itk::Statistics::SampleToHistogramFilter<AdaptorType, HistogramType> GeneratorType;
58 
59  typedef typename GeneratorType::Pointer GeneratorPointer;
60 
61  typedef typename HistogramType::Pointer HistogramPointer;
62  typedef typename HistogramType::ConstPointer HistogramConstPointer;
63 
64  public:
66  void Compute(void);
67 
71  void SetInput(const ImageType *image);
72 
79  const HistogramType *GetOutput() const;
80 
84  void SetNumberOfBins(unsigned int numberOfBins);
85 
89  void SetMarginalScale(double marginalScale);
90 
91  protected:
96 
98  void PrintSelf(std::ostream &os, Indent indent) const override;
99 
100  private:
101  AdaptorPointer m_ImageToListAdaptor;
102 
103  GeneratorPointer m_HistogramGenerator;
104  };
105 
106  } // end of namespace Statistics
107 } // end of namespace itk
108 
109 #ifndef ITK_MANUAL_INSTANTIATION
110 #include <itkMITKScalarImageToHistogramGenerator.tpp>
111 #endif
112 
113 #endif
void PrintSelf(std::ostream &os, Indent indent) const override
Print the state of this object to an output stream.
MITKScalarImageToHistogramGenerator Self
Standard typedefs.
itk::Statistics::SampleToHistogramFilter< AdaptorType, HistogramType > GeneratorType
itk::Statistics::ImageToListSampleAdaptor< ImageType > AdaptorType
MITKScalarImageToHistogramGenerator()
Default constructor. Creates the adaptor and histogram generator.
void Compute(void)
Trigger the computation of the histogram.
void SetNumberOfBins(unsigned int numberOfBins)
Set number of histogram bins.
itk::Statistics::Histogram< TMeasurementType, itk::Statistics::DenseFrequencyContainer2 > HistogramType
const HistogramType * GetOutput() const
Return the computed histogram.
void SetMarginalScale(double marginalScale)
Set the marginal scale value to be passed to the histogram generator.
void SetInput(const ImageType *image)
Connect the input image for which the histogram is going to be computed.