mainwindow.h 1.73 KB
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "spectrumwindow.h"
#include <QMainWindow>
#include <QMouseEvent>

//stim libraries
#include "stim/envi/envi.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

	void mousePressEvent(QMouseEvent* event);	//handles when the image is clicked
	void resizeEvent(QResizeEvent* event);		//handles when the window is resized

	void mousePressSpectrum(double x, double y);	//handles when the user picks the spectrum

	void loadImage(QString filename);			//loads a hyperspectral image

private slots:
    void on_actionLoad_triggered();

private:
    Ui::MainWindow *ui;
	QGraphicsScene* scene;	//scene containing the image and any drawn UI elements
	QPixmap image;			//stores the pixels for the current band
	QPixmap main_image;		//stores the pixels for the image displayed in the main view (may be scaled)

	//coordinates of the picked position in image space [0, 1]
	double px;
	double py;

	SpectrumWindow* s;		//window displaying the spectrum of the selected pixel

	stim::envi hsi;			//data structure storing the current hyperspectral image
	QVector<double> x;		//x values for the spectrum
	QVector<double> y;		//y values for the spectrum

	void load_band(unsigned int i);		//loads an image of a band from the HSI and stores it in the global variable image
	void draw_viewport();	//draws the viewport, including the image and overlay
	void draw_overlay();	//draws an overlay showing the picked position
	

	void load_spectrum();	//loads a spectrum from the HSI and stores it in the global variable y
	void draw_spectrum();	//sends a spectrum to the SpectrumWindow for plotting	

};

#endif // MAINWINDOW_H