Skip to content

Commit

Permalink
The peaks, backs and tof values are now automatically passed to the m…
Browse files Browse the repository at this point in the history
…ain gui. This refs #5801
  • Loading branch information
JeanBilheux committed Dec 19, 2012
1 parent 0cc414e commit 3263c30
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 51 deletions.
63 changes: 60 additions & 3 deletions Code/Mantid/MantidQt/RefDetectorViewer/src/RefImageView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace RefDetectorViewer
*
* @param data_source The source of the data that will be displayed.
*/
RefImageView::RefImageView( RefImageDataSource* data_source, double peak_min, double peak_max, double back_min, double back_max, double tof_min, double tof_max)
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 @@ -71,7 +71,52 @@ RefImageView::RefImageView( RefImageDataSource* data_source, double peak_min, do
ui->lineEdit_backRight,
ui->lineEdit_TOFmin,
ui->lineEdit_TOFmax);
saved_image_display = image_display;

std::string s1;
std::stringstream ss1;
ss1 << peak_min;
ss1 >> s1;
QString s_peak_min = QString::fromStdString(s1);
ui->lineEdit_peakLeft->setText(s_peak_min);

std::string s2;
std::stringstream ss2;
ss2 << peak_max;
ss2 >> s2;
QString s_peak_max = QString::fromStdString(s2);
ui->lineEdit_peakRight->setText(s_peak_max);

std::string s3;
std::stringstream ss3;
ss3 << back_min;
ss3 >> s3;
QString s_back_min = QString::fromStdString(s3);
ui->lineEdit_backLeft->setText(s_back_min);

std::string s4;
std::stringstream ss4;
ss4 << back_max;
ss4 >> s4;
QString s_back_max = QString::fromStdString(s4);
ui->lineEdit_backRight->setText(s_back_max);

std::string s5;
std::stringstream ss5;
ss5 << tof_min;
ss5 >> s5;
QString s_tof_min = QString::fromStdString(s5);
ui->lineEdit_TOFmin->setText(s_tof_min);

std::string s6;
std::stringstream ss6;
ss6 << tof_max;
ss6 >> s6;
QString s_tof_max = QString::fromStdString(s6);
ui->lineEdit_TOFmax->setText(s_tof_max);

// image_display->UpdateImage();

saved_image_display = image_display;

RefIVConnections * iv_connections = new RefIVConnections( ui, this,
image_display,
Expand Down Expand Up @@ -129,13 +174,25 @@ RefImageView::RefImageView( RefImageDataSource* data_source, double peak_min, do

// ui->lineEdit_peakLeft.

saved_iv_connections = iv_connections;

image_display->setPeakLeft(static_cast<int>(peak_min));
image_display->setPeakRight(static_cast<int>(peak_max));
image_display->setBackLeft(static_cast<int>(back_min));
image_display->setBackRight(static_cast<int>(back_max));
image_display->setTOFmin(static_cast<int>(tof_min));
image_display->setTOFmax(static_cast<int>(tof_max));

saved_iv_connections = iv_connections;

image_display->UpdateImage();
iv_connections->peak_back_tof_range_update();


image_display->SetDataSource( data_source );

image_display->UpdateImage();
iv_connections->peak_back_tof_range_update();

}

RefIVConnections* RefImageView::getIVConnections()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ RefMatrixWSImageView::RefMatrixWSImageView( QString wps_name, double peak_min, d
total_rows, total_cols,
data);

// 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,6 @@ def _plot_data_count_vs_tof_2d(self):
# ws_output_base = "Counts vs X pixel - %s" % basename
# x_title = "X pixel"

range_min = int(self._summary.data_from_tof.text())
range_max = int(self._summary.data_to_tof.text())

ws_output_base = "Peak - " + basename + " - Y pixel _2D"
if mtd.workspaceExists(ws_output_base):
Expand All @@ -895,26 +893,14 @@ def _plot_data_count_vs_tof_2d(self):
callback=None,
instrument='REFL')

# def call_back(peakmin, peakmax, backmin, backmax, tofmin, tofmax):
# print 'Inside the call_back on the python side'
# self._summary.data_peak_from_pixel.setText("%-d" % int(peakmin))
# self._summary.data_peak_to_pixel.setText("%-d" % int(peakmax))
# self._summary.data_background_from_pixel1.setText("%-d" % int(backmin))
# self._summary.data_background_to_pixel1.setText("%-d" % int(backmax))
# self._summary.x_min_edit.setText("%-d" % int(tofmin))
# self._summary.x_max_edit.setText("%-d" % int(tofmax))

# 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());

#collect peaks, backs and tof values
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, peak_min, peak_max, back_min, back_max, tof_min, tof_max)
QtCore.QObject.connect(self.ref_det_view.getConnections(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,27 +949,14 @@ def _plot_data_count_vs_tof_2d(self):
callback=None,
instrument='REFM')


# def call_back(peakmin, peakmax, backmin, backmax, tofmin, tofmax):
# print 'Inside the call_back on the python side'
# self._summary.data_peak_from_pixel.setText("%-d" % int(peakmin))
# self._summary.data_peak_to_pixel.setText("%-d" % int(peakmax))
# self._summary.data_background_from_pixel1.setText("%-d" % int(backmin))
# self._summary.data_background_to_pixel1.setText("%-d" % int(backmax))
# self._summary.x_min_edit.setText("%-d" % int(tofmin))
# self._summary.x_max_edit.setText("%-d" % int(tofmax))

# 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());

#collect peaks, backs and tof values
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', 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 All @@ -988,4 +975,4 @@ def call_back(self, peakmin, peakmax, backmin, backmax, tofmin, tofmax):





0 comments on commit 3263c30

Please sign in to comment.