Newer
Older
#ifndef SLICEVIEWER_H
#define SLICEVIEWER_H
#include "DimensionSliceWidget.h"
Janik Zikovsky
committed
#include "DllOption.h"
#include "MantidAPI/IMDWorkspace.h"
Janik Zikovsky
committed
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "MantidQtAPI/MantidColorMap.h"
#include "MantidQtSliceViewer/LineOverlay.h"
#include "QwtRasterDataMD.h"
#include "ui_SliceViewer.h"
Janik Zikovsky
committed
#include <QtCore/QtCore>
#include <QtGui/qdialog.h>
#include <QtGui/QWidget>
Janik Zikovsky
committed
#include <qwt_color_map.h>
#include <qwt_plot_spectrogram.h>
#include <qwt_plot.h>
Janik Zikovsky
committed
#include <qwt_scale_widget.h>
#include <vector>
Janik Zikovsky
committed
namespace MantidQt
{
namespace SliceViewer
{
/** GUI for viewing a 2D slice out of a multi-dimensional workspace.
* You can select which dimension to plot as X,Y, and the cut point
* along the other dimension(s).
*
*/
class EXPORT_OPT_MANTIDQT_SLICEVIEWER SliceViewer : public QWidget
SliceViewer(QWidget *parent = 0);
~SliceViewer();
void setWorkspace(Mantid::API::IMDWorkspace_sptr ws);
Janik Zikovsky
committed
void showControls(bool visible);
void zoomBy(double factor);
void loadColorMap(QString filename = QString() );
public slots:
void changedShownDim(int index, int dim, int oldDim);
Janik Zikovsky
committed
void resetZoom();
void showInfoAt(double, double);
Janik Zikovsky
committed
void colorRangeFullSlot();
void colorRangeSliceSlot();
void colorRangeChanged();
void zoomInSlot();
void zoomOutSlot();
Janik Zikovsky
committed
void updateDisplaySlot(int index, double value);
void loadSettings();
void saveSettings();
Janik Zikovsky
committed
void initZoomer();
void updateDisplay(bool resetAxes = false);
void updateDimensionSliceWidgets();
void resetAxis(int axis, Mantid::Geometry::IMDDimension_const_sptr dim);
QwtDoubleInterval getRange(Mantid::API::IMDIterator * it);
void findRangeFull();
void findRangeSlice();
// -------------------------- Widgets ----------------------------
/// Auto-generated UI controls.
Ui::SliceViewerClass ui;
/// Main plot object
QwtPlot * m_plot;
/// Spectrogram plot
QwtPlotSpectrogram * m_spect;
/// Layout containing the spectrogram
Janik Zikovsky
committed
QHBoxLayout * m_spectLayout;
/// Color bar indicating the color scale
ColorBarWidget * m_colorBar;
/// Vector of the widgets for slicing dimensions
Janik Zikovsky
committed
std::vector<DimensionSliceWidget *> m_dimWidgets;
/// The LineOverlay widget for drawing line cross-sections (hidden at startup)
LineOverlay * m_lineOverlay;
// -------------------------- Data Members ----------------------------
/// Workspace being shown
Mantid::API::IMDWorkspace_sptr m_ws;
/// Set to true once the first workspace has been loaded in it
bool m_firstWorkspaceOpen;
/// File of the last loaded color map.
QString m_currentColorMapFile;
Janik Zikovsky
committed
/// Vector of the dimensions to show.
std::vector<Mantid::Geometry::MDHistoDimension_sptr> m_dimensions;
/// Data presenter
QwtRasterDataMD * m_data;
/// The X and Y dimensions being plotted
Mantid::Geometry::IMDDimension_const_sptr m_X;
Mantid::Geometry::IMDDimension_const_sptr m_Y;
Janik Zikovsky
committed
size_t m_dimX;
size_t m_dimY;
Janik Zikovsky
committed
/// The range of values to fit in the color map.
QwtDoubleInterval m_colorRange;
/// The calculated range of values in the FULL data set
QwtDoubleInterval m_colorRangeFull;
/// The calculated range of values ONLY in the currently viewed part of the slice
QwtDoubleInterval m_colorRangeSlice;
/// Use the log of the value for the color scale
bool m_logColor;
/// Menus
QMenu * m_menuColorOptions;
QMenu * m_menuView;
/// Cached double for infinity
double m_inf;
} // namespace SliceViewer
} // namespace Mantid