_myFunc( 0 ),
_myFieldB( 0 ),
_myLinear( 0 ),
+ _myLog( 0 ),
_myHisto( 0 ),
_myNbThresh( 0 ),
_myCutNeg( 0 ),
_myGroupLayout->addWidget( _myFunc, row, 0 );
row++;
- // 1) scale of histogram (radiogroup)
+ // 1) display histogram button (pushbutton)
+ _myHisto = new QPushButton( "Display Histogram", _GroupC1 );
+ _myHisto->setText("Display Histogram");
+ _myHisto->setAutoDefault(TRUE);
+ _myHisto->setDefault(TRUE);
+ _myGroupLayout->addWidget( _myHisto, row, 0 );
+ row++;
+
+ // 2) scale of histogram (radiogroup)
_myFScale = new QButtonGroup( "Type of display", _GroupC1 );
_myFScale->setExclusive( true );
_myFScale->setColumnLayout( 0, Qt::Horizontal );
_myLinear = new QRadioButton( "Linear", _myFScale );
_myLinear->setChecked(true);
+ _myLog = new QRadioButton( "Logarithm", _myFScale );
+ _myFScale->setDisabled(true);
QGridLayout* scaleLay = new QGridLayout( _myFScale->layout() );
scaleLay->addWidget( _myLinear, 0, 0 );
- scaleLay->addWidget( new QRadioButton( "Logarithm", _myFScale ), 0, 1 );
+ scaleLay->addWidget( _myLog, 0, 1 );
_myGroupLayout->addWidget( _myFScale, row, 0 );
row++;
- // 2) display histogram button (pushbutton)
- _myHisto = new QPushButton( "Display Histogram", _GroupC1 );
- _myHisto->setText("Display Histogram");
- _myHisto->setAutoDefault(TRUE);
- _myHisto->setDefault(TRUE);
- _myGroupLayout->addWidget( _myHisto, row, 0 );
- row++;
-
// 3) number of thresholds (radiogroup)
_myNbThresh = new QButtonGroup( "Select number of thresholds", _GroupC1 );
_myNbThresh->setExclusive( true );
nbtLay->addWidget( _myTwoThresh = new QRadioButton( "Two thresholds", _myNbThresh ), 0, 1 );
_myGroupLayout->addWidget( _myNbThresh, row, 0 );
-// _myOneThresh->setChecked(true);
- _myNbThresh->hide();
+ _myOneThresh->setChecked(true);
+ _myNbThresh->setDisabled(true);
row++;
// 4) reference area on thresholds (radiogroup)
_myGroupLayout->addWidget( _myArea, row, 0 );
_myExt->setChecked(true);
- _myArea->hide();
+ _myArea->setDisabled(true);
row++;
// 5) threshold values (line edit)
ftLay->addWidget( _myLEST = new QLineEdit( "", _myVThresh ), 1, 1 );
_myGroupLayout->addWidget( _myVThresh, row, 0 );
- _myVThresh->hide();
+ _myVThresh->setDisabled(true);
_myLST->hide();
_myLEST->hide();
row++;
outLay->addWidget( _myOFN = new QLineEdit( "", _myOutFile ), 0, 1 );
_myGroupLayout->addWidget( _myOutFile, row, 0 );
- _myOutFile->hide();
+ _myOutFile->setDisabled(true);
row++;
// 8) process button (pushbutton)
_myProc->setText("Process");
_myProc->setAutoDefault(TRUE);
_myGroupLayout->addWidget( _myProc, row, 0 );
- _myProc->hide();
+ _myProc->setDisabled(true);
row++;
_GroupC2 = new QGroupBox( _fr, "GroupC2" );
_myGroupLayout2->addWidget( _myPlot, 0, 0 );
// 9) reduction rate (label)
- _myGroupLayout2->addWidget( _myLRR = new QLabel( "reduction rate = 0.23", _GroupC2 ), 1, 0 );
+ _myGroupLayout2->addWidget( _myLRR = new QLabel( "reduction rate = 0.5", _GroupC2 ), 1, 0 );
_GroupC2->hide();
- _myLRR->hide();
_myHistoFThresh = _myPlot->insertCurve( QString() );
_myPlot->setCurvePen( _myHistoFThresh, QPen( Qt::black, 1 ) );
_myHistoSThresh = _myPlot->insertCurve( QString() );
_myPlot->setCurvePen( _myHistoSThresh, QPen( Qt::black, 1 ) );
- connect( _myHisto, SIGNAL(clicked()), this, SLOT(displayHisto()));
+ connect( _myHisto, SIGNAL(clicked()), this, SLOT(updateHisto()));
+ connect( _myLinear, SIGNAL(clicked()), this, SLOT(scaleSelected()));
+ connect( _myLog, SIGNAL(clicked()), this, SLOT(scaleSelected()));
connect( _myOneThresh, SIGNAL(clicked()), this, SLOT(nbThreshSelected()));
connect( _myTwoThresh, SIGNAL(clicked()), this, SLOT(nbThreshSelected()));
connect( _myInt, SIGNAL(clicked()), this, SLOT(areaSelected()));
connect( _myOFB, SIGNAL(clicked()), this, SLOT(getOutFileName()));
connect( _myProc, SIGNAL(clicked()), this, SLOT(process()));
- calcHisto();
-
return _fr;
}
+void SelectParams::scaleSelected()
+{
+ if( _myLinear->isChecked() )
+ _myPlot->setAxisOptions(_myPlot->curveYAxis( _myHistoCurve ), QwtAutoScale::None );
+ else
+ _myPlot->setAxisOptions(_myPlot->curveYAxis( _myHistoCurve ), QwtAutoScale::Logarithmic );
+ _myPlot->replot();
+}
+
void SelectParams::nbThreshSelected()
{
if( _myOneThresh->isChecked() ){
displaySThresh();
}
calcRateRed();
- if(_myArea->isHidden())
- _myArea->show();
- if(_myVThresh->isHidden())
- _myVThresh->show();
- if(_myLRR->isHidden())
- _myLRR->show();
- if(_myOutFile->isHidden())
- _myOutFile->show();
- if(_myProc->isHidden())
- _myProc->show();
}
void SelectParams::areaSelected()
if( (_y[i] < _ymin) && (_y[i] != 0.0) )
_ymin = _y[i];
}
- _myPlot->setAxisScale( _myPlot->curveXAxis( _myHistoCurve ), _xmin, _xmax );
- _myPlot->setAxisScale( _myPlot->curveYAxis( _myHistoCurve ), _ymin, _ymax );
- _myPlot->setCurveData( _myHistoCurve, _x, _y, _size );
_fthresh = (_xmin + _xmax)/2.0;
_sthresh = (_xmin + 3.*_xmax)/4.0;
sprintf(strth,"%g",_fthresh);
void SelectParams::displayHisto()
{
- _qmap = _myPlot->canvasMap(_myPlot->curveXAxis( _myHistoCurve ));
- _qmap.setDblRange(_xmin,_xmax);
+ if(!_myFScale->isEnabled())
+ _myFScale->setEnabled(true);
+ if(!_myNbThresh->isEnabled())
+ _myNbThresh->setEnabled(true);
+ if(!_myArea->isEnabled())
+ _myArea->setEnabled(true);
+ if(!_myVThresh->isEnabled())
+ _myVThresh->setEnabled(true);
+ if(!_myOutFile->isEnabled())
+ _myOutFile->setEnabled(true);
+ if(!_myProc->isEnabled())
+ _myProc->setEnabled(true);
+ _myPlot->setAxisScale( _myPlot->curveXAxis( _myHistoCurve ), _xmin, _xmax );
+ _myPlot->setAxisScale( _myPlot->curveYAxis( _myHistoCurve ), _ymin, _ymax );
+ _myPlot->setCurveData( _myHistoCurve, _x, _y, _size );
if( _myLinear->isChecked() )
_myPlot->setAxisOptions(_myPlot->curveYAxis( _myHistoCurve ), QwtAutoScale::None );
else
_myPlot->setAxisOptions(_myPlot->curveYAxis( _myHistoCurve ), QwtAutoScale::Logarithmic );
+ _qmap = _myPlot->canvasMap(_myPlot->curveXAxis( _myHistoCurve ));
+ _qmap.setDblRange(_xmin,_xmax);
_myPlot->replot();
if(_GroupC2->isHidden())
_GroupC2->show();
- if(_myNbThresh->isHidden())
- _myNbThresh->show();
+}
+
+void SelectParams::updateHisto()
+{
+ calcHisto();
+ displayHisto();
+ displayFThresh();
+ if( _myTwoThresh->isChecked() )
+ displaySThresh();
+ calcRateRed();
}
void SelectParams::displayFThresh()
void SelectParams::getOutFileName()
{
- QString file = QFileDialog::getSaveFileName("/home",
+ QString file = QFileDialog::getSaveFileName("",
"*.med",
_myOFB,
"save file dialog",