MCPcopy Create free account
hub / github.com/MITK/MITK / ComputeHistogram

Method ComputeHistogram

Modules/Core/src/Algorithms/mitkHistogramGenerator.cpp:63–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void mitk::HistogramGenerator::ComputeHistogram()
64{
65 if ((m_Histogram.IsNull()) || (m_Histogram->GetMTime() < m_Image->GetMTime()))
66 {
67 const_cast<mitk::Image *>(m_Image.GetPointer())->SetRequestedRegionToLargestPossibleRegion(); //@todo without this,
68 // Image::GetScalarMin
69 // does not work for
70 // dim==3 (including
71 // sliceselector!)
72 const_cast<mitk::Image *>(m_Image.GetPointer())->Update();
73 mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
74 timeSelector->SetInput(m_Image);
75 timeSelector->SetTimeNr(0);
76 timeSelector->UpdateLargestPossibleRegion();
77 AccessByItk_n(timeSelector->GetOutput(), InternalCompute, (this, m_Histogram));
78 }
79
80 // debug code
81 /*
82 MITK_INFO << "Histogram modified 1" << m_Histogram->GetMTime() << std::endl;
83 m_Histogram->Modified();
84 MITK_INFO << "Histogram modified 2" << m_Histogram->GetMTime() << std::endl;
85 MITK_INFO << "Image modified" << m_Image->GetMTime() << std::endl;
86 const unsigned int histogramSize = m_Histogram->Size();
87
88 MITK_INFO << "Histogram size " << histogramSize << std::endl;
89
90 HistogramType::ConstIterator itr = GetHistogram()->Begin();
91 HistogramType::ConstIterator end = GetHistogram()->End();
92
93 int bin = 0;
94 while( itr != end )
95 {
96 MITK_INFO << "bin = " << GetHistogram()->GetBinMin(0,bin) << "--" << GetHistogram()->GetBinMax(0,bin) << " frequency
97 = ";
98 MITK_INFO << itr.GetFrequency() << std::endl;
99 ++itr;
100 ++bin;
101 }
102 */
103}
104
105float mitk::HistogramGenerator::GetMaximumFrequency() const
106{

Callers 4

GetScalarHistogramMethod · 0.80
InitializeByMitkImageMethod · 0.80
InitializeHistogramMethod · 0.80
ComputeFromBaseDataMethod · 0.80

Calls 8

GetPointerMethod · 0.80
NewFunction · 0.50
IsNullMethod · 0.45
GetMTimeMethod · 0.45
UpdateMethod · 0.45
SetInputMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected