mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
fixed the problem with multiple frame scan, frame index and file index included in gui
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@111 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
6e529f1c06
commit
7a6bba3c77
@ -75,13 +75,13 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Current Index: </string>
|
||||
<string>Current Frame: </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lblProgressIndex">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<x>101</x>
|
||||
<y>25</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
@ -912,7 +912,7 @@ Frame period between exposures.
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Start Run Index:</string>
|
||||
<string>Run Index:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
int GetProgress(){return progress;};
|
||||
/** gets the file index to the measurement tab*/
|
||||
int GetFileIndex(){return currentFileIndex;};
|
||||
/** gets the frame index to the measurement tab*/
|
||||
int GetFrameIndex(){return currentFrameIndex;};
|
||||
/** sets file write enable , if not enabled,
|
||||
* file index wont increase and so you need secondary titles to differentitate between plots*/
|
||||
void SetEnableFileWrite(bool enable){fileSaveEnable = enable;};
|
||||
@ -180,9 +182,8 @@ int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;}
|
||||
bool StartOrStopThread(bool start);
|
||||
|
||||
/** Sets up measurement each time
|
||||
* @param currentIndex file index given by detector class
|
||||
* */
|
||||
void SetupMeasurement(int currentIndex);
|
||||
void SetupMeasurement();
|
||||
|
||||
/** Resets the acquisition parameter like lastimagenumber */
|
||||
int ResetDaqForGui();
|
||||
@ -321,10 +322,10 @@ int number_of_frames;
|
||||
double acquisitionPeriod;
|
||||
/** Acquisition Time */
|
||||
double exposureTime;
|
||||
/** Current index*/
|
||||
/** Current file index*/
|
||||
int currentFileIndex;
|
||||
|
||||
|
||||
/** Current frame index*/
|
||||
int currentFrameIndex;
|
||||
|
||||
/**variables for threads */
|
||||
/** */
|
||||
|
@ -260,9 +260,13 @@ void SlsQt2DPlot::Update(){
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
cout << "layout" << endl;
|
||||
#endif
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "going to replot" << endl;
|
||||
#endif
|
||||
replot();
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "done" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,6 +223,7 @@ void qCloneWidget::SavePlot(){
|
||||
if(cloneBox->title().contains('.')){
|
||||
fName.append(QString('/')+cloneBox->title());
|
||||
fName.replace(".dat",".png");
|
||||
fName.replace(".raw",".png");
|
||||
}else fName.append(QString("/Snapshot_unknown_title.png"));
|
||||
//save
|
||||
QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32);
|
||||
@ -250,7 +251,9 @@ int qCloneWidget::SavePlotAutomatic(){
|
||||
if(cloneBox->title().contains('.')){
|
||||
fName.append(QString('/')+cloneBox->title());
|
||||
fName.replace(".dat",".png");
|
||||
fName.replace(".raw",".png");
|
||||
}else fName.append(QString("/Snapshot_unknown_title.png"));
|
||||
cout<<"fname:"<<fName.toAscii().constData()<<endl;
|
||||
//save
|
||||
QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32);
|
||||
QPainter painter(&img);
|
||||
|
@ -107,6 +107,7 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
backwardScanPlot = false;
|
||||
|
||||
currentFileIndex = 0;
|
||||
currentFrameIndex = 0;
|
||||
// This is so that it initially stop and plots
|
||||
running = 1;
|
||||
for(int i=0;i<MAX_1DPLOTS;i++)
|
||||
@ -142,7 +143,8 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
//sprintf(temp_title,"Frame -%d",i);
|
||||
//histTitle[i] = temp_title;
|
||||
}
|
||||
imageTitle.assign("Start Image");
|
||||
imageTitle="";
|
||||
/*imageTitle.assign("Start Image");*/
|
||||
imageXAxisTitle="Pixel";
|
||||
imageYAxisTitle="Pixel";
|
||||
imageZAxisTitle="Intensity";
|
||||
@ -282,6 +284,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
|
||||
fileName = QString(myDet->getFileName().c_str());
|
||||
//update index
|
||||
currentFileIndex = myDet->getFileIndex();
|
||||
currentFrameIndex = 0;
|
||||
|
||||
|
||||
|
||||
@ -344,7 +347,7 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
||||
if(start){
|
||||
progress = 0;
|
||||
//sets up the measurement parameters
|
||||
SetupMeasurement(myDet->getFileIndex());
|
||||
SetupMeasurement();
|
||||
|
||||
cout << "Starting new acquisition threadddd ...." << endl;
|
||||
// Start acquiring data from server
|
||||
@ -435,7 +438,7 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDrawPlot::SetupMeasurement(int currentIndex){
|
||||
void qDrawPlot::SetupMeasurement(){
|
||||
#ifdef VERBOSE
|
||||
cout << "SetupMeasurement function:" << running << endl;
|
||||
#endif
|
||||
@ -468,13 +471,13 @@ void qDrawPlot::SetupMeasurement(int currentIndex){
|
||||
}
|
||||
else {//all frames
|
||||
if(scanArgument==AllFrames){
|
||||
maxPixelsY = currentIndex + number_of_exposures - 1;
|
||||
minPixelsY = currentIndex;
|
||||
maxPixelsY = number_of_exposures - 1;
|
||||
minPixelsY = 0;
|
||||
if(!running) nPixelsY = number_of_exposures;
|
||||
}//file index
|
||||
else if(scanArgument==FileIndex){
|
||||
maxPixelsY = currentIndex + number_of_frames - 1;
|
||||
minPixelsY = currentIndex;
|
||||
maxPixelsY = number_of_frames - 1;
|
||||
minPixelsY = 0;
|
||||
if(!running) nPixelsY = number_of_frames;
|
||||
}//level0 or level1
|
||||
else {
|
||||
@ -538,7 +541,8 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
|
||||
//set progress
|
||||
progress=(int)data->progressIndex;
|
||||
currentFileIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName));
|
||||
currentFrameIndex = fileIOStatic::getIndicesFromFileName(string(data->fileName),currentFileIndex);
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "progress:" << progress << endl;
|
||||
#endif
|
||||
@ -547,10 +551,10 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
if(!plotEnable) return 0;
|
||||
|
||||
// secondary title necessary to differentiate between frames when not saving data
|
||||
char temp_title[2000];
|
||||
/*char temp_title[2000];
|
||||
if(fileSaveEnable) strcpy(temp_title,"");
|
||||
else sprintf(temp_title,"#%d",currentFrame);
|
||||
|
||||
*/
|
||||
|
||||
//angle plotting
|
||||
if(anglePlot){
|
||||
@ -559,7 +563,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//set title
|
||||
plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1);
|
||||
// Title
|
||||
histTitle[0] = temp_title;
|
||||
/*histTitle[0] = temp_title;*/
|
||||
|
||||
if(data->angles==NULL){
|
||||
cout<<"\n\nWARNING:RETURNED NULL instead of angles."<<endl;
|
||||
@ -633,7 +637,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//variables
|
||||
lastImageNumber= currentFrame+1;
|
||||
//title
|
||||
imageTitle = temp_title;
|
||||
/*imageTitle = temp_title;*/
|
||||
//copy data
|
||||
memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
|
||||
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||
@ -651,10 +655,10 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//set title
|
||||
plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1);
|
||||
//variables
|
||||
if(currentFileIndex == minPixelsY) currentScanDivLevel = 0;
|
||||
if(currentFrameIndex == 0) currentScanDivLevel = 0;
|
||||
lastImageNumber= currentFrame+1;
|
||||
//title
|
||||
imageTitle = temp_title;
|
||||
/*imageTitle = temp_title;*/
|
||||
//copy data
|
||||
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
||||
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||
@ -672,8 +676,8 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//set title
|
||||
plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1);
|
||||
//get scanvariable0
|
||||
int ci = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
||||
fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1);
|
||||
int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0;
|
||||
fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di);
|
||||
//variables
|
||||
if(cs0!=currentScanValue) {
|
||||
if(backwardScanPlot) currentScanDivLevel--;
|
||||
@ -682,7 +686,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
currentScanValue = cs0;
|
||||
lastImageNumber= currentFrame+1;
|
||||
//title
|
||||
imageTitle = temp_title;
|
||||
/*imageTitle = temp_title;*/
|
||||
//copy data
|
||||
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
||||
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||
@ -698,8 +702,8 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//set title
|
||||
plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1);
|
||||
//get scanvariable1
|
||||
int ci = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
||||
fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1);
|
||||
int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0;
|
||||
fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di);
|
||||
//variables
|
||||
if(cs1!=currentScanValue){
|
||||
if(backwardScanPlot) currentScanDivLevel--;
|
||||
@ -708,7 +712,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
currentScanValue = cs1;
|
||||
lastImageNumber= currentFrame+1;
|
||||
//title
|
||||
imageTitle = temp_title;
|
||||
/*imageTitle = temp_title;*/
|
||||
//copy data
|
||||
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
||||
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||
@ -730,7 +734,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//1d
|
||||
if(plot_in_scope==1){
|
||||
// Titles
|
||||
histTitle[0] = temp_title;
|
||||
/*histTitle[0] = temp_title;*/
|
||||
// Persistency
|
||||
if(currentPersistency < persistency)currentPersistency++;
|
||||
else currentPersistency=persistency;
|
||||
@ -744,7 +748,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//2d
|
||||
else{cout<<endl<<"****************************IN HERE-2D*******************************************"<<endl<<endl;
|
||||
// Titles
|
||||
imageTitle = temp_title;
|
||||
/*imageTitle = temp_title;*/
|
||||
// manufacture data for now
|
||||
for(unsigned int px=0;px<nPixelsX;px++)
|
||||
for(unsigned int py=0;py<nPixelsY;py++)
|
||||
@ -755,7 +759,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||
}
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"currentframe:"<<currentFrame<<"\tcurrentfileIndex:"<<currentFileIndex<<endl;
|
||||
cout<<"currentframe:"<<currentFrame<<"\tcurrentframeindex:"<<currentFrameIndex<<endl;
|
||||
#endif
|
||||
currentFrame++;
|
||||
}
|
||||
@ -852,12 +856,13 @@ int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){
|
||||
//if(plot_in_scope==2)
|
||||
usleep(500000);
|
||||
|
||||
currentMeasurement = currentMeasurementIndex + 1;
|
||||
currentMeasurement = currentMeasurementIndex+1;
|
||||
currentFileIndex = fileIndex;
|
||||
#ifdef VERBOSE
|
||||
cout << "currentMeasurement:" << currentMeasurement << endl;
|
||||
#endif
|
||||
emit SetCurrentMeasurementSignal(currentMeasurement);
|
||||
SetupMeasurement(fileIndex);
|
||||
SetupMeasurement();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1154,6 +1159,7 @@ void qDrawPlot::SavePlot(){
|
||||
if(boxPlot->title().contains('.')){
|
||||
fName.append(QString('/')+boxPlot->title());
|
||||
fName.replace(".dat",".png");
|
||||
fName.replace(".raw",".png");
|
||||
}else fName.append(QString("/Image.png"));
|
||||
|
||||
fName = QFileDialog::getSaveFileName(0,tr("Save Image"),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly);
|
||||
@ -1188,6 +1194,7 @@ void qDrawPlot::SavePlotAutomatic(){
|
||||
if(boxPlot->title().contains('.')){
|
||||
fName.append(QString('/')+boxPlot->title());
|
||||
fName.replace(".dat",".png");
|
||||
fName.replace(".raw",".png");
|
||||
}else fName.append(QString("/Image_unknown_title.png"));
|
||||
//save
|
||||
QImage img(size().width(),size().height(),QImage::Format_RGB32);
|
||||
|
@ -72,7 +72,7 @@ void qTabMeasurement::SetupWidgetWindow(){
|
||||
//File Index
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
//only initially
|
||||
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
||||
lblProgressIndex->setText(QString::number(0));
|
||||
//ly initially
|
||||
progressBar->setValue(0);
|
||||
|
||||
@ -279,7 +279,6 @@ void qTabMeasurement::setFileName(const QString& fName){
|
||||
|
||||
void qTabMeasurement::setRunIndex(int index){
|
||||
myDet->setFileIndex(index);
|
||||
lblProgressIndex->setText(QString::number(index));
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting File Index to " << myDet->getFileIndex() << endl;
|
||||
#endif
|
||||
@ -296,6 +295,7 @@ void qTabMeasurement::startStopAcquisition(){
|
||||
//btnStartStop->setStyleSheet("color:red");
|
||||
btnStartStop->setText("Stop");
|
||||
btnStartStop->setIcon(*iconStop);
|
||||
lblProgressIndex->setText(QString::number(0));
|
||||
Enable(0);
|
||||
progressBar->setValue(0);
|
||||
progressTimer->start(100);
|
||||
@ -307,12 +307,13 @@ void qTabMeasurement::startStopAcquisition(){
|
||||
#endif
|
||||
emit StopSignal();
|
||||
myDet->stopAcquisition();
|
||||
progressTimer->stop();
|
||||
|
||||
UpdateProgress();
|
||||
//spin index
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
lblProgressIndex->setText(QString::number(spinIndex->value()));
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
progressTimer->stop();
|
||||
|
||||
btnStartStop->setText("Start");
|
||||
btnStartStop->setIcon(*iconStart);
|
||||
@ -327,6 +328,13 @@ void qTabMeasurement::startStopAcquisition(){
|
||||
|
||||
void qTabMeasurement::UpdateFinished(){
|
||||
if(btnStartStop->isChecked()){
|
||||
|
||||
UpdateProgress();
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
progressTimer->stop();
|
||||
|
||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
btnStartStop->setText("Start");
|
||||
btnStartStop->setIcon(*iconStart);
|
||||
@ -334,14 +342,7 @@ void qTabMeasurement::UpdateFinished(){
|
||||
Enable(1);
|
||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
|
||||
UpdateProgress();
|
||||
//spin index
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
lblProgressIndex->setText(QString::number(spinIndex->value()));
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
|
||||
progressTimer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,7 +352,7 @@ void qTabMeasurement::UpdateFinished(){
|
||||
|
||||
void qTabMeasurement::SetCurrentMeasurement(int val){
|
||||
if((val)<spinNumMeasurements->value())
|
||||
lblCurrentMeasurement->setText(QString::number(val+1));
|
||||
lblCurrentMeasurement->setText(QString::number(val));
|
||||
|
||||
}
|
||||
|
||||
@ -361,7 +362,7 @@ void qTabMeasurement::SetCurrentMeasurement(int val){
|
||||
|
||||
void qTabMeasurement::UpdateProgress(){
|
||||
progressBar->setValue((int)myPlot->GetProgress());
|
||||
lblProgressIndex->setText(QString::number(myPlot->GetFileIndex()));
|
||||
lblProgressIndex->setText(QString::number(myPlot->GetFrameIndex()));
|
||||
}
|
||||
|
||||
|
||||
@ -749,10 +750,13 @@ void qTabMeasurement::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting file index" << endl;
|
||||
#endif
|
||||
spinIndex->setValue(myDet->getFileIndex());cout<<"file index:"<<myDet->getFileIndex()<<endl;
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
|
||||
//progress label index
|
||||
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
||||
if(myDet->getFrameIndex()==-1)
|
||||
lblProgressIndex->setText("0");
|
||||
else
|
||||
lblProgressIndex->setText(QString::number(myDet->getFrameIndex()));
|
||||
|
||||
//Timing mode
|
||||
SetupTimingMode();
|
||||
|
Loading…
x
Reference in New Issue
Block a user