#include "HistogramGraph.qo.h"
#include <guitools/Histogram/BinPlotWidget.qo.h>
#include <images/Images/ImageInterface.h>
#include <images/Regions/ImageRegion.h>
using namespace casacore;
namespace casa {
HistogramGraph::HistogramGraph(QWidget *parent )
: QWidget(parent) {
ui.setupUi(this);
initPlot();
connect( ui.toolButton, SIGNAL(clicked()), this, SIGNAL(showHistogramTool()));
connect( ui.nextButton, SIGNAL(clicked()), this, SLOT(nextGraph()));
}
void HistogramGraph::setIndex( int stackIndex ) {
index = stackIndex;
}
void HistogramGraph::nextGraph() {
emit showGraph( index+1);
}
void HistogramGraph::initPlot() {
histogram = new BinPlotWidget( false, false, false, NULL );
histogram->setDisplayPlotTitle( true );
histogram->setDisplayAxisTitles( true );
QHBoxLayout* boxLayout = new QHBoxLayout();
boxLayout->addWidget( histogram );
ui.histogramHolder->setLayout( boxLayout );
}
void HistogramGraph::setNextEnabled( bool enabled ) {
ui.nextButton->setEnabled( enabled );
}
void HistogramGraph::setImageRegion( ImageRegion* region, int id ) {
histogram->setImageRegion( region, id );
}
void HistogramGraph::setImage(std::shared_ptr<ImageInterface<float> > image ) {
histogram->setImage( image );
}
HistogramGraph::~HistogramGraph() {
}
}