Skip to content

Commit

Permalink
Added first version of new Ref Detecector Viewer. This refs #5801
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Sep 5, 2012
1 parent f6ee02b commit fdc3a46
Show file tree
Hide file tree
Showing 39 changed files with 6,797 additions and 0 deletions.
109 changes: 109 additions & 0 deletions Code/Mantid/MantidQt/RefDetectorViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
set ( SRC_FILES
src/ColorMaps.cpp
src/ImageDisplay.cpp
src/IVUtils.cpp
src/TrackingPicker.cpp
src/DataArray.cpp
src/ImagePlotItem.cpp
src/QtUtils.cpp
src/GraphDisplay.cpp
src/ImageView.cpp
src/SliderHandler.cpp
src/RangeHandler.cpp
src/ImageDataSource.cpp
src/IVConnections.cpp
src/MatrixWSDataSource.cpp
src/MatrixWSImageView.cpp
src/ArrayDataSource.cpp
src/ErrorHandler.cpp
)

# Include files aren't required, but this makes them appear in Visual Studio
set ( INC_FILES
inc/MantidQtRefDetectorViewer/ColorMaps.h
inc/MantidQtRefDetectorViewer/ImageDisplay.h
inc/MantidQtRefDetectorViewer/IVConnections.h
inc/MantidQtRefDetectorViewer/DataArray.h
inc/MantidQtRefDetectorViewer/ImagePlotItem.h
inc/MantidQtRefDetectorViewer/IVUtils.h
inc/MantidQtRefDetectorViewer/TrackingPicker.h
inc/MantidQtRefDetectorViewer/GraphDisplay.h
inc/MantidQtRefDetectorViewer/ImageView.h
inc/MantidQtRefDetectorViewer/QtUtils.h
inc/MantidQtRefDetectorViewer/ImageDataSource.h
inc/MantidQtRefDetectorViewer/SliderHandler.h
inc/MantidQtRefDetectorViewer/RangeHandler.h
inc/MantidQtRefDetectorViewer/MatrixWSDataSource.h
inc/MantidQtRefDetectorViewer/MatrixWSImageView.h
inc/MantidQtRefDetectorViewer/ArrayDataSource.h
inc/MantidQtRefDetectorViewer/ErrorHandler.h
)

set ( MOC_FILES
inc/MantidQtRefDetectorViewer/IVConnections.h
inc/MantidQtRefDetectorViewer/TrackingPicker.h
)

set ( UI_FILES
inc/MantidQtRefDetectorViewer/ImageView.ui
)

# Python unit tests
set ( TEST_PY_FILES
)

include_directories ( inc )
include_directories ( ../../Framework/API/inc )


###########################################################################
# Main Library Target
###########################################################################

qt4_wrap_cpp ( MOCCED_FILES ${MOC_FILES} )

# --- Add icons qrc ------

set ( ALL_SRC ${SRC_FILES} ${MOCCED_FILES} )

qt4_wrap_ui ( UI_HDRS ${UI_FILES} )

include_directories ( ${CMAKE_CURRENT_BINARY_DIR} )
include_directories ( inc )

# For Windows:
add_definitions ( -DIN_MANTIDQT_IMAGEVIEWER )

# This creates the target library
add_library ( MantidQtRefDetectorViewer ${ALL_SRC} ${INC_FILES} ${UI_HDRS} )

# ... and links to other required libs
target_link_libraries ( MantidQtRefDetectorViewer
MantidQtAPI MantidWidgets QtPropertyBrowser ${CORE_MANTIDLIBS} ${QT_LIBRARIES} ${QWT_LIBRARIES} )

###########################################################################
# DEMO/GUI TESTING APPLICATIONS
###########################################################################

add_executable ( RefDetectorViewDemo EXCLUDE_FROM_ALL ${ALL_SRC} src/RefDetectorViewDemo.cpp ${INC_FILES} ${QTIPLOT_C_SRC} ${UI_HDRS})
target_link_libraries ( RefDetectorViewDemo MantidQtAPI QtPropertyBrowser
${CORE_MANTIDLIBS} ${QT_LIBRARIES} ${QWT_LIBRARIES} )

# add_executable ( ImageViewNxEventFile EXCLUDE_FROM_ALL ${ALL_SRC}
# src/ImageViewNxEventFile.cpp ${INC_FILES} ${QTIPLOT_C_SRC} ${UI_HDRS})
# target_link_libraries ( ImageViewNxEventFile
# MantidQtAPI QtPropertyBrowser ${CORE_MANTIDLIBS}
# ${QT_LIBRARIES} ${QWT_LIBRARIES} )

###########################################################################
# Unit tests setup
###########################################################################


###########################################################################
# Installation settings
###########################################################################

install ( TARGETS MantidQtRefDetectorViewer ${SYSTEM_PACKAGE_TARGET} DESTINATION ${LIB_DIR} )


Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#ifndef ARRAY_DATA_SOURCE_H
#define ARRAY_DATA_SOURCE_H

#include <cstddef>
#include "MantidQtRefDetectorViewer/DataArray.h"
#include "MantidQtRefDetectorViewer/ImageDataSource.h"

/**
@class ArrayDataSource
This class provides a wrapper around a simple 2-D array of doubles
stored in row-major order in a 1-D array, so that the array can be
viewed using the ImageView data viewer.
@author Dennis Mikkelson
@date 2012-05-14
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 RefDetectorViewer
{

class EXPORT_OPT_MANTIDQT_IMAGEVIEWER ArrayDataSource: public ImageDataSource
{
public:

/// Construct a DataSource object based on the specified array of floats
ArrayDataSource( double total_xmin, double total_xmax,
double total_ymin, double total_ymax,
size_t total_rows, size_t total_cols,
float* data );

~ArrayDataSource();

/// 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:
float* data;
};

} // namespace MantidQt
} // namespace ImageView

#endif // ARRAY_DATA_SOURCE_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#ifndef COLOR_MAPS_H
#define COLOR_MAPS_H

#include <vector>
#include <QColor>
#include "MantidQtRefDetectorViewer/DllOptionIV.h"

/**
@class ColorMaps
This class has static methods to construct some useful color scales
and to build a lookup table to brighten an image, so low-level
intensities become more visible
@author Dennis Mikkelson
@date 2012-04-03
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 RefDetectorViewer
{

class EXPORT_OPT_MANTIDQT_IMAGEVIEWER ColorMaps
{

public:

enum ColorScale
{
HEAT,
GRAY,
NEGATIVE_GRAY,
GREEN_YELLOW,
RAINBOW,
OPTIMAL,
MULTI,
SPECTRUM
};

/// Get the specified color scale
static void GetColorMap( ColorScale name,
size_t n_colors,
std::vector<QRgb> & color_table );

/// Get look up table to brighten image
static void GetIntensityMap( double control_s,
size_t n_entries,
std::vector<double> & intensity_table );

private:

/// Fill out a color table by interpolating the given base RGB components
static void InterpolateColorScale( double base_red[],
double base_green[],
double base_blue[],
size_t n_base_colors,
size_t n_colors,
std::vector<QRgb> & color_table );

};

} // namespace MantidQt
} // namespace ImageView


#endif // COLOR_MAPS_H

0 comments on commit fdc3a46

Please sign in to comment.