-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding classes so ImageViewer works for MatrixWorkspaces
Added MatrixWSDataSource and MatrixWSImageView classes, so ImageViewer can be applied to MatrixWorkspaces. A common base class for Matrix and Event workspace data sources should be created, or generateHistogram() should be added to IEventWorkspace. refs #5058
- Loading branch information
1 parent
7a7db90
commit 4e295d4
Showing
8 changed files
with
443 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
Code/Mantid/MantidQt/ImageViewer/inc/MantidQtImageViewer/MatrixWSDataSource.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#ifndef MATRIX_WS_DATA_SOURCE_H | ||
#define MATRIX_WS_DATA_SOURCE_H | ||
|
||
#include <cstddef> | ||
|
||
#include "MantidQtImageViewer/DataArray.h" | ||
#include "MantidQtImageViewer/ImageDataSource.h" | ||
#include "MantidQtImageViewer/DllOptionIV.h" | ||
|
||
#include "MantidAPI/MatrixWorkspace.h" | ||
|
||
/** | ||
@class MatrixWSDataSource | ||
This class provides a concrete implementation of an ImageDataSource | ||
that gets it's data from a matrix workspace. | ||
@author Dennis Mikkelson | ||
@date 2012-05-08 | ||
Copyright © 2012 ORNL, STFC Rutherford Appleton Laboratories | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
Code Documentation is available at | ||
<http://doxygen.mantidproject.org> | ||
*/ | ||
|
||
namespace MantidQt | ||
{ | ||
namespace ImageView | ||
{ | ||
|
||
class EXPORT_OPT_MANTIDQT_IMAGEVIEWER MatrixWSDataSource: public ImageDataSource | ||
{ | ||
public: | ||
|
||
/// Construct a DataSource object around the specifed MatrixWorkspace | ||
MatrixWSDataSource( Mantid::API::MatrixWorkspace_sptr mat_ws ); | ||
|
||
~MatrixWSDataSource(); | ||
|
||
/// OVERRIDES: Get the smallest 'x' value covered by the data | ||
virtual double GetXMin(); | ||
|
||
/// OVERRIDES: Get the largest 'x' value covered by the data | ||
virtual double GetXMax(); | ||
|
||
/// OVERRIDES: Get the largest 'y' value covered by the data | ||
virtual double GetYMax(); | ||
|
||
/// OVERRIDES: Get the total number of rows of data | ||
virtual size_t GetNRows(); | ||
|
||
/// Get DataArray covering full range of data in x, and y directions | ||
DataArray * GetDataArray( bool is_log_x ); | ||
|
||
/// Get DataArray covering restricted range of data | ||
DataArray * GetDataArray( double xmin, | ||
double xmax, | ||
double ymin, | ||
double ymax, | ||
size_t n_rows, | ||
size_t n_cols, | ||
bool is_log_x ); | ||
|
||
/// Get a list containing pairs of strings with information about x,y | ||
void GetInfoList( double x, | ||
double y, | ||
std::vector<std::string> &list ); | ||
private: | ||
Mantid::API::MatrixWorkspace_sptr mat_ws; | ||
|
||
}; | ||
|
||
} // namespace MantidQt | ||
} // namespace ImageView | ||
|
||
#endif // MATRIX_WS_DATA_SOURCE_H |
60 changes: 60 additions & 0 deletions
60
Code/Mantid/MantidQt/ImageViewer/inc/MantidQtImageViewer/MatrixWSImageView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#ifndef MATRIX_WS_IMAGE_VIEW_H | ||
#define MATRIX_WS_IMAGE_VIEW_H | ||
|
||
#include "MantidQtImageViewer/DllOptionIV.h" | ||
|
||
#include "MantidAPI/IEventWorkspace.h" | ||
|
||
/** | ||
@class MatrixWSDataSource | ||
This is the top level class for showing a matrix workspace | ||
using an ImageViewer. | ||
@author Dennis Mikkelson | ||
@date 2012-05-08 | ||
Copyright © 2012 ORNL, STFC Rutherford Appleton Laboratories | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
Code Documentation is available at | ||
<http://doxygen.mantidproject.org> | ||
*/ | ||
#include "MantidQtImageViewer/ImageView.h" | ||
|
||
namespace MantidQt | ||
{ | ||
namespace ImageView | ||
{ | ||
|
||
class EXPORT_OPT_MANTIDQT_IMAGEVIEWER MatrixWSImageView | ||
{ | ||
public: | ||
|
||
/// Construct an image viewer for the specifed MatrixWorkspace | ||
MatrixWSImageView( Mantid::API::MatrixWorkspace_sptr mat_ws ); | ||
|
||
~MatrixWSImageView(); | ||
|
||
private: | ||
ImageView *image_view; | ||
}; | ||
|
||
} // namespace MantidQt | ||
} // namespace ImageView | ||
|
||
#endif // MATRIX_WS_IMAGE_VIEW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.