Improved statistics:

- Fixed issue with the range maximum value calculation
- Added the number of actual used values
This commit is contained in:
João Santos
2019-05-30 11:21:17 +01:00
parent 63442d58b9
commit b10a593e01
4 changed files with 47 additions and 1 deletions
+11
View File
@@ -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 );
+1
View File
@@ -72,6 +72,7 @@ private:
QLabel* labelPixelsValue;
QLabel* labelCountValue;
QLabel* labelRangeValue;
QLabel* labelNEBinsValue;
QLabel* labelMeanValue;
QLabel* labelStdDevValue;
QLabel* labelMedianValue;
+34 -1
View File
@@ -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 )
+1
View File
@@ -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();
/**