Changeset 12390 for trunk/FACT++
- Timestamp:
- 11/04/11 23:59:08 (13 years ago)
- Location:
- trunk/FACT++/gui/RawEventsViewer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
r12373 r12390 358 358 if (!nRoi) 359 359 return; 360 361 360 float xZoom, yZoom; 362 361 xZoom = yZoom = 1.0f; … … 387 386 388 387 const int hw = hardwareMapping[selectedPixel]; 389 388 const PixelMapEntry& mapEntry = fPixelMap.index(selectedPixel); 389 const int pixelIdInPatch = mapEntry.pixel(); 390 const int patchId = mapEntry.patch(); 391 392 if (selectedPixel != -1) 393 { 390 394 for (int i=0;i<nRoi-1;i++) 391 395 { 392 #ifdef LOAD_RAW393 glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,394 bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i]+plusMe) /divideMe);395 glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,396 bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i+1]+plusMe) /divideMe);397 #else398 399 400 396 float d1 = eventData[nRoi*hw + i]+plusMe; 401 397 float d2 = eventData[nRoi*hw + i+1]+plusMe; 402 398 if (!finite(d1)) d1 = 20000; 403 399 if (!finite(d2)) d2 = 20000; 404 glVertex2f(bboxMin[0] + xRange*i/(float) nRoi,400 glVertex2f(bboxMin[0] + xRange*i/(float)(nRoi+nRoiTM), 405 401 bboxMin[1] + yRange*(d1) /divideMe); 406 glVertex2f(bboxMin[0] + xRange*(i+1)/(float) nRoi,402 glVertex2f(bboxMin[0] + xRange*(i+1)/(float)(nRoi+nRoiTM), 407 403 bboxMin[1] + yRange*(d2) /divideMe); 408 #endif 404 } 405 406 if (pixelIdInPatch == 8)//this channel has a time marker 407 { 408 for (int i=0;i<nRoiTM-1;i++) 409 { 410 float d1 = eventData[nRoi*1440 + nRoiTM*patchId + i] + plusMe; 411 float d2 = eventData[nRoi*1440 + nRoiTM*patchId + i+1] + plusMe; 412 if (!finite(d1)) d1 = 20000; 413 if (!finite(d2)) d2 = 20000; 414 glVertex2f(bboxMin[0] + xRange*(i+nRoi)/(float)(nRoi+nRoiTM), 415 bboxMin[1] + yRange*(d1)/divideMe); 416 glVertex2f(bboxMin[0] + xRange*(i+1+nRoi)/(float)(nRoi+nRoiTM), 417 bboxMin[1] + yRange*(d2) / divideMe); 418 } 419 } 409 420 } 410 421 glEnd(); … … 473 484 inputFile = NULL; 474 485 eventData = NULL; 475 drawPatch = true;486 drawPatch = false; 476 487 drawImpulse = true; 477 488 drawBlur = false; … … 528 539 void RawDataViewer::paintGL() 529 540 { 541 glFinish(); 542 makeCurrent(); 530 543 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 531 544 glLoadIdentity(); … … 547 560 drawPatches(); 548 561 glTranslatef(0,0,0.1f); 549 if (!drawBlur )562 if (!drawBlur && (selectedPixel != -1)) 550 563 { 551 564 glLineWidth(1.0f); … … 576 589 } 577 590 lastPos = cEvent->pos(); 578 setCorrectSlice(cEvent); 591 if (setCorrectSlice(cEvent)) 592 return; 579 593 int face = PixelAtPosition(cEvent->pos()); 580 if (face != -1) {594 // if (face != -1) { 581 595 selectedPixel = face; 582 596 emit signalCurrentPixel(face); 583 }597 // } 584 598 updateGL(); 585 599 } … … 589 603 * clicked, and if so, which slice should be displayed 590 604 ************************************************************/ 591 voidRawDataViewer::setCorrectSlice(QMouseEvent* cEvent)605 bool RawDataViewer::setCorrectSlice(QMouseEvent* cEvent) 592 606 { 593 607 if (!drawImpulse) 594 return ;608 return false; 595 609 float cx = (float)cEvent->x() * pixelSize - shownSizex/2; 596 610 float cy = ((float)height()-(float)cEvent->y())*pixelSize - shownSizey/2; … … 599 613 cy < bboxMin[1] || 600 614 cy > bboxMax[1]) 601 return; 602 whichSlice = (cx - bboxMin[0])*nRoi/(bboxMax[0] - bboxMin[0]); 615 return false; 616 whichSlice = (cx - bboxMin[0])*(nRoi+nRoiTM)/(bboxMax[0] - bboxMin[0]); 617 if (whichSlice >= nRoi) 618 whichSlice = nRoi-1; 603 619 emit signalCurrentSlice(whichSlice); 620 return true; 604 621 } 605 622 … … 721 738 delete[] waveLetArray; 722 739 } 723 eventData = new float[ (1440+160)*nRoi];724 725 rawEventData = new int16_t[ (1440+160)*nRoi];740 eventData = new float[1440*nRoi + 160*nRoiTM];//(1440+160)*nRoi]; 741 742 rawEventData = new int16_t[1440*nRoi + 160*nRoiTM];//(1440+160)*nRoi]; 726 743 waveLetArray = new int16_t[1024*1440]; 727 744 try … … 1107 1124 void RawDataViewer::ApplyCalibration() 1108 1125 { 1109 for (int i=0;i< (1440+160)*nRoi;i++)1126 for (int i=0;i<1440*nRoi + 160*nRoiTM;i++)//(1440+160)*nRoi;i++) 1110 1127 eventData[i] = (float)rawEventData[i]; 1111 1128 … … 1114 1131 fDrsCalib.Apply(eventData, rawEventData, startPix, nRoi); 1115 1132 DrsCalibrate::RemoveSpikes(eventData, nRoi); 1133 //TODO apply calibration to the Time markers 1116 1134 } 1117 1135 … … 1190 1208 void RawDataViewer::setCurrentPixel(int pix) 1191 1209 { 1192 if (pix == -1)1193 return;1210 // if (pix == -1) 1211 // return; 1194 1212 selectedPixel = pix; 1195 1213 if (isVisible()) … … 1215 1233 /// { 1216 1234 int j = selectedPixel; 1235 if (j == -1) 1236 return; 1217 1237 for (int i=0;i<nRoi;i++) 1218 1238 { … … 1532 1552 if (!GLWindow->nRoi) 1533 1553 return; 1534 1554 if (GLWindow->selectedPixel == -1) 1555 { 1556 ostringstream str; 1557 str << " Current Pixel val.: --"; 1558 currentPixelValue->setText(QString(str.str().c_str())); 1559 return; 1560 } 1535 1561 const int idx = 1536 1562 GLWindow->nRoi*GLWindow->hardwareMapping[GLWindow->selectedPixel] … … 1575 1601 1576 1602 // GLWindow->updateGL(); 1603 } 1604 void UIConnector::on_slicesPerSecValue_valueChanged(double value) 1605 { 1606 timer.setInterval(1000.0/value); 1577 1607 } 1578 1608 void UIConnector::on_displayingSliceBox_valueChanged(int cSlice) … … 2083 2113 { 2084 2114 GLWindow_2->fWhite = pixel; 2085 GLWindow_2->fWhitePatch = GLWindow_2->pixelsPatch[pixel]; 2086 2115 if (pixel != -1) 2116 GLWindow_2->fWhitePatch = GLWindow_2->pixelsPatch[pixel]; 2117 else 2118 GLWindow_2->fWhitePatch = -1; 2119 if (pixel == -1) 2120 return; 2087 2121 2088 2122 pixel = GLWindow->hardwareMapping[pixel]; … … 2195 2229 start = GLWindow->selectedPixel; 2196 2230 end = GLWindow->selectedPixel+1; 2231 if (end == 0) 2232 { 2233 start = 0; 2234 end = 1440; 2235 } 2197 2236 } 2198 2237 -
trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h
r12343 r12390 113 113 // void skipPixels(int start, int howMany); 114 114 // void calculatePixelsCoords(); 115 voidsetCorrectSlice(QMouseEvent* event);115 bool setCorrectSlice(QMouseEvent* event); 116 116 void eventStepping(bool plus); 117 117 // void buildVerticesList(); … … 261 261 void on_blueValue4_valueChanged(double); 262 262 263 void on_slicesPerSecValue_valueChanged(double); 264 263 265 void pixelChanged(int); 264 266 -
trunk/FACT++/gui/RawEventsViewer/viewer.ui
r12297 r12390 7 7 <x>0</x> 8 8 <y>0</y> 9 <width> 1133</width>10 <height> 1017</height>9 <width>984</width> 10 <height>894</height> 11 11 </rect> 12 12 </property> … … 245 245 <item> 246 246 <widget class="QLabel" name="extraInfoLabel"> 247 <property name="sizePolicy"> 248 <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> 249 <horstretch>0</horstretch> 250 <verstretch>0</verstretch> 251 </sizepolicy> 252 </property> 253 <property name="font"> 254 <font> 255 <pointsize>8</pointsize> 256 </font> 257 </property> 247 258 <property name="text"> 248 259 <string>File loaded: none … … 269 280 NB Evts Bad: 270 281 </string> 282 </property> 283 <property name="scaledContents"> 284 <bool>false</bool> 271 285 </property> 272 286 <property name="wordWrap"> … … 893 907 </property> 894 908 <property name="checked"> 895 <bool> true</bool>909 <bool>false</bool> 896 910 </property> 897 911 <property name="tristate">
Note:
See TracChangeset
for help on using the changeset viewer.