Brief description of class still missing. More...
#include <HistogramWidget.h>
Public Slots | |
| void | addMeanCurve () |
| void | addMedianCurve () |
| void | addModeCurve () |
| void | show () |
Public Member Functions | |
| void | fillGrid () |
| HistogramWidget (QWidget *parent=0) | |
| HistogramWidget (MaxEntryList *maxList, QWidget *parent=0) | |
| void | initGrid (int nValueClasses, double minValueHisto, double maxValueHisto, SamplingOption ySampling) |
| bool | loadMax (QString fileName) |
| MaxEntryList * | maxEntryList () |
| bool | select (bool scaleTypeForced, SamplingOption scaleType) |
| void | setHistogram (Histogram2D *hist) |
| void | toStream (QTextStream &s, int curveIndex) |
| ~HistogramWidget () | |
| ~HistogramWidget () | |
Protected Member Functions | |
| void | closeEvent (QCloseEvent *e) |
| virtual void | closeEvent (QCloseEvent *e) |
Brief description of class still missing.
Full description of class still missing
| HistogramWidget::HistogramWidget | ( | QWidget * | parent = 0 | ) |
Description of constructor still missing
References SciFigs::ParallelBands::addBand(), SciFigs::LineLayer::addLine(), SciFigs::GraphContentLayer::addTrackingAction(), SciFigs::Axis::setNumberPrecision(), SciFigs::Axis::setNumberType(), SciFigs::GraphicObject::setObjectName(), SciFigs::GraphContentLayer::setOpacity(), SciFigs::GraphicObject::setPrintHeight(), SciFigs::GraphicObject::setPrintLeft(), SciFigs::GraphicObject::setPrintTop(), SciFigs::GraphicObject::setPrintWidth(), SciFigs::Axis::setRange(), SciFigs::LineLayer::setReferenceLine(), SciFigs::LineLayer::setReferencePen(), SciFigs::Axis::setTitle(), QGpCoreTools::tr(), TRACE, SciFigs::AxisWindow::updateInternalGeometry(), w, and SciFigs::AxisWindow::yAxis().
: QWidget(parent)
{
TRACE;
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, false);
setFocusPolicy(Qt::ClickFocus);
_hist=0;
_lastX=0;
AxisWindow * w;
QAction * a;
w=new AxisWindow(this);
w->setObjectName( "Histogram" );
sheet->sheet()->addObject(w);
w->setPrintLeft(0.5);
w->setPrintTop(0.5);
w->setPrintWidth(16.0);
w->setPrintHeight(8.0);
w->updateInternalGeometry();
_histogramLayer=new IrregularGrid2DPlot(w);
LineLayer * curveLayer=new LineLayer(w);
curveLayer->setReferenceLine(new RealStatisticalLine);
curves->setProxy(new RealStatisticalProxy);
curves->initLayer(curveLayer);
curves->setCurrentLayer(curveLayer);
//a=curves->addCurveAction(tr("&Adjust"), tr("Adjust current curve to the closest maximum"), true);
//connect(a, SIGNAL(triggered()), this, SLOT(adjustCurve()) );
sheet->sheet()->showObject(w);
new QShortcut(Qt::Key_Up, this, SLOT(nextX()));
new QShortcut(Qt::Key_Up+Qt::SHIFT, this, SLOT(nextXReject()));
new QShortcut(Qt::Key_Down, this, SLOT(previousX()));
new QShortcut(Qt::Key_Down+Qt::SHIFT, this, SLOT(previousXReject()));
new QShortcut(Qt::Key_Left, this, SLOT(decreaseLowLimit()));
new QShortcut(Qt::Key_Left+Qt::SHIFT, this, SLOT(decreaseHighLimit()));
new QShortcut(Qt::Key_Right, this, SLOT(increaseLowLimit()));
new QShortcut(Qt::Key_Right+Qt::SHIFT, this, SLOT(increaseHighLimit()));
// Init the curve menu
QMenu * m=new QMenu(this);
m->setTitle(tr( "Curve"));
m->setTearOffEnabled (true);
curveBut->setMenu(m);
a=new QAction(tr("&Mean"), this);
curveBut->menu()->addAction(a);
connect(a, SIGNAL(triggered()), this, SLOT(addMeanCurve()) );
a=new QAction(tr("Medi&an"), this);
curveBut->menu()->addAction(a);
connect(a, SIGNAL(triggered()), this, SLOT(addMedianCurve()) );
a=new QAction(tr("Mo&de"), this);
curveBut->menu()->addAction(a);
connect(a, SIGNAL(triggered()), this, SLOT(addModeCurve()) );
w=new AxisWindow(this);
sheet->sheet()->addObject(w);
w->setPrintLeft(0.5);
w->setPrintTop(8.5);
w->setPrintWidth(8.0);
w->setPrintHeight(6.0);
w->updateInternalGeometry();
_densityBandLayer=new ParallelBands(w);
_densityBandLayer->setObjectName( "DensitySelection" );
_densityBandLayer->addTrackingAction(tr("Pick bands"), 0, tr("Define the X band to reject."));
_densityBandLayer->setOpacity(0.6);
_densityBandLayer->addBand(0, 0, Brush(QColor( 205, 242, 255) ));
connect(_densityBandLayer, SIGNAL(bandPicked(double, double)), this, SLOT(setBand( double, double) ));
_densityCurveLayer=new LineLayer(w);
_densityCurveLayer->setObjectName( "Density" );
_densityCurveLayer->setReferenceLine(new PlotLine2D);
_densityCurveLayer->setReferencePen(Pen( Qt::blue) );
_densityCurveLayer->addLine(Pen( Qt::blue), Symbol());
_densityCurveLayer->addLine(Pen( Qt::red), Symbol());
w->yAxis()->setNumberType(Number::Scientific);
w->yAxis()->setNumberPrecision(1);
w->yAxis()->setTitle( "Probability density" );
sheet->sheet()->showObject(w);
w=new AxisWindow(this);
sheet->sheet()->addObject(w);
w->setPrintLeft(8.5);
w->setPrintTop(8.5);
w->setPrintWidth(8.0);
w->setPrintHeight(6.0);
w->updateInternalGeometry();
_cumulativeBandLayer=new ParallelBands(w);
_cumulativeBandLayer->setObjectName( "CumulativeSelection" );
_cumulativeBandLayer->addTrackingAction(tr("Pick bands"), 0, tr("Define the X band to reject."));
_cumulativeBandLayer->setOpacity(0.6);
_cumulativeBandLayer->addBand(0, 0, Brush(QColor( 205, 242, 255) ));
connect(_cumulativeBandLayer, SIGNAL(bandPicked(double, double)), this, SLOT(setBand( double, double) ));
_cumulativeCurveLayer=new LineLayer(w);
_cumulativeCurveLayer->setObjectName( "Cumulative" );
_cumulativeCurveLayer->setReferenceLine(new PlotLine2D);
_cumulativeCurveLayer->setReferencePen(Pen( Qt::blue) );
_cumulativeCurveLayer->addLine(Pen( Qt::blue), Symbol());
_cumulativeCurveLayer->addLine(Pen( Qt::red), Symbol());
w->yAxis()->setRange(0.0, 1.0);
w->yAxis()->setNumberType(Number::Fixed);
w->yAxis()->setNumberPrecision(1);
w->yAxis()->setTitle( "Cumulative probability" );
sheet->sheet()->showObject(w);
Settings::getWidget(this, "Histogram" );
}
| HistogramWidget::HistogramWidget | ( | MaxEntryList * | maxList, |
| QWidget * | parent = 0 |
||
| ) |
References MaxEntryList::CURVE, MaxEntryList::FK, SciFigs::CurveBrowser::initLayer(), SciFigs::CurveBrowser::setCurrentLayer(), StatGridAnalyser::setGrid(), SciFigs::GraphicObject::setObjectName(), SciFigs::CurveBrowser::setProxy(), SciFigs::LineLayer::setReferenceLine(), MaxEntryList::SPAC, MaxEntryList::TFA, TRACE, MaxEntryList::type(), MaxEntryList::Undefined, and SciFigs::AxisWindow::yAxis().
: QWidget(parent)
{
TRACE;
setupUi(this);
QSplitter * hSplitter=new QSplitter(this);
hSplitter->setOrientation(Qt::Horizontal);
_curves=new CurveBrowser(hSplitter);
AxisWindow * graph=new AxisWindow(hSplitter);
graph->setObjectName( "HistogramWidget" );
_gridLayer=new IrregularGrid2DPlot(graph);
_gridLayer->setObjectName("histograms");
LineLayer * curveLayer=new LineLayer(graph);
curveLayer->setObjectName("curves");
_maxList=maxList;
switch (_maxList->type()) {
case MaxEntryList::Undefined: ASSERT(false);
case MaxEntryList::FK:
_curves->setProxy(new DispersionProxy);
curveLayer->setReferenceLine(new ModalLine);
break;
case MaxEntryList::SPAC:
_curves->setProxy(new AutocorrProxy);
curveLayer->setReferenceLine(new ModalLine);
break;
case MaxEntryList::TFA:
_curves->setProxy(new EllipticityProxy);
curveLayer->setReferenceLine(new ModalLine);
break;
case MaxEntryList::CURVE:
_curves->setProxy(new RealStatisticalProxy);
curveLayer->setReferenceLine(new RealStatisticalLine);
break;
}
_curves->initLayer(curveLayer);
_curves->setCurrentLayer(curveLayer);
//QAction * a=_curves->addCurveAction(tr("&Adjust"), tr("Adjust current curve to the closest maximum"), true);
//connect(a, SIGNAL(triggered()), this, SLOT(adjustCurve()) );
qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, hSplitter);
Settings::getRect(this, "HistogramWidget" );
_statWidget=new StatGridAnalyser(0, Qt::Window);
_statWidget->setGrid(_gridLayer, graph->yAxis());
Settings::getWidget(_statWidget, "StatGridAnalyser");
connect(_statWidget, SIGNAL(reject( double, double, double) ),
this, SLOT(unselectValue( double, double, double) ));
connect(_statWidget, SIGNAL(undo( double) ),
this, SLOT(selectAll( double) ));
connect(_statWidget, SIGNAL(newMean()), this, SLOT(addMeanCurve()) );
connect(_statWidget, SIGNAL(newMedian()), this, SLOT(addMedianCurve()) );
connect(_statWidget, SIGNAL(newMode()), this, SLOT(addModeCurve()) );
}
| void HistogramWidget::addMeanCurve | ( | ) | [slot] |
| void HistogramWidget::addMedianCurve | ( | ) | [slot] |
| void HistogramWidget::addModeCurve | ( | ) | [slot] |
| void HistogramWidget::closeEvent | ( | QCloseEvent * | e | ) | [protected] |
| virtual void HistogramWidget::closeEvent | ( | QCloseEvent * | e | ) | [protected, virtual] |
| void HistogramWidget::fillGrid | ( | ) |
References SciFigs::AxisWindow::deepUpdate(), MaxEntryList::fillGrid(), SciFigs::IrregularGrid2DPlot::grid(), StatGridAnalyser::gridChanged(), SciFigs::IrregularGrid2DPlot::setGrid(), and TRACE.
Referenced by main(), and select().
{
TRACE;
IrregularGrid2D grid=_gridLayer->grid();
_maxList->fillGrid(grid);
// Normalize histogram
normalizeGrid(grid);
_gridLayer->setGrid(grid);
_statWidget->gridChanged();
graph()->deepUpdate();
}
| void HistogramWidget::initGrid | ( | int | nValueClasses, |
| double | minValueHisto, | ||
| double | maxValueHisto, | ||
| SamplingOption | ySampling | ||
| ) |
References SciFigs::CurveBrowser::currentLayer(), QGpCoreTools::endl(), MaxEntryList::initGrid(), QGpCoreTools::LinearScale, QGpCoreTools::LogScale, SciFigs::LineLayer::setErrorBar(), SciFigs::IrregularGrid2DPlot::setGrid(), SciFigs::Axis::setScaleType(), QGpCoreTools::tr(), TRACE, and SciFigs::AxisWindow::yAxis().
Referenced by main(), and select().
{
TRACE;
if(minValueHisto > maxValueHisto) {
double tmp=minValueHisto;
minValueHisto=maxValueHisto;
maxValueHisto=tmp;
}
if((ySampling & LogScale) && (minValueHisto<=0.0 || maxValueHisto<=0.0) ) {
App::stream() << tr("Null or negative values not allowed for log scales, back to linear scale") << endl;
ySampling=LinearScale;
}
if(ySampling==LogScale) {
graph()->yAxis()->setScaleType(Scale::Log);
_curves->currentLayer()->setErrorBar(LineLayer::VerticalLogBar);
}
_gridLayer->setGrid(_maxList->initGrid(nValueClasses, minValueHisto, maxValueHisto, ySampling) );
}
| bool HistogramWidget::loadMax | ( | QString | fileName | ) |
| MaxEntryList* HistogramWidget::maxEntryList | ( | ) | [inline] |
| bool HistogramWidget::select | ( | bool | scaleTypeForced, |
| SamplingOption | scaleType | ||
| ) |
References MaxEntryList::CURVE, fillGrid(), MaxEntryList::FK, SciFigs::IrregularGrid2DPlot::grid(), initGrid(), MaxEntryList::keepComponent(), MaxEntryList::keepRing(), QGpCoreTools::LinearScale, QGpCoreTools::LogScale, QGpCoreTools::IrregularGrid2D::maximumValue(), SciFigs::GridPlot::palette(), MaxEntryList::rejectNPeaksPerMinute(), MaxEntryList::rejectPower(), SAFE_UNINITIALIZED, QGpGuiTools::ColorPalette::setColor(), SciFigs::GridPlot::setPalette(), StatGridAnalyser::setUnits(), QGpGuiTools::ColorPalette::setVLinear(), MaxEntryList::SPAC, MaxEntryList::TFA, TRACE, and MaxEntryList::type().
Referenced by main().
{
TRACE;
double minValueHisto, maxValueHisto;
int nValueClasses, ringIndex, componentIndex;
double relFac, absFac, nppm;
SAFE_UNINITIALIZED(nppm,0);
SAFE_UNINITIALIZED(relFac,0);
SAFE_UNINITIALIZED(absFac,0);
SAFE_UNINITIALIZED(componentIndex,0);
SAFE_UNINITIALIZED(ringIndex,0);
SAFE_UNINITIALIZED(nValueClasses,0);
SAFE_UNINITIALIZED(minValueHisto,0);
SAFE_UNINITIALIZED(maxValueHisto,0);
switch (_maxList->type()) {
case MaxEntryList::FK: {
FKOptions * d=new FKOptions(this);
Settings::getWidget(d);
if(d->exec()!=QDialog::Accepted) {
delete d;
return false;
}
minValueHisto=1.0/d->maxVelocity->text().toDouble();
maxValueHisto=1.0/d->minVelocity->text().toDouble();
nValueClasses=d->nVelocityClasses->value();
relFac=d->relPowerThreshold->value() * 0.01;
absFac=d->absPowerThreshold->value() * 0.01;
Settings::setWidget(d);
delete d;
}
setWindowTitle(windowTitle().arg("FK"));
_statWidget->setUnits("s/m");
if(!scaleTypeForced) scaleType=LinearScale;
break;
case MaxEntryList::SPAC: {
SPACOptions * d=new SPACOptions(this);
Settings::getWidget(d);
if(d->exec()!=QDialog::Accepted) {
delete d;
return false;
}
minValueHisto=d->maxValue->text().toDouble();
maxValueHisto=d->minValue->text().toDouble();
nValueClasses=d->nValueClasses->value();
ringIndex=d->ringIndex->value();
componentIndex=d->componentIndex->value();
Settings::setWidget(d);
delete d;
setWindowTitle(windowTitle().arg("SPAC - ring %1 - component %2").arg(ringIndex).arg(componentIndex));
}
_statWidget->setUnits("");
if(!scaleTypeForced) scaleType=LinearScale;
break;
case MaxEntryList::TFA: {
TFAOptions * d=new TFAOptions(this);
Settings::getWidget(d);
if(d->exec()!=QDialog::Accepted) {
delete d;
return false;
}
minValueHisto=d->maxValue->text().toDouble();
maxValueHisto=d->minValue->text().toDouble();
nValueClasses=d->nValueClasses->value();
nppm=d->nppm->value();
Settings::setWidget(d);
delete d;
}
setWindowTitle(windowTitle().arg("TFA"));
_statWidget->setUnits("");
if(!scaleTypeForced) scaleType=LogScale;
break;
case MaxEntryList::CURVE: {
GenericOptions * d=new GenericOptions(this);
Settings::getWidget(d);
if(d->exec()!=QDialog::Accepted) {
delete d;
return false;
}
//minValueHisto=d->minValue->text().toDouble();
//maxValueHisto=d->maxValue->text().toDouble();
//nValueClasses=d->nValueClasses->value();
Settings::setWidget(d);
delete d;
}
setWindowTitle(windowTitle().arg("CURVE"));
_statWidget->setUnits("");
if(!scaleTypeForced) scaleType=LinearScale;
break;
default:
return false;
}
// Sample selection
switch (_maxList->type()) {
case MaxEntryList::FK:
_maxList->rejectPower(relFac, absFac);
break;
case MaxEntryList::SPAC:
_maxList->keepRing(ringIndex);
_maxList->keepComponent(componentIndex);
break;
case MaxEntryList::TFA:
_maxList->rejectNPeaksPerMinute(nppm);
break;
default:
break;
}
initGrid(nValueClasses, minValueHisto, maxValueHisto, scaleType);
fillGrid();
addMedianCurve();
setLimits();
ColorPalette pal=_gridLayer->palette();
pal.setVLinear(0, _gridLayer->grid().maximumValue());
pal.setColor(0, Qt::white);
_gridLayer->setPalette(pal);
return true;
}
| void HistogramWidget::setHistogram | ( | Histogram2D * | hist | ) |
References SciFigs::IrregularGrid2DPlot::boundingRect(), SciFigs::AxisWindow::deepUpdate(), QGpCoreTools::Rect::enlarge(), SciFigs::GraphContent::graph(), SciFigs::GraphContentLayer::graphContent(), SciFigs::IrregularGrid2DPlot::grid(), QGpCoreTools::IrregularGrid2D::maximumValue(), QGpCoreTools::IrregularGrid2D::nx(), SciFigs::GridPlot::palette(), SciFigs::Scale::sampling(), SciFigs::GraphContent::scaleX(), SciFigs::GraphContent::scaleY(), SciFigs::IrregularGrid2DPlot::setGrid(), SciFigs::GridPlot::setPalette(), SciFigs::Axis::setRange(), QGpGuiTools::ColorPalette::setVLinear(), TRACE, w, QGpCoreTools::Rect::x1(), QGpCoreTools::Rect::x2(), SciFigs::AxisWindow::xAxis(), QGpCoreTools::Rect::y1(), QGpCoreTools::Rect::y2(), and SciFigs::AxisWindow::yAxis().
Referenced by main().
{
TRACE;
_hist=hist;
_histogramLayer->setGrid( *_hist);
Rect r=_histogramLayer->boundingRect();
GraphContent * gc=_histogramLayer->graphContent();
AxisWindow * w=gc->graph();
r.enlarge(0.01, gc->scaleX().sampling(), gc->scaleY().sampling());
w->xAxis()->setRange(r.x1(), r.x2());
w->yAxis()->setRange(r.y1(), r.y2());
ColorPalette pal=_histogramLayer->palette();
pal.setVLinear(0, _histogramLayer->grid().maximumValue());
//pal.setColor(0, Qt::white);
_histogramLayer->setPalette(pal);
xScroll->setRange(0, hist->nx()-1);
on_xScroll_valueChanged();
w->deepUpdate();
}
| void HistogramWidget::show | ( | ) | [slot] |
| void HistogramWidget::toStream | ( | QTextStream & | s, |
| int | curveIndex | ||
| ) |
References SciFigs::CurveBrowser::currentLayer(), MaxEntryList::CURVE, SciFigs::RealStatisticalLine::curve(), QGpGuiWave::ModalLine::curve(), MaxEntryList::FK, SciFigs::LineLayer::line(), MaxEntryList::SPAC, MaxEntryList::TFA, QGpCoreTools::Curve< pointType >::toString(), TRACE, MaxEntryList::type(), and MaxEntryList::Undefined.
Referenced by main().
{
TRACE;
switch (_maxList->type()) {
case MaxEntryList::Undefined: ASSERT(false);
case MaxEntryList::FK:
case MaxEntryList::SPAC:
case MaxEntryList::TFA: {
ModalLine * l=static_cast<ModalLine *>(_curves->currentLayer()->line(curveIndex));
s << l->curve().toString();
}
break;
case MaxEntryList::CURVE: {
RealStatisticalLine * l=static_cast<RealStatisticalLine *>(_curves->currentLayer()->line(curveIndex));
s << l->curve().toString();
}
break;
}
}