Changeset 11933 for trunk


Ignore:
Timestamp:
09/01/11 16:16:52 (13 years ago)
Author:
lyard
Message:
various bug fix + events anim impl
Location:
trunk/FACT++/gui/RawEventsViewer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc

    r11922 r11933  
    960960    int16_t* origTheWayIWant = new int16_t[1024*1440];
    961961
    962     for (int i=0;i<300;i++)//nRows;i++)
     962    for (int i=0;i<nRows;i++)
    963963    {
    964964        cout << '\r' <<  "Doing row " << i << " of " << nRows;
     
    989989        while (j%1440 != 0)// < totalNumSamples)
    990990        {
     991            cout << "Copying the remaining of the data" << endl;
    991992            int lastRun = 1;
    992993            while (lastRun < 1440 - j%1440)//totalNumSamples-j)
     
    10231024    if (!*calibInputFile)
    10241025    {
     1026        delete calibInputFile;
     1027        calibInputFile = NULL;
     1028        return;
     1029    }
     1030
     1031    if (calibInputFile->HasKey("NROI"))
     1032    {
     1033        cout << "Looks like you're trying to load a regular raw data file as DRS calib. aborting." << endl;
    10251034        delete calibInputFile;
    10261035        calibInputFile = NULL;
     
    13391348void UIConnector::nextSlicePlease()
    13401349{
    1341     viewer->nextSlice();
     1350    if (playEventsRadio->isChecked ())
     1351        viewer->eventStepping(true);
     1352    else
     1353        viewer->nextSlice();
    13421354}
    13431355/************************************************************
     
    16211633void UIConnector::currentSliceHasChanged(int slice)
    16221634{
     1635    if (!viewer->nRoi)
     1636        return;
    16231637    ostringstream str;
    16241638//    str << "Displaying Slice " << slice;
     
    23212335    }
    23222336
    2323     int min = 10000; //real min = -2048
    2324     int max = -10000; //real max = 2047
     2337    int min = 100000; //real min = -2048, int_16 = -32768 to 32767
     2338    int max = -100000; //real max = 2047
    23252339    long average = 0;
    2326     int numSamples = 0;
     2340    long numSamples = 0;
     2341    int errorDetected = -1;
    23272342    for (int i=start;i<end;i++)
    23282343    {
     
    23302345        {
    23312346            int cValue = viewer->eventData[i*viewer->nRoi+j];
    2332             if (cValue > max)
     2347            if (cValue > max && cValue < 32767)
    23332348                max = cValue;
    2334             if (cValue < min)
     2349            if (cValue < min && cValue > -32768)
    23352350               min = cValue;
    2336             average+=cValue;
    2337             numSamples++;
     2351            if (cValue < 32767 && cValue > -32768)
     2352            {
     2353                average+=cValue;
     2354                numSamples++;
     2355            }
     2356            else
     2357            {
     2358                errorDetected = i;
     2359            }
     2360//            numSamples++;
    23382361        }
    23392362    }
    23402363    average /= numSamples;
    2341 
     2364    if (errorDetected != -1)
     2365    {
     2366        cout << "Overflow detected at pixel " << errorDetected << " (at least)" << endl;
     2367    }
     2368//    cout << "min: " << min << " max: " << max << " average: " << average << endl;
    23422369    double minRange = (double)(min+(VALUES_SPAN/2))/(double)VALUES_SPAN;
    23432370    double maxRange = (double)(max+(VALUES_SPAN/2))/(double)VALUES_SPAN;
     
    25012528
    25022529
    2503     QObject::connect(myUi.eventsMinusButton, SIGNAL(clicked()),
    2504                      canvas, SLOT(minusEvent()));
    2505     QObject::connect(myUi.eventsPlusButton, SIGNAL(clicked()),
    2506                      canvas, SLOT(plusEvent()));
    2507     QObject::connect(myUi.eventsStepBox, SIGNAL(valueChanged(int)),
    2508                      canvas, SLOT(setEventStep(int)));
     2530//    QObject::connect(myUi.eventsMinusButton, SIGNAL(clicked()),
     2531//                     canvas, SLOT(minusEvent()));
     2532//    QObject::connect(myUi.eventsPlusButton, SIGNAL(clicked()),
     2533//                     canvas, SLOT(plusEvent()));
     2534//    QObject::connect(myUi.eventsStepBox, SIGNAL(valueChanged(int)),
     2535//                     canvas, SLOT(setEventStep(int)));
     2536
    25092537    myUi.colorRange0->setValue(canvas->ss[0]);
    25102538    myUi.colorRange1->setValue(canvas->ss[1]);
     
    25512579    connector.currentPixelScale = myUi.currentPixelScale;
    25522580    connector.entireCameraScale = myUi.entireCameraScale;
     2581    connector.playEventsRadio = myUi.playEventsRadio;
    25532582
    25542583    connector.extraInfoLabel = myUi.extraInfoLabel;
     
    25722601    connector.initHistograms();
    25732602
    2574     QObject::connect(myUi.slicesPlusPlusButton, SIGNAL(clicked()),
    2575                     &connector, SLOT(slicesPlusPlus()));
    2576     QObject::connect(myUi.slicesMinusMinusButton, SIGNAL(clicked()),
    2577                      &connector, SLOT(slicesMinusMinus()));
     2603    QButtonGroup scaleGroup(canvas);// = new QButtonGroup(canvas);
     2604    QButtonGroup animateGroup(canvas);// = new QButtonGroup(canvas);
     2605    scaleGroup.addButton(myUi.currentPixelScale);
     2606    scaleGroup.addButton(myUi.entireCameraScale);
     2607    animateGroup.addButton(myUi.playEventsRadio);
     2608    animateGroup.addButton(myUi.playSlicesRadio);
     2609    myUi.entireCameraScale->setChecked(true);
     2610//    QObject::connect(myUi.slicesPlusPlusButton, SIGNAL(clicked()),
     2611//                    &connector, SLOT(slicesPlusPlus()));
     2612//    QObject::connect(myUi.slicesMinusMinusButton, SIGNAL(clicked()),
     2613//                     &connector, SLOT(slicesMinusMinus()));
     2614
    25782615    QObject::connect(myUi.autoScaleColor, SIGNAL(clicked()),
    25792616                     &connector, SLOT(autoScalePressed()));
  • trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h

    r11920 r11933  
    308308    QRadioButton* currentPixelScale;
    309309    QRadioButton* entireCameraScale;
     310    QRadioButton* playEventsRadio;
    310311
    311312    QDoubleSpinBox* range0;
  • trunk/FACT++/gui/RawEventsViewer/viewer.ui

    r11908 r11933  
    769769       <layout class="QHBoxLayout" name="horizontalLayout">
    770770        <item>
     771         <widget class="QPushButton" name="playPauseButton">
     772          <property name="toolTip">
     773           <string>Play/Pause events animation</string>
     774          </property>
     775          <property name="text">
     776           <string>Play/Pause</string>
     777          </property>
     778         </widget>
     779        </item>
     780        <item>
    771781         <widget class="QLabel" name="label_24">
    772782          <property name="text">
     
    794804          <property name="value">
    795805           <double>100.000000000000000</double>
    796           </property>
    797          </widget>
    798         </item>
    799        </layout>
    800       </item>
    801       <item row="1" column="8">
    802        <layout class="QHBoxLayout" name="horizontalLayout_4">
    803         <item>
    804          <widget class="QLabel" name="label_2">
    805           <property name="text">
    806            <string>Events stepping</string>
    807           </property>
    808          </widget>
    809         </item>
    810         <item>
    811          <widget class="QPushButton" name="eventsMinusButton">
    812           <property name="toolTip">
    813            <string>Step backwards in events</string>
    814           </property>
    815           <property name="text">
    816            <string>-</string>
    817           </property>
    818          </widget>
    819         </item>
    820         <item>
    821          <widget class="QSpinBox" name="eventsStepBox">
    822           <property name="toolTip">
    823            <string>Number of events to skip at each step</string>
    824           </property>
    825           <property name="minimum">
    826            <number>1</number>
    827           </property>
    828           <property name="maximum">
    829            <number>9999</number>
    830           </property>
    831          </widget>
    832         </item>
    833         <item>
    834          <widget class="QPushButton" name="eventsPlusButton">
    835           <property name="sizePolicy">
    836            <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
    837             <horstretch>0</horstretch>
    838             <verstretch>0</verstretch>
    839            </sizepolicy>
    840           </property>
    841           <property name="toolTip">
    842            <string>Step forward in events</string>
    843           </property>
    844           <property name="text">
    845            <string>+</string>
    846806          </property>
    847807         </widget>
     
    952912       <layout class="QHBoxLayout" name="horizontalLayout_5">
    953913        <item>
    954          <widget class="QPushButton" name="slicesMinusMinusButton">
    955           <property name="toolTip">
    956            <string>Step backward one slice</string>
    957           </property>
     914         <widget class="QRadioButton" name="playEventsRadio">
    958915          <property name="text">
    959            <string>Slice--</string>
    960           </property>
    961          </widget>
    962         </item>
    963         <item>
    964          <widget class="QPushButton" name="playPauseButton">
    965           <property name="toolTip">
    966            <string>Play/Pause events animation</string>
    967           </property>
    968           <property name="text">
    969            <string>Play/Pause</string>
    970           </property>
    971          </widget>
    972         </item>
    973         <item>
    974          <widget class="QPushButton" name="slicesPlusPlusButton">
    975           <property name="toolTip">
    976            <string>Step forward one slice</string>
    977           </property>
    978           <property name="text">
    979            <string>Slice++</string>
     916           <string>play Events</string>
    980917          </property>
    981918         </widget>
     
    1013950        </property>
    1014951       </widget>
     952      </item>
     953      <item row="1" column="8">
     954       <layout class="QHBoxLayout" name="horizontalLayout_4">
     955        <item>
     956         <widget class="QRadioButton" name="playSlicesRadio">
     957          <property name="text">
     958           <string>play Slices</string>
     959          </property>
     960          <property name="checked">
     961           <bool>true</bool>
     962          </property>
     963         </widget>
     964        </item>
     965       </layout>
    1015966      </item>
    1016967     </layout>
Note: See TracChangeset for help on using the changeset viewer.