diff --git a/app/docks/FramePropertiesDock.cpp b/app/docks/FramePropertiesDock.cpp index 85a6f97..4bc059c 100644 --- a/app/docks/FramePropertiesDock.cpp +++ b/app/docks/FramePropertiesDock.cpp @@ -184,6 +184,11 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc labelRangeValue = new QLabel; labelRangeValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); + QLabel* nEBinsLabel = new QLabel( tr( "Non empty bins:" ) ); + nEBinsLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); + labelNEBinsValue = new QLabel; + labelNEBinsValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); + QLabel* meanLabel = new QLabel( tr( "Mean:" ) ); meanLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); labelMeanValue = new QLabel; @@ -212,6 +217,8 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc statisticsLayout->addWidget( labelCountValue, gridRow++, 1 ); statisticsLayout->addWidget( rangeLabel, gridRow, 0 ); statisticsLayout->addWidget( labelRangeValue, gridRow++, 1 ); + statisticsLayout->addWidget( nEBinsLabel, gridRow, 0 ); + statisticsLayout->addWidget( labelNEBinsValue, gridRow++, 1 ); statisticsLayout->addWidget( meanLabel, gridRow, 0 ); statisticsLayout->addWidget( labelMeanValue, gridRow++, 1 ); statisticsLayout->addWidget( stdDevLabel, gridRow, 0 ); @@ -274,6 +281,7 @@ void FramePropertiesDock::reset() m_iLastFrameType = -1; + labelNEBinsValue->clear(); labelMeanValue->clear(); labelPixelsValue->clear(); labelStdDevValue->clear(); @@ -444,6 +452,9 @@ void FramePropertiesDock::updateStatistiques() if( frame ) { + double numBins = frame->getNEBins( channel ); + labelNEBinsValue->setText( value.setNum( (float)numBins, 'f', 0 ) ); + QString rangeText = "[" + QString::number( frame->getMinimumPelValue( channel ) ) + ":" + QString::number( frame->getMaximumPelValue( channel ) ) + "]"; labelRangeValue->setText( rangeText ); diff --git a/app/docks/FramePropertiesDock.h b/app/docks/FramePropertiesDock.h index 5bd2ce8..e0acc88 100644 --- a/app/docks/FramePropertiesDock.h +++ b/app/docks/FramePropertiesDock.h @@ -72,6 +72,7 @@ private: QLabel* labelPixelsValue; QLabel* labelCountValue; QLabel* labelRangeValue; + QLabel* labelNEBinsValue; QLabel* labelMeanValue; QLabel* labelStdDevValue; QLabel* labelMedianValue; diff --git a/lib/CalypFrame.cpp b/lib/CalypFrame.cpp index fbab86c..3473dbb 100644 --- a/lib/CalypFrame.cpp +++ b/lib/CalypFrame.cpp @@ -913,12 +913,45 @@ unsigned int CalypFrame::getMaximumPelValue( unsigned channel ) { if( d->m_puiHistogram[i] > 0 ) { - return i - indexEnd + 1; + return i - indexEnd - 1; } } return 0; } +unsigned int CalypFrame::getNEBins( unsigned channel ) +{ + if( !d->m_bHasHistogram ) + return 0; + + channel = d->getRealHistogramChannel( channel ); + if( channel < 0 ) + return 0; + + int indexStart; + int indexEnd; + if( channel == HIST_ALL_CHANNELS ) + { + indexStart = 0; + indexEnd = d->m_uiHistoChannels * d->m_uiHistoSegments; + } + else + { + indexStart = channel * d->m_uiHistoSegments; + indexEnd = indexStart + d->m_uiHistoSegments; + } + + int nEBins = 0; + for( int i = indexStart; i < indexEnd; i++ ) + { + if( d->m_puiHistogram[i] > 0 ) + { + nEBins++; + } + } + return nEBins; +} + unsigned int CalypFrame::getMaximum( unsigned channel ) { if( !d->m_bHasHistogram ) diff --git a/lib/CalypFrame.h b/lib/CalypFrame.h index c6fe1b5..f83dc5d 100644 --- a/lib/CalypFrame.h +++ b/lib/CalypFrame.h @@ -361,6 +361,7 @@ public: int getMedian( unsigned channel, unsigned int start, unsigned int end ); double getStdDev( unsigned channel, unsigned int start, unsigned int end ); double getHistogramValue( unsigned channel, unsigned int bin ); + unsigned int getNEBins( unsigned channel ); int getNumHistogramSegment(); /**