Skip to content
Snippets Groups Projects
SliceViewer.h 2.7 KiB
Newer Older
#ifndef SLICEVIEWER_H
#define SLICEVIEWER_H

#include "MantidAPI/IMDWorkspace.h"
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include <QtGui/qdialog.h>
#include <qwt_plot_spectrogram.h>
#include <qwt_plot.h>
Janik Zikovsky's avatar
Janik Zikovsky committed
#include <qwt_raster_data.h>
class EXPORT_OPT_MANTIDQT_SLICEVIEWER SliceViewer : public QWidget
  SliceViewer(QWidget *parent = 0);
  ~SliceViewer();
  void setWorkspace(Mantid::API::IMDWorkspace_sptr ws);
  void zoomBy(double factor);
  void changedShownDim(int index, int dim, int oldDim);
  void updateDisplaySlot(int index, double value);
  void resetZoom();
  void showInfoAt(double, double);
  void colorRangeFullSlot();
  void colorRangeSliceSlot();
  void zoomInSlot();
  void zoomOutSlot();
  void initMenus();

  void updateDisplay(bool resetAxes = false);
  void resetAxis(int axis, Mantid::Geometry::IMDDimension_const_sptr dim);
  void findRangeFull();
  void findRangeSlice();


private:
  /// Auto-generated UI controls.
  Ui::SliceViewerClass ui;

  /// Set to true once the first workspace has been loaded in it
  bool m_firstWorkspaceOpen;

  /// Main plot object
  QwtPlot * m_plot;

  /// Spectrogram plot
  QwtPlotSpectrogram * m_spect;

  /// Layout containing the spectrogram
  /// Color bar indicating the color scale
  /// Vector of the widgets for slicing dimensions
  std::vector<DimensionSliceWidget *> m_dimWidgets;

  /// Vector of the dimensions to show.
  std::vector<Mantid::Geometry::MDHistoDimension_sptr> m_dimensions;

  /// Data presenter
  QwtRasterDataMD * m_data;

  /// Workspace being shown
  Mantid::API::IMDWorkspace_sptr m_ws;
  /// The X and Y dimensions being plotted
  Mantid::Geometry::IMDDimension_const_sptr m_X;
  Mantid::Geometry::IMDDimension_const_sptr m_Y;
  /// 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
  /// Menus
  QMenu * m_menuColorOptions;
  QMenu * m_menuView;

};

#endif // SLICEVIEWER_H