2019-02-08 00:24:46 +08:00
/*
2020-08-26 18:58:23 +08:00
Copyright ( c ) 2008 - 2020 Jan W . Krieger
2019-02-08 00:24:46 +08:00
This software is free software : you can redistribute it and / or modify
it under the terms of the GNU Lesser General Public License ( LGPL ) as published by
the Free Software Foundation , either version 2.1 of the License , or
( at your option ) any later version .
This program 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 Lesser General Public License ( LGPL ) for more details .
You should have received a copy of the GNU Lesser General Public License ( LGPL )
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef JKQTPGRAPHSIMAGERGB_H
# define JKQTPGRAPHSIMAGERGB_H
# include <QString>
# include <QPainter>
# include <QImage>
# include <QIcon>
2019-06-20 22:06:31 +08:00
# include "jkqtplotter/graphs/jkqtpimage.h"
2019-05-30 04:40:02 +08:00
# include "jkqtplotter/jkqtptools.h"
2019-02-08 00:24:46 +08:00
# include "jkqtplotter/jkqtpbaseelements.h"
2019-06-22 20:21:32 +08:00
# include "jkqtplotter/jkqtplotter_imexport.h"
2019-05-30 04:40:02 +08:00
# include "jkqtplotter/jkqtpimagetools.h"
2019-02-08 00:24:46 +08:00
2019-08-01 04:10:26 +08:00
/*! \brief class to plot an image from an 2-dimensional array of RGB values
2019-02-08 00:24:46 +08:00
\ ingroup jkqtplotter_imagelots_elements
2019-08-01 04:10:26 +08:00
This class extends JKQTPMathImageBase and interprets the data array JKQTPMathImageBase : : data as
the 1 st ( RED ) color channel and adds two more channels for GREEN and BLUE .
Using setRgbMode ( ) you can also use a different color system than RGB .
2019-02-08 00:24:46 +08:00
\ image html rgbimageplots . png
2019-06-21 04:24:47 +08:00
\ image html rgbimageplot_opencv . png
2019-08-01 04:10:26 +08:00
\ see Examples : \ ref JKQTPlotterRGBImagePlot and \ ref JKQTPlotterImagePlotRGBOpenCV
2019-02-08 00:24:46 +08:00
*/
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPRGBMathImage : public JKQTPMathImageBase {
2019-02-08 00:24:46 +08:00
Q_OBJECT
public :
using JKQTPMathImageBase : : setData ;
2019-05-19 22:40:02 +08:00
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param datatype datatype of the image given in \ a data
* \ param data points to an image to be plotted ( of size \ a Nx * \ a Ny )
* \ param Nx width ( in number of pixels ) of \ a data
* \ param Ny height ( in number of pixels ) of \ a data
* \ param parent parent plotter object
*
*/
2020-09-29 01:24:17 +08:00
JKQTPRGBMathImage ( double x , double y , double width , double height , JKQTPMathImageDataType datatype , const void * data , int Nx , int Ny , JKQTBasePlotter * parent = nullptr ) ;
2019-02-08 00:24:46 +08:00
2019-05-19 22:40:02 +08:00
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param datatype datatype of the image given in \ a data
* \ param data points to an image to be plotted ( of size \ a Nx * \ a Ny )
* \ param Nx width ( in number of pixels ) of \ a data
* \ param Ny height ( in number of pixels ) of \ a data
* \ param parent parent plotter object
*
*/
2020-09-29 01:24:17 +08:00
JKQTPRGBMathImage ( double x , double y , double width , double height , JKQTPMathImageDataType datatype , const void * data , int Nx , int Ny , JKQTPlotter * parent ) ;
2019-02-08 00:24:46 +08:00
2019-05-19 22:40:02 +08:00
/** \brief class constructor
*
* \ param parent parent plotter object
*/
2019-02-08 00:24:46 +08:00
JKQTPRGBMathImage ( JKQTBasePlotter * parent = nullptr ) ;
2019-05-19 22:40:02 +08:00
/** \brief class constructor
*
* \ param parent parent plotter object
*/
2019-02-08 00:24:46 +08:00
JKQTPRGBMathImage ( JKQTPlotter * parent ) ;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw ( JKQTPEnhancedPainter & painter ) override ;
2019-04-22 19:27:50 +08:00
/** \copydoc JKQTPImageBase::setParent() */
2019-02-08 00:24:46 +08:00
virtual void setParent ( JKQTBasePlotter * parent ) override ;
2019-04-22 19:27:50 +08:00
/** \brief set the plot-data to a given array \a data (red), \a dataG (green), \a dataB (blue) with size \a Nx * \a Ny in row-major ordering and with the given \a datatype */
2020-09-29 01:24:17 +08:00
virtual void setData ( const void * dataR , const void * dataG , const void * dataB , int Nx , int Ny , JKQTPMathImageDataType datatype ) ;
2019-04-22 19:27:50 +08:00
/** \brief set the plot-data to a given array \a data (red), \a dataG (green), \a dataB (blue) with size \a Nx * \a Ny in row-major ordering */
2020-09-29 01:24:17 +08:00
virtual void setData ( const void * dataR , const void * dataG , const void * dataB , int Nx , int Ny ) ;
2019-02-08 00:24:46 +08:00
2019-04-22 19:27:50 +08:00
/** \brief set the plot-data to a given array \a data (red) with size \a Nx * \a Ny in row-major ordering and with the given \a datatype */
2020-09-29 01:24:17 +08:00
virtual void setData ( const void * dataR , int Nx , int Ny , JKQTPMathImageDataType datatype ) override ;
2019-04-22 19:27:50 +08:00
/** \brief set the plot-data to a given array \a data (red) with size \a Nx * \a Ny in row-major ordering */
2020-09-29 01:24:17 +08:00
virtual void setData ( const void * dataR , int Nx , int Ny ) override ;
2019-02-08 00:24:46 +08:00
/** \brief determine min/max data value of the image */
virtual void getDataMinMax ( double & imin , double & imax ) override ;
2020-09-21 19:47:54 +08:00
/** \copydoc data */
2020-09-29 01:24:17 +08:00
virtual void setDataR ( const void * __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc data */
2020-09-29 01:24:17 +08:00
const void * getDataR ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc datatype */
2019-08-01 04:10:26 +08:00
void setDatatypeR ( JKQTPMathImageDataType __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc datatype */
2019-08-01 04:10:26 +08:00
JKQTPMathImageDataType getDatatypeR ( ) const ;
2019-04-22 19:27:50 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc dataG */
2020-09-29 01:24:17 +08:00
virtual void setDataG ( const void * __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc dataG */
2020-09-29 01:24:17 +08:00
const void * getDataG ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc datatypeG */
2019-08-01 04:10:26 +08:00
void setDatatypeG ( JKQTPMathImageDataType __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc datatypeG */
2019-08-01 04:10:26 +08:00
JKQTPMathImageDataType getDatatypeG ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc dataB */
2020-09-29 01:24:17 +08:00
virtual void setDataB ( const void * __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc dataB */
2020-09-29 01:24:17 +08:00
const void * getDataB ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc datatypeB */
2019-08-01 04:10:26 +08:00
void setDatatypeB ( JKQTPMathImageDataType __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc datatypeB */
2019-08-01 04:10:26 +08:00
JKQTPMathImageDataType getDatatypeB ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc showColorBar */
2019-04-22 19:27:50 +08:00
void setShowColorBar ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc showColorBar */
2019-04-22 19:27:50 +08:00
bool getShowColorBar ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarWidth */
2019-04-22 19:27:50 +08:00
void setColorBarWidth ( int __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarWidth */
2019-04-22 19:27:50 +08:00
int getColorBarWidth ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarOffset */
2019-04-22 19:27:50 +08:00
void setColorBarOffset ( int __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarOffset */
2019-04-22 19:27:50 +08:00
int getColorBarOffset ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRelativeHeight */
2019-04-22 19:27:50 +08:00
void setColorBarRelativeHeight ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRelativeHeight */
2019-04-22 19:27:50 +08:00
double getColorBarRelativeHeight ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMinR */
2019-04-22 19:27:50 +08:00
void setImageMin ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMinR */
2019-04-22 19:27:50 +08:00
double getImageMin ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMinR */
2019-04-22 19:27:50 +08:00
void setImageMinR ( double m ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMaxR */
2019-04-22 19:27:50 +08:00
void setImageMax ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMaxR */
2019-04-22 19:27:50 +08:00
double getImageMax ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMaxR */
2019-04-22 19:27:50 +08:00
void setImageMaxR ( double m ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMinG */
2019-04-22 19:27:50 +08:00
void setImageMinG ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMinG */
2019-04-22 19:27:50 +08:00
double getImageMinG ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMaxG */
2019-04-22 19:27:50 +08:00
void setImageMaxG ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMaxG */
2019-04-22 19:27:50 +08:00
double getImageMaxG ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMinB */
2019-04-22 19:27:50 +08:00
void setImageMinB ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMinB */
2019-04-22 19:27:50 +08:00
double getImageMinB ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMaxB */
2019-04-22 19:27:50 +08:00
void setImageMaxB ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageMaxB */
2019-04-22 19:27:50 +08:00
double getImageMaxB ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc autoImageRange */
2019-04-22 19:27:50 +08:00
void setAutoImageRange ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc autoImageRange */
2019-04-22 19:27:50 +08:00
bool getAutoImageRange ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameR */
2019-04-22 19:27:50 +08:00
void setImageName ( const QString & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameR */
2019-04-22 19:27:50 +08:00
QString getImageName ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameR */
2019-04-22 19:27:50 +08:00
QString getImageNameR ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameR */
2019-04-22 19:27:50 +08:00
void setImageNameR ( const QString & m ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameG */
2019-04-22 19:27:50 +08:00
void setImageNameG ( const QString & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameG */
2019-04-22 19:27:50 +08:00
QString getImageNameG ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameB */
2019-04-22 19:27:50 +08:00
void setImageNameB ( const QString & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameB */
2019-04-22 19:27:50 +08:00
QString getImageNameB ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameFontName */
2019-04-22 19:27:50 +08:00
void setImageNameFontName ( const QString & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameFontName */
2019-04-22 19:27:50 +08:00
QString getImageNameFontName ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameFontSize */
2019-04-22 19:27:50 +08:00
void setImageNameFontSize ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageNameFontSize */
2019-04-22 19:27:50 +08:00
double getImageNameFontSize ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightAxis */
2019-04-22 19:27:50 +08:00
JKQTPVerticalIndependentAxis * getColorBarRightAxis ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopAxis */
2019-04-22 19:27:50 +08:00
JKQTPHorizontalIndependentAxis * getColorBarTopAxis ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightAxis */
2019-04-22 19:27:50 +08:00
JKQTPVerticalIndependentAxis * getColorBarRightAxisR ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopAxis */
2019-04-22 19:27:50 +08:00
JKQTPHorizontalIndependentAxis * getColorBarTopAxisR ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightAxisG */
2019-04-22 19:27:50 +08:00
JKQTPVerticalIndependentAxis * getColorBarRightAxisG ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopAxisG */
2019-04-22 19:27:50 +08:00
JKQTPHorizontalIndependentAxis * getColorBarTopAxisG ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightAxisB */
2019-04-22 19:27:50 +08:00
JKQTPVerticalIndependentAxis * getColorBarRightAxisB ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopAxisB */
2019-04-22 19:27:50 +08:00
JKQTPHorizontalIndependentAxis * getColorBarTopAxisB ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightAxis */
2019-04-22 19:27:50 +08:00
const JKQTPVerticalIndependentAxis * getColorBarRightAxis ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopAxis */
2019-04-22 19:27:50 +08:00
const JKQTPHorizontalIndependentAxis * getColorBarTopAxis ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightAxis */
2019-04-22 19:27:50 +08:00
const JKQTPVerticalIndependentAxis * getColorBarRightAxisR ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopAxis */
2019-04-22 19:27:50 +08:00
const JKQTPHorizontalIndependentAxis * getColorBarTopAxisR ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightAxisG */
2019-04-22 19:27:50 +08:00
const JKQTPVerticalIndependentAxis * getColorBarRightAxisG ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopAxisG */
2019-04-22 19:27:50 +08:00
const JKQTPHorizontalIndependentAxis * getColorBarTopAxisG ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightAxisB */
2019-04-22 19:27:50 +08:00
const JKQTPVerticalIndependentAxis * getColorBarRightAxisB ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopAxisB */
2019-04-22 19:27:50 +08:00
const JKQTPHorizontalIndependentAxis * getColorBarTopAxisB ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopVisible */
2019-04-22 19:27:50 +08:00
void setColorBarTopVisible ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarTopVisible */
2019-04-22 19:27:50 +08:00
bool getColorBarTopVisible ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightVisible */
2019-04-22 19:27:50 +08:00
void setColorBarRightVisible ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarRightVisible */
2019-04-22 19:27:50 +08:00
bool getColorBarRightVisible ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorbarsSideBySide */
2019-04-22 19:27:50 +08:00
void setColorbarsSideBySide ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorbarsSideBySide */
2019-04-22 19:27:50 +08:00
bool getColorbarsSideBySide ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc rgbMode */
2019-04-22 19:27:50 +08:00
void setRgbMode ( JKQTPRGBMathImageRGBMode __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc rgbMode */
2019-04-22 19:27:50 +08:00
JKQTPRGBMathImageRGBMode getRgbMode ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierMode */
2019-08-01 04:10:26 +08:00
void setModifierMode ( const JKQTPMathImageModifierMode & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierMode */
2019-08-01 04:10:26 +08:00
JKQTPMathImageModifierMode getModifierMode ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarModifiedWidth */
2019-08-01 04:10:26 +08:00
void setColorBarModifiedWidth ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarModifiedWidth */
2019-08-01 04:10:26 +08:00
double getColorBarModifiedWidth ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierColorBarTopAxis */
2019-08-01 04:10:26 +08:00
JKQTPVerticalIndependentAxis * getModifierColorBarTopAxis ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierColorBarRightAxis */
2019-08-01 04:10:26 +08:00
JKQTPHorizontalIndependentAxis * getModifierColorBarRightAxis ( ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierColorBarTopAxis */
2019-08-01 04:10:26 +08:00
const JKQTPVerticalIndependentAxis * getModifierColorBarTopAxis ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierColorBarRightAxis */
2019-08-01 04:10:26 +08:00
const JKQTPHorizontalIndependentAxis * getModifierColorBarRightAxis ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc autoModifierRange */
2019-08-01 04:10:26 +08:00
void setAutoModifierRange ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc autoModifierRange */
2019-08-01 04:10:26 +08:00
bool getAutoModifierRange ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierMin */
2019-08-01 04:10:26 +08:00
void setModifierMin ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierMin */
2019-08-01 04:10:26 +08:00
double getModifierMin ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierMax */
2019-08-01 04:10:26 +08:00
void setModifierMax ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierMax */
2019-08-01 04:10:26 +08:00
double getModifierMax ( ) const ;
2019-02-08 00:24:46 +08:00
2019-04-22 19:27:50 +08:00
/** \brief return the data of the green channel used for plotting as a QVector<double> in row-major data-ordering */
2019-02-08 00:24:46 +08:00
QVector < double > getDataGAsDoubleVector ( ) const ;
2019-04-22 19:27:50 +08:00
/** \brief return the data of the blue channel used for plotting as a QVector<double> in row-major data-ordering */
2019-02-08 00:24:46 +08:00
QVector < double > getDataBAsDoubleVector ( ) const ;
/*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
\ note If you want to draw outside , then you ' ll also have to implement drawOutside ( )
*/
virtual void getOutsideSize ( JKQTPEnhancedPainter & painter , int & leftSpace , int & rightSpace , int & topSpace , int & bottomSpace ) override ;
/*! \brief plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
\ note If you want to draw outside , then you ' ll also have to implement getOutsideSize ( ) , so enough space is reserved
The four value supplied tell the method where to draw ( inside one of the rectangles ) .
*/
virtual void drawOutside ( JKQTPEnhancedPainter & painter , QRect leftSpace , QRect rightSpace , QRect topSpace , QRect bottomSpace ) override ;
2020-09-21 19:47:54 +08:00
/** \brief return the plotted image only as a QImage */
2019-02-08 00:24:46 +08:00
virtual QImage drawImage ( ) ;
/** \brief determine min/max data value of the image */
virtual void getDataMinMaxG ( double & imin , double & imax ) ;
/** \brief determine min/max data value of the image */
virtual void getDataMinMaxB ( double & imin , double & imax ) ;
/** \brief return the value (raw data!) of the contained image at the given coordinate */
double getValueAt ( double x , double y , int channel = 0 ) ;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
protected :
void initObject ( ) ;
/** \brief points to the data array, holding the image */
2020-09-29 01:24:17 +08:00
const void * dataG ;
2019-02-08 00:24:46 +08:00
/** \brief datatype of the data array data */
2019-08-01 04:10:26 +08:00
JKQTPMathImageDataType datatypeG ;
2019-02-08 00:24:46 +08:00
/** \brief points to the data array, holding the image */
2020-09-29 01:24:17 +08:00
const void * dataB ;
2019-02-08 00:24:46 +08:00
/** \brief datatype of the data array data */
2019-08-01 04:10:26 +08:00
JKQTPMathImageDataType datatypeB ;
2019-02-08 00:24:46 +08:00
2019-04-22 19:27:50 +08:00
/** \brief how to interpret the three data channels red, green and blue */
2019-02-08 00:24:46 +08:00
JKQTPRGBMathImageRGBMode rgbMode ;
/** \brief top color bar visible */
bool colorBarTopVisible ;
/** \brief right color bar visible */
bool colorBarRightVisible ;
2019-04-22 19:27:50 +08:00
/** \brief name of the red image channel displayed above color bar (may contain LaTeX markup!) */
QString imageNameR ;
/** \brief name of the green image channel displayed above color bar (may contain LaTeX markup!) */
2019-02-08 00:24:46 +08:00
QString imageNameG ;
2019-04-22 19:27:50 +08:00
/** \brief name of the blue image channel displayed above color bar (may contain LaTeX markup!) */
2019-02-08 00:24:46 +08:00
QString imageNameB ;
/** \brief font name when displaying imageName */
QString imageNameFontName ;
/** \brief font size in points when displaying imageName */
double imageNameFontSize ;
/** \brief indicate whether to display a color bar */
bool showColorBar ;
/** \brief width of the color bar */
int colorBarWidth ;
/** \brief height of the color bar, as multiple of plotHeight */
double colorBarRelativeHeight ;
/** \brief indicates whether to estimate min/max of the image automatically */
bool autoImageRange ;
2019-04-22 19:27:50 +08:00
/** \brief red image value range minimum */
double imageMinR ;
/** \brief red image value range maximum */
double imageMaxR ;
/** \brief green image value range minimum */
2019-02-08 00:24:46 +08:00
double imageMinG ;
2019-04-22 19:27:50 +08:00
/** \brief green image value range maximum */
2019-02-08 00:24:46 +08:00
double imageMaxG ;
2019-04-22 19:27:50 +08:00
/** \brief blue image value range minimum */
2019-02-08 00:24:46 +08:00
double imageMinB ;
2019-04-22 19:27:50 +08:00
/** \brief blue image value range maximum */
2019-02-08 00:24:46 +08:00
double imageMaxB ;
/** \brief offset between outside space border and color bar */
int colorBarOffset ;
/** \brief if \c true the different color bars share the space of a single color bar, if set \c false each colorbar uses the space of a single colorbar */
bool colorbarsSideBySide ;
2019-05-19 22:40:02 +08:00
/** \brief object used for color bar axes (right border, red image data)
2019-02-08 00:24:46 +08:00
*
* \ note this axis has some kind of a special role . It is used to format color bar axes
*/
JKQTPVerticalIndependentAxis * colorBarRightAxis ;
2019-05-19 22:40:02 +08:00
/** \brief object used for color bar axes (top border, red image data)
*
* \ note this axis has some kind of a special role . It is used to format color bar axes
*/
2019-02-08 00:24:46 +08:00
JKQTPHorizontalIndependentAxis * colorBarTopAxis ;
2019-05-19 22:40:02 +08:00
/** \brief object used for color bar axes (right border, green image data)
*
* \ note this axis has some kind of a special role . It is used to format color bar axes
*/
2019-02-08 00:24:46 +08:00
JKQTPVerticalIndependentAxis * colorBarRightAxisG ;
2019-05-19 22:40:02 +08:00
/** \brief object used for color bar axes (top border, green image data)
*
* \ note this axis has some kind of a special role . It is used to format color bar axes
*/
2019-02-08 00:24:46 +08:00
JKQTPHorizontalIndependentAxis * colorBarTopAxisG ;
2019-05-19 22:40:02 +08:00
/** \brief object used for color bar axes (right border, blue image data)
*
* \ note this axis has some kind of a special role . It is used to format color bar axes
*/
2019-02-08 00:24:46 +08:00
JKQTPVerticalIndependentAxis * colorBarRightAxisB ;
2019-05-19 22:40:02 +08:00
/** \brief object used for color bar axes (top border, blue image data)
*
* \ note this axis has some kind of a special role . It is used to format color bar axes
*/
2019-02-08 00:24:46 +08:00
JKQTPHorizontalIndependentAxis * colorBarTopAxisB ;
2019-08-01 04:10:26 +08:00
/** \brief indicates whether to estimate min/max of the modifier automatically */
bool autoModifierRange ;
/** \brief modifier value range minimum */
double modifierMin ;
/** \brief modifier value range maximum */
double modifierMax ;
/** \brief width of the color bar when modifier is on */
double colorBarModifiedWidth ;
/** \brief how to apply the modifier column dataModifier
* \ see ModifierMode
*/
JKQTPMathImageModifierMode modifierMode ;
2019-02-08 00:24:46 +08:00
2019-08-01 04:10:26 +08:00
/** \brief object used for color bar axes (right border, modifier image data)
*
* \ note this axis has some kind of a special role . It is used to format color bar axes
*/
JKQTPVerticalIndependentAxis * modifierColorBarTopAxis ;
/** \brief object used for color bar axes (top border, modifier image data)
*
* \ note this axis has some kind of a special role . It is used to format color bar axes
*/
JKQTPHorizontalIndependentAxis * modifierColorBarRightAxis ;
2019-02-08 00:24:46 +08:00
2019-05-19 22:40:02 +08:00
/** \brief internal storage for minimum of the green image value range
*
* This is set e . g . when calling drawImage ( ) or draw ( )
*/
2019-02-08 00:24:46 +08:00
double internalDataMinG ;
2019-05-19 22:40:02 +08:00
/** \brief internal storage for maximum of the green image value range
*
* This is set e . g . when calling drawImage ( ) or draw ( )
*/
2019-02-08 00:24:46 +08:00
double internalDataMaxG ;
2019-05-19 22:40:02 +08:00
/** \brief internal storage for minimum of the blue image value range
*
* This is set e . g . when calling drawImage ( ) or draw ( )
*/
2019-02-08 00:24:46 +08:00
double internalDataMinB ;
2019-05-19 22:40:02 +08:00
/** \brief internal storage for maximum of the blue image value range
*
* This is set e . g . when calling drawImage ( ) or draw ( )
*/
2019-02-08 00:24:46 +08:00
double internalDataMaxB ;
protected :
2019-04-22 19:27:50 +08:00
/** \brief action that calls saveImagePlotAsImage() */
2019-02-08 00:24:46 +08:00
QAction * actSaveImage ;
2019-04-22 19:27:50 +08:00
/** \brief action that calls copyImagePlotAsImage() */
2019-02-08 00:24:46 +08:00
QAction * actCopyImage ;
public :
2019-04-22 19:27:50 +08:00
/** \copydoc JKQTPImageBase::setTitle() */
2019-02-08 00:24:46 +08:00
virtual void setTitle ( const QString & title ) override ;
public slots :
2019-04-22 19:27:50 +08:00
/** \brief save the plotted image as a file with \a filename and format \a outputFormat */
2019-02-08 00:24:46 +08:00
void saveImagePlotAsImage ( const QString & filename = QString ( " " ) , const QByteArray & outputFormat = QByteArray ( ) ) ;
2019-04-22 19:27:50 +08:00
/** \brief copy the plotted image as an image into the clipboard */
2019-02-08 00:24:46 +08:00
void copyImagePlotAsImage ( ) ;
} ;
/*! \brief like JKQTPRGBMathImage but reads images from columns of the datastore
\ ingroup jkqtplotter_imagelots_elements
\ image html rgbimageplots . png
2019-02-10 05:17:01 +08:00
2019-06-21 04:24:47 +08:00
\ image html rgbimageplot_opencv . png
2019-02-10 05:17:01 +08:00
2019-06-21 04:24:47 +08:00
\ image html rgbimageplot . png
2019-02-10 05:17:01 +08:00
\ see Examples : \ ref JKQTPlotterRGBImagePlot and \ ref JKQTPlotterImagePlotRGBOpenCV
2019-02-08 00:24:46 +08:00
*/
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPColumnRGBMathImage : public JKQTPRGBMathImage {
2019-02-08 00:24:46 +08:00
Q_OBJECT
public :
2019-05-19 22:40:02 +08:00
/** \brief class constructor
*
* \ param parent parent plotter object
*/
2019-02-08 00:24:46 +08:00
JKQTPColumnRGBMathImage ( JKQTBasePlotter * parent = nullptr ) ;
2019-05-19 22:40:02 +08:00
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param parent parent plotter object
*
*/
JKQTPColumnRGBMathImage ( double x , double y , double width , double height , JKQTBasePlotter * parent = nullptr ) ;
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param imageRColumn column for red channel to be plotted
* \ param parent parent plotter object
*
*/
JKQTPColumnRGBMathImage ( double x , double y , double width , double height , int imageRColumn , JKQTBasePlotter * parent = nullptr ) ;
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param imageRColumn column for red channel to be plotted
* \ param imageGColumn column for green channel to be plotted
* \ param parent parent plotter object
*
*/
JKQTPColumnRGBMathImage ( double x , double y , double width , double height , int imageRColumn , int imageGColumn , JKQTBasePlotter * parent = nullptr ) ;
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param imageRColumn column for red channel to be plotted
* \ param imageGColumn column for green channel to be plotted
* \ param imageBColumn column for blue channel to be plotted
* \ param parent parent plotter object
*
*/
JKQTPColumnRGBMathImage ( double x , double y , double width , double height , int imageRColumn , int imageGColumn , int imageBColumn , JKQTBasePlotter * parent = nullptr ) ;
/** \brief class constructor
*
* \ param parent parent plotter object
*/
2019-02-08 00:24:46 +08:00
JKQTPColumnRGBMathImage ( JKQTPlotter * parent ) ;
2019-05-19 22:40:02 +08:00
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param parent parent plotter object
*
*/
JKQTPColumnRGBMathImage ( double x , double y , double width , double height , JKQTPlotter * parent ) ;
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param imageRColumn column for red channel to be plotted
* \ param parent parent plotter object
*
*/
JKQTPColumnRGBMathImage ( double x , double y , double width , double height , int imageRColumn , JKQTPlotter * parent ) ;
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param imageRColumn column for red channel to be plotted
* \ param imageGColumn column for green channel to be plotted
* \ param parent parent plotter object
*
*/
JKQTPColumnRGBMathImage ( double x , double y , double width , double height , int imageRColumn , int imageGColumn , JKQTPlotter * parent ) ;
/** \brief class constructor
*
* \ param x origin of the image ( x - direction ) in system coordinates
* \ param y origin of the image ( y - direction ) in system coordinates
* \ param width width of the image in system coordinates
* \ param height height of the image in system coordinates
* \ param imageRColumn column for red channel to be plotted
* \ param imageGColumn column for green channel to be plotted
* \ param imageBColumn column for blue channel to be plotted
* \ param parent parent plotter object
*
*/
JKQTPColumnRGBMathImage ( double x , double y , double width , double height , int imageRColumn , int imageGColumn , int imageBColumn , JKQTPlotter * parent ) ;
2019-02-08 00:24:46 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc imageRColumn */
2019-04-22 19:27:50 +08:00
virtual void setImageRColumn ( int __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageRColumn */
2019-04-22 19:27:50 +08:00
int getImageRColumn ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageGColumn */
2019-04-22 19:27:50 +08:00
virtual void setImageGColumn ( int __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageGColumn */
2019-04-22 19:27:50 +08:00
int getImageGColumn ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageBColumn */
2019-04-22 19:27:50 +08:00
virtual void setImageBColumn ( int __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc imageBColumn */
2019-04-22 19:27:50 +08:00
int getImageBColumn ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierColumn */
2019-04-22 19:27:50 +08:00
virtual void setModifierColumn ( int __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc modifierColumn */
2019-04-22 19:27:50 +08:00
int getModifierColumn ( ) const ;
2019-02-08 00:24:46 +08:00
/** \copydoc JKQTPGraph::usesColumn() */
virtual bool usesColumn ( int c ) const override ;
protected :
/** \brief image column for R channel */
int imageRColumn ;
/** \brief image column for G channel */
int imageGColumn ;
/** \brief image column for B channel */
int imageBColumn ;
/** \brief column containing the modifier image */
int modifierColumn ;
2019-05-19 22:40:02 +08:00
/** \copydoc JKQTPRGBMathImage::ensureImageData() */
2019-02-08 00:24:46 +08:00
void ensureImageData ( ) override ;
2019-05-19 22:40:02 +08:00
private :
using JKQTPRGBMathImage : : setData ;
using JKQTPRGBMathImage : : setDatatype ;
using JKQTPRGBMathImage : : setDataR ;
using JKQTPRGBMathImage : : setDatatypeR ;
using JKQTPRGBMathImage : : setDataG ;
using JKQTPRGBMathImage : : setDatatypeG ;
using JKQTPRGBMathImage : : setDataB ;
using JKQTPRGBMathImage : : setDatatypeB ;
using JKQTPRGBMathImage : : setDataModifier ;
using JKQTPRGBMathImage : : setDatatypeModifier ;
2019-02-08 00:24:46 +08:00
} ;
# endif // JKQTPGRAPHSIMAGERGB_H