| 61 | } |
| 62 | |
| 63 | void 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 | |
| 105 | float mitk::HistogramGenerator::GetMaximumFrequency() const |
| 106 | { |
no test coverage detected