Skip to content

Commit

Permalink
Started to add new interaction. This refs #5801
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Dec 10, 2012
1 parent 51b2cdf commit dd03ecb
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/MantidQt/Python/mantidqt.sip
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ RefMatrixWSImageView


public:
RefMatrixWSImageView(QString wsname);
RefMatrixWSImageView(QString wsname, double peak_min, double peak_max, double back_min, double back_max, double tof_min, double tof_max);

MantidQt::RefDetectorViewer::RefIVConnections * getConnections();
%Docstring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class EXPORT_OPT_MANTIDQT_IMAGEVIEWER RefImageView : public QMainWindow
public:

/// Construct an ImageView to display data from the specified data source
RefImageView( RefImageDataSource* data_source );
RefImageView( RefImageDataSource* data_source, double peak_min, double peak_max, double back_min, double back_max, double tof_min, double tof_max);

~RefImageView();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace RefDetectorViewer
/// Construct an image viewer for the specifed MatrixWorkspace
RefMatrixWSImageView ( Mantid::API::MatrixWorkspace_sptr mat_ws );

RefMatrixWSImageView( QString wps_name);
RefMatrixWSImageView( QString wps_name, double peak_min, double peak_max, double back_min, double back_max, double tof_min, double tof_max);
RefIVConnections* getConnections();

~RefMatrixWSImageView();
Expand Down
20 changes: 19 additions & 1 deletion Code/Mantid/MantidQt/RefDetectorViewer/src/RefImageView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include "MantidQtRefDetectorViewer/SliderHandler.h"
#include "MantidQtRefDetectorViewer/RangeHandler.h"

#include <sstream>
#include <string>

namespace MantidQt
{
namespace RefDetectorViewer
Expand All @@ -24,7 +27,7 @@ namespace RefDetectorViewer
*
* @param data_source The source of the data that will be displayed.
*/
RefImageView::RefImageView( RefImageDataSource* data_source )
RefImageView::RefImageView( RefImageDataSource* data_source, double peak_min, double peak_max, double back_min, double back_max, double tof_min, double tof_max)
{
Ui_RefImageViewer* ui = new Ui_RefImageViewer();
saved_ui = ui;
Expand Down Expand Up @@ -73,6 +76,21 @@ RefImageView::RefImageView( RefImageDataSource* data_source )
RefIVConnections * iv_connections = new RefIVConnections( ui, this,
image_display,
h_graph, v_graph );

//populate widgets with peak, back and tof values
std::string s_peak_min;
std::stringstream ss_peak_min;
ss_peak_min << peak_min;
ss_peak_min >> s_peak_min;
image_display->setPeakLeft(static_cast<int>(peak_min));
QString peak_min_value = QString::fromStdString(s_peak_min);
ui->lineEdit_peakLeft->setText(peak_min_value);





// ui->lineEdit_peakLeft.

saved_iv_connections = iv_connections;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ using namespace Mantid::API;
*/
RefMatrixWSImageView::RefMatrixWSImageView( MatrixWorkspace_sptr mat_ws )
{
RefMatrixWSDataSource* source = new RefMatrixWSDataSource( mat_ws );
image_view = new RefImageView( source ); // this is the QMainWindow
// for the viewer. It is
// deleted when the window
// is closed
return;
// RefMatrixWSDataSource* source = new RefMatrixWSDataSource( mat_ws );
// image_view = new RefImageView( source ); // this is the QMainWindow
// // for the viewer. It is
// // deleted when the window
// // is closed
}

RefMatrixWSImageView::RefMatrixWSImageView( QString wps_name)
RefMatrixWSImageView::RefMatrixWSImageView( QString wps_name, double peak_min, double peak_max, double back_min, double back_max, double tof_min, double tof_max)
{

IEventWorkspace_sptr ws;
Expand Down Expand Up @@ -70,8 +71,14 @@ RefMatrixWSImageView::RefMatrixWSImageView( QString wps_name)
total_rows, total_cols,
data);

// std::cout << "ws->readX(0).size(): " << ws->readX(0).size() << std::endl;
image_view = new RefImageView( source );
// std::cout << "ws->readX(0).size(): " << ws->readX(0).size() << std::endl;



image_view = new RefImageView( source,
peak_min, peak_max,
back_min, back_max,
tof_min, tof_max);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,16 @@ def _plot_data_count_vs_tof_2d(self):
# mantidplot.app should be used instead of _qti.app (it's just an alias)
#mantidplot.app.connect(mantidplot.app.mantidUI, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)
#mantidplot.app.connect(mantidplot.app.RefDetectorViewer, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)

peak_min = int(self._summary.data_peak_from_pixel.text());
peak_max = int(self._summary.data_peak_to_pixel.text());
back_min = int(self._summary.data_background_from_pixel1.text());
back_max = int(self._summary.data_background_to_pixel1.text());
tof_min = int(self._summary.data_from_tof.text());
tof_max = int(self._summary.data_to_tof.text());

import mantidqtpython
self.ref_det_view = mantidqtpython.MantidQt.RefDetectorViewer.RefMatrixWSImageView(ws_output_base)
self.ref_det_view = mantidqtpython.MantidQt.RefDetectorViewer.RefMatrixWSImageView(ws_output_base, peak_min, peak_max, back_min, back_max, tof_min, tof_max)
QtCore.QObject.connect(self.ref_det_view.getConnections(),
QtCore.SIGNAL("peak_back_tof_range_update(double,double, double,double,double,double)"), self.call_back)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,15 @@ def _plot_data_count_vs_tof_2d(self):
#mantidplot.app.connect(mantidplot.app.mantidUI, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)
#mantidplot.app.connect(mantidplot.app.RefDetectorViewer, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)

peak_min = int(self._summary.data_peak_from_pixel.text());
peak_max = int(self._summary.data_peak_to_pixel.text());
back_min = int(self._summary.data_background_from_pixel1.text());
back_max = int(self._summary.data_background_to_pixel1.text());
tof_min = int(self._summary.data_from_tof.text());
tof_max = int(self._summary.data_to_tof.text());

import mantidqtpython
self.ref_det_view = mantidqtpython.MantidQt.RefDetectorViewer.RefMatrixWSImageView(ws_output_base_ff+'_2D')
self.ref_det_view = mantidqtpython.MantidQt.RefDetectorViewer.RefMatrixWSImageView(ws_output_base_ff+'_2D', peak_min, peak_max, back_min, back_max, tof_min, tof_max)
QtCore.QObject.connect(self.ref_det_view.getConnections(), QtCore.SIGNAL("peak_back_tof_range_update(double,double, double,double,double,double)"), self.call_back)

def call_back(self, peakmin, peakmax, backmin, backmax, tofmin, tofmax):
Expand Down

0 comments on commit dd03ecb

Please sign in to comment.