fixed bug when trimming

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@250 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
x04sa
2014-01-28 12:20:43 +00:00
parent 3731bfd51e
commit 635a33ea85
3 changed files with 46 additions and 42 deletions

View File

@ -30,10 +30,9 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
int main (int argc, char **argv) {
QApplication *theApp = new QApplication(argc, argv);
MyApplication *theApp = new MyApplication(argc, argv);
// QApplication *theApp = new QApplication(argc, argv);
theApp->setStyle(new QPlastiqueStyle);//not default when desktop is windows
theApp->setWindowIcon(QIcon( ":/icons/images/mountain.png" ));
qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0);

View File

@ -630,8 +630,9 @@ void qDrawPlot::SetupMeasurement(){
#ifdef VERBOSE
cout << "SetupMeasurement function:" << running << endl;
#endif
LockLastImageArray();
cout<<"begnPixelsX:"<<nPixelsX<<endl;
cout<<"begnPixelsY:"<<nPixelsY<<endl;
LockLastImageArray();cout<<"after lockimage"<<endl;
#ifdef VERBOSE
cout << "locklastimagearray" << endl;
@ -644,13 +645,14 @@ void qDrawPlot::SetupMeasurement(){
//for 2d scans
currentScanDivLevel = 0;
//if(plot_in_scope==2)
if(!running) lastImageNumber = 0;/**Just now */
if(!running)
lastImageNumber = 0;/**Just now */
cout<<"before 2d"<<endl;
//initializing 2d array
for(int py=0;py<(int)nPixelsY;py++)
for(int px=0;px<(int)nPixelsX;px++)
lastImageArray[py*nPixelsX+px] = 0;
cout<<"end of 2d"<<endl;
//1d with no scan
if ((!originally2D) && (scanArgument==qDefs::None)){
#ifdef VERBOSE
@ -662,7 +664,7 @@ void qDrawPlot::SetupMeasurement(){
minPixelsY = 0;
startPixel = -0.5;
endPixel = nPixelsY-0.5;
}
}else cout<<"correct palce"<<endl;
}
else {
#ifdef VERBOSE
@ -715,7 +717,7 @@ void qDrawPlot::SetupMeasurement(){
cout<<"startPixel:"<<startPixel<<endl;
cout<<"endPixel:"<<endPixel<<endl<<endl;
*/
UnlockLastImageArray();
UnlockLastImageArray();cout<<"out of setupmeasure"<<endl;
#ifdef VERBOSE
@ -760,7 +762,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
cout << "angle " << data->angles << endl;
//#endif
if(!stop_signal){
cout<<"before progress"<<endl;
//set progress
progress=(int)data->progressIndex;
currentFrameIndex = fileIOStatic::getIndicesFromFileName(string(data->fileName),currentFileIndex);
@ -769,10 +771,9 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
cout << "Received empty file name. Exiting function without updating data for plot." << endl;
return -1;
}
#ifdef VERYVERBOSE
//#ifdef VERYVERBOSE
cout << "progress:" << progress << endl;
#endif
//#endif
// secondary title necessary to differentiate between frames when not saving data
char temp_title[2000];
//findex is used because in the receiver, you cannot know the frame index as many frames are in 1 file.
@ -788,7 +789,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
//Plot Disabled
if(!plotEnable) return 0;
cout<<"before entering angleplot"<<endl;
//angle plotting
if(anglePlot){
LockLastImageArray();
@ -1325,8 +1326,9 @@ void qDrawPlot::UpdatePlot(){
firstPlot = false;
}
}
}
// update range if required
if(XYRangeChanged){
if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum();
@ -1709,8 +1711,10 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
//get trimbits
actualPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X);
if(histTrimbits) delete [] histTrimbits; histTrimbits = new double[actualPixelsX];
if(histTrimbits) delete [] histTrimbits;
histTrimbits = new double[actualPixelsX];
ret = myDet->getChanRegs(histTrimbits,fromDetector);
// cout << "got it!" << endl;
if(!ret){
qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","qDrawPlot::UpdateTrimbitPlot");
UnlockLastImageArray();

View File

@ -584,11 +584,12 @@ void qTabAdvanced::StartTrimming(){
break;
default:
cout << "Should never come here. Start Trimming will have only 2 methods. Trimming Method:" << trimmingMode << endl;
break;
return;
}
//execute
int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1);
if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1));
else
qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","qTabAdvanced::StartTrimming");