mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
fixed histogram for trimbits and threshold
This commit is contained in:
parent
705a25c9e0
commit
0d66e62d10
@ -143,7 +143,7 @@ public:
|
|||||||
void SetBinary(bool enable, int from=0, int to=0);
|
void SetBinary(bool enable, int from=0, int to=0);
|
||||||
|
|
||||||
/** Enable/Disable Histogram */
|
/** Enable/Disable Histogram */
|
||||||
void SetHistogram(bool enable,int histArg, int min=0, int max=0, int size=0){histogram = enable;histogramArgument = histArg; histFrom=min;histTo=max;histSize=size;};
|
void SetHistogram(bool enable,int histArg, int min=0, int max=0, double size=0){histogram = enable;histogramArgument = histArg; histFrom=min;histTo=max;histSize=size;};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/** To select 1D or 2D plot
|
/** To select 1D or 2D plot
|
||||||
@ -563,7 +563,7 @@ bool displayStatistics;
|
|||||||
bool histogram;
|
bool histogram;
|
||||||
int histFrom;
|
int histFrom;
|
||||||
int histTo;
|
int histTo;
|
||||||
int histSize;
|
double histSize;
|
||||||
QwtPlotGrid *grid;
|
QwtPlotGrid *grid;
|
||||||
QwtPlotHistogram *plotHistogram;
|
QwtPlotHistogram *plotHistogram;
|
||||||
QVector<QwtIntervalSample> histogramSamples;
|
QVector<QwtIntervalSample> histogramSamples;
|
||||||
|
@ -210,7 +210,7 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
|
grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
|
||||||
*/
|
*/
|
||||||
plotHistogram = new QwtPlotHistogram();
|
plotHistogram = new QwtPlotHistogram();
|
||||||
plotHistogram->setStyle(QwtPlotHistogram::Columns);
|
plotHistogram->setStyle(QwtPlotHistogram::Columns);//Options:Outline,Columns, Lines
|
||||||
|
|
||||||
|
|
||||||
firstPlot = false;
|
firstPlot = false;
|
||||||
@ -542,7 +542,6 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
|||||||
minPixelsY = 0;
|
minPixelsY = 0;
|
||||||
nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X);
|
nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X);
|
||||||
nPixelsY = myDet->getTotalNumberOfChannels(slsDetectorDefs::Y);
|
nPixelsY = myDet->getTotalNumberOfChannels(slsDetectorDefs::Y);
|
||||||
|
|
||||||
//cannot do this in between measurements , so update instantly
|
//cannot do this in between measurements , so update instantly
|
||||||
if(scanArgument==qDefs::Level0){
|
if(scanArgument==qDefs::Level0){
|
||||||
//no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab
|
//no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab
|
||||||
@ -595,25 +594,23 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
|||||||
|
|
||||||
//histogram
|
//histogram
|
||||||
if(histogram){
|
if(histogram){
|
||||||
histogramSamples.resize(0);
|
|
||||||
int iloop = 0;
|
int iloop = 0;
|
||||||
int min = iloop*histSize + histFrom;
|
int numSteps = ((histTo-histFrom)/(histSize)) + 1;
|
||||||
int max = (iloop+1)*histSize + histFrom;
|
histogramSamples.resize(numSteps);
|
||||||
while(min < histTo){
|
startPixel = histFrom -(histSize/2);
|
||||||
histogramSamples.resize(iloop+1);
|
endPixel = histTo + (histSize/2);
|
||||||
histogramSamples[iloop].interval.setInterval(min,max-1);
|
while(startPixel < endPixel){
|
||||||
|
histogramSamples[iloop].interval.setInterval(startPixel,startPixel+histSize,QwtInterval::ExcludeMaximum);
|
||||||
histogramSamples[iloop].value = 0;
|
histogramSamples[iloop].value = 0;
|
||||||
|
startPixel += histSize;
|
||||||
iloop++;
|
iloop++;
|
||||||
min = max;
|
|
||||||
max = (iloop+1)*histSize + histFrom;
|
|
||||||
if(max>histTo)
|
|
||||||
max = histTo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//print values
|
//print values
|
||||||
cout << "Histogram Intervals:" << endl;
|
cout << "Histogram Intervals:" << endl;
|
||||||
for(int j=0;j<histogramSamples.size();j++){
|
for(int j=0;j<histogramSamples.size();j++){
|
||||||
cout<<j<<":\tmin:"<<histogramSamples[j].interval.minValue()<<""
|
cout<<j<<":\tmin:"<<histogramSamples[j].interval.minValue()<<""
|
||||||
"\tmax:"<<histogramSamples[j].interval.maxValue()<<"\t:"<<histogramSamples[j].value<<endl;
|
"\t\tmax:"<<histogramSamples[j].interval.maxValue()<<"\t\tvalue:"<<histogramSamples[j].value<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,6 +697,11 @@ void qDrawPlot::SetupMeasurement(){
|
|||||||
startPixel = minPixelsY -(pixelWidth/2);
|
startPixel = minPixelsY -(pixelWidth/2);
|
||||||
endPixel = maxPixelsY + (pixelWidth/2);
|
endPixel = maxPixelsY + (pixelWidth/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(histogram){
|
||||||
|
startPixel = histFrom -(histSize/2);
|
||||||
|
endPixel = histTo + (histSize/2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -988,7 +990,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
|
|||||||
//frequency of intensity
|
//frequency of intensity
|
||||||
if(histogramArgument == qDefs::Intensity){
|
if(histogramArgument == qDefs::Intensity){
|
||||||
//ignore outside limits
|
//ignore outside limits
|
||||||
if ((data->values[i] <= histFrom) || (data->values[i] >= histTo))
|
if ((data->values[i] < histFrom) || (data->values[i] >= histTo))
|
||||||
continue;
|
continue;
|
||||||
//check for intervals, increment if validates
|
//check for intervals, increment if validates
|
||||||
for(int j=0;j<histogramSamples.size();j++){
|
for(int j=0;j<histogramSamples.size();j++){
|
||||||
@ -1017,7 +1019,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
|
|||||||
else scanval = cs1;
|
else scanval = cs1;
|
||||||
|
|
||||||
//ignore outside limits
|
//ignore outside limits
|
||||||
if ((scanval <= histFrom) || (scanval >= histTo) || (scanval == -1))
|
if ((scanval < histFrom) || (scanval > histTo) || (scanval == -1))
|
||||||
scanval = -1;
|
scanval = -1;
|
||||||
//check for intervals, increment if validates
|
//check for intervals, increment if validates
|
||||||
for(int j=0;j<histogramSamples.size();j++){
|
for(int j=0;j<histogramSamples.size();j++){
|
||||||
@ -1190,6 +1192,19 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
|
|||||||
//this lets the measurement tab know its over, and to enable tabs
|
//this lets the measurement tab know its over, and to enable tabs
|
||||||
emit UpdatingPlotFinished();
|
emit UpdatingPlotFinished();
|
||||||
|
|
||||||
|
//calculate s curve inflection point
|
||||||
|
int l1=0,l2=0,j;
|
||||||
|
if((histogram)&&(histogramArgument != qDefs::Intensity)){
|
||||||
|
for(j=0;j<histogramSamples.size()-2;j++){
|
||||||
|
l1 = histogramSamples[j+1].value - histogramSamples[j].value;
|
||||||
|
l2 = histogramSamples[j+2].value - histogramSamples[j+1].value;
|
||||||
|
if(l1 > l2){
|
||||||
|
cout << "***** s curve inflectionfound at " << histogramSamples[j].interval.maxValue() << ""
|
||||||
|
"or j at " << j << " with l1 " << l1 << " and l2 " << l2 << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1321,9 +1336,9 @@ void qDrawPlot::UpdatePlot(){
|
|||||||
histFrameIndexTitle->setText(GetHistTitle(0));
|
histFrameIndexTitle->setText(GetHistTitle(0));
|
||||||
plotHistogram->attach(plot1D);
|
plotHistogram->attach(plot1D);
|
||||||
//refixing all the zooming
|
//refixing all the zooming
|
||||||
plot1D->SetXMinMax(histFrom,histTo);
|
plot1D->SetXMinMax(startPixel,endPixel);
|
||||||
plot1D->SetYMinMax(0,plotHistogram->boundingRect().height());
|
plot1D->SetYMinMax(0,plotHistogram->boundingRect().height());
|
||||||
plot1D->SetZoomBase(0,0,nPixelsX,plotHistogram->boundingRect().height());
|
plot1D->SetZoomBase(startPixel,0,endPixel-startPixel,plotHistogram->boundingRect().height());
|
||||||
}
|
}
|
||||||
//not histogram
|
//not histogram
|
||||||
else{
|
else{
|
||||||
|
@ -572,11 +572,13 @@ void qTabPlot::SetPlot(){
|
|||||||
|
|
||||||
cout << " - Histogram" << endl;
|
cout << " - Histogram" << endl;
|
||||||
|
|
||||||
if(radioHistIntensity->isChecked())
|
if(radioHistIntensity->isChecked()){
|
||||||
pageHistogram->setEnabled(true);
|
pageHistogram->setEnabled(true);
|
||||||
else
|
pageHistogram_2->setEnabled(true);
|
||||||
|
}else{
|
||||||
pageHistogram->setEnabled(false);
|
pageHistogram->setEnabled(false);
|
||||||
|
pageHistogram_2->setEnabled(false);
|
||||||
|
}
|
||||||
boxScan->hide();
|
boxScan->hide();
|
||||||
boxHistogram->show();
|
boxHistogram->show();
|
||||||
myPlot->EnablePlot(true);
|
myPlot->EnablePlot(true);
|
||||||
@ -587,8 +589,9 @@ void qTabPlot::SetPlot(){
|
|||||||
boxPlotAxis->setEnabled(true);
|
boxPlotAxis->setEnabled(true);
|
||||||
if(!myPlot->isRunning())
|
if(!myPlot->isRunning())
|
||||||
EnableScanBox();
|
EnableScanBox();
|
||||||
qDefs::Message(qDefs::INFORMATION,"<nobr>Please check the <b>Plot Histogram Options</b> below "
|
|
||||||
"before <b>Starting Acquitision</b></nobr>","qTabPlot::SetPlot");
|
//qDefs::Message(qDefs::INFORMATION,"<nobr>Please check the <b>Plot Histogram Options</b> below "
|
||||||
|
// "before <b>Starting Acquitision</b></nobr>","qTabPlot::SetPlot");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,10 +868,13 @@ void qTabPlot::EnableScanBox(){
|
|||||||
|
|
||||||
//histogram
|
//histogram
|
||||||
if(radioHistogram->isChecked()){
|
if(radioHistogram->isChecked()){
|
||||||
if(radioHistIntensity->isChecked())
|
if(radioHistIntensity->isChecked()){
|
||||||
pageHistogram->setEnabled(true);
|
pageHistogram->setEnabled(true);
|
||||||
else
|
pageHistogram_2->setEnabled(true);
|
||||||
|
}else{
|
||||||
pageHistogram->setEnabled(false);
|
pageHistogram->setEnabled(false);
|
||||||
|
pageHistogram_2->setEnabled(false);
|
||||||
|
}
|
||||||
stackedWidget->setCurrentIndex(stackedWidget->count()-1);
|
stackedWidget->setCurrentIndex(stackedWidget->count()-1);
|
||||||
stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1);
|
stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1);
|
||||||
box1D->setTitle(QString("1D Plot Options %1 - Histogram").arg(stackedWidget->currentIndex()+1));
|
box1D->setTitle(QString("1D Plot Options %1 - Histogram").arg(stackedWidget->currentIndex()+1));
|
||||||
@ -900,7 +906,7 @@ void qTabPlot::EnableScanBox(){
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
pageHistogram->setEnabled(false);
|
pageHistogram->setEnabled(false);
|
||||||
/*pageHistogram_2->setEnabled(false);*/
|
pageHistogram_2->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
||||||
@ -939,7 +945,7 @@ void qTabPlot::SetScanArgument(){
|
|||||||
//histogram default - set before setscanargument
|
//histogram default - set before setscanargument
|
||||||
int min = spinHistFrom->value();
|
int min = spinHistFrom->value();
|
||||||
int max = spinHistTo->value();
|
int max = spinHistTo->value();
|
||||||
int size = spinHistSize->value();
|
double size = spinHistSize->value();
|
||||||
int histArg = qDefs::Intensity;
|
int histArg = qDefs::Intensity;
|
||||||
if(radioHistogram->isChecked()){
|
if(radioHistogram->isChecked()){
|
||||||
if(!radioHistIntensity->isChecked()){
|
if(!radioHistIntensity->isChecked()){
|
||||||
@ -1089,8 +1095,10 @@ void qTabPlot::SetBinary(){
|
|||||||
void qTabPlot::SetHistogramOptions(){
|
void qTabPlot::SetHistogramOptions(){
|
||||||
if(radioHistIntensity->isChecked()){
|
if(radioHistIntensity->isChecked()){
|
||||||
pageHistogram->setEnabled(true);
|
pageHistogram->setEnabled(true);
|
||||||
|
pageHistogram_2->setEnabled(true);
|
||||||
}else {
|
}else {
|
||||||
pageHistogram->setEnabled(false);
|
pageHistogram->setEnabled(false);
|
||||||
|
pageHistogram_2->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1115,6 +1123,7 @@ void qTabPlot::Refresh(){
|
|||||||
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||||
boxScan->setEnabled(false);
|
boxScan->setEnabled(false);
|
||||||
pageHistogram->setEnabled(false);
|
pageHistogram->setEnabled(false);
|
||||||
|
pageHistogram_2->setEnabled(false);
|
||||||
if(radioHistogram->isChecked())
|
if(radioHistogram->isChecked())
|
||||||
radioDataGraph->setEnabled(false);
|
radioDataGraph->setEnabled(false);
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user