VideoVis  0.9
Generates a volume visualisation of a video
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
GLWidget Class Reference

This class loads video files and renders a volume visualisation using OpenGL 3.3. More...

#include <glwidget.h>

Inheritance diagram for GLWidget:

Public Member Functions

 GLWidget (QWidget *parent=0)
 This is the default constructor. More...
 
 ~GLWidget ()
 This is the default destructor. More...
 
QSize minimumSizeHint () const
 
QSize sizeHint () const
 
VFLResult openVideoFile (const QString &videoFilePath, int *hRes, int *vRes)
 Opens a video file. More...
 
VFLResult loadVideoFile (int startFrame, int stepSize, int endFrame)
 Loads the currently open video file and displays it. More...
 
int getFrameCount ()
 Returns the number of frames that have been loaded. More...
 
void setFrameOffset (int frameOffset)
 Changes the offset of the displayed video. More...
 
void setStyle (bool horseShoeView)
 Sets the style of the displayed video volume. More...
 
void setBoxSize (int boxSize)
 Sets the scale factor of the volume box in z-Direction. More...
 
void setStepSize (float stepSize)
 Sets the stepsize used by the ray casting algorithm. More...
 
void setMetric (VVMetric metric)
 Sets the used metric. More...
 
void setTransferFunction (GLfloat *tfArray, int arraySize)
 Sets the used transfer function. More...
 

Protected Member Functions

void initializeGL ()
 
void paintGL ()
 
void resizeGL (int width, int height)
 
void mouseMoveEvent (QMouseEvent *event)
 
void mousePressEvent (QMouseEvent *event)
 
void mouseReleaseEvent (QMouseEvent *event)
 
void wheelEvent (QWheelEvent *event)
 

Protected Attributes

PFNGLGENVERTEXARRAYSPROC glGenVertexArrays
 
PFNGLBINDVERTEXARRAYPROC glBindVertexArray
 
PFNGLTEXIMAGE3DPROC glTexImage3D
 

Detailed Description

This class loads video files and renders a volume visualisation using OpenGL 3.3.

The volume visualisation is constructed using a ray casting algorithm written in GLSL. The result can be modiefied using the following methods. It is derived from QGLWidget and QOpenGLFunctions and should be inserted as a widget into a QT program.

Definition at line 36 of file glwidget.h.

Constructor & Destructor Documentation

GLWidget::GLWidget ( QWidget *  parent = 0)

This is the default constructor.

QT uses this constructor of you put the widget into a Qt designer form

Parameters
parenta pointer to the parent widget

Definition at line 9 of file glwidget.cpp.

GLWidget::~GLWidget ( )

This is the default destructor.

Definition at line 65 of file glwidget.cpp.

Member Function Documentation

int GLWidget::getFrameCount ( )

Returns the number of frames that have been loaded.

Returns
an integer with the number of frames that have been loaded
See Also
openVideoFile(const QString& videoFilePath, int *hRes, int *vRes), loadVideoFile(int startFrame, int stepSize, int endFrame)

Definition at line 418 of file glwidget.cpp.

void GLWidget::initializeGL ( )
protected

Definition at line 84 of file glwidget.cpp.

VFLResult GLWidget::loadVideoFile ( int  startFrame,
int  stepSize,
int  endFrame 
)

Loads the currently open video file and displays it.

The video file is loaded into a 3D Texture. This method can also be called to reload the file. When this method is called the old video data is deleted.

Parameters
startFrameinteger that specifies the first frame to load (starting with 1)
stepSizeinteger that specifies the steps between frames (starting with 1)
endFrameinteger that specifies the last frame, if 0 the method tries to load all frames in the file
Returns
returns VFL_OK if the operation completed successfully
See Also
openVideoFile(const QString& videoFilePath, int *hRes, int *vRes)

Definition at line 218 of file glwidget.cpp.

QSize GLWidget::minimumSizeHint ( ) const

Definition at line 76 of file glwidget.cpp.

void GLWidget::mouseMoveEvent ( QMouseEvent *  event)
protected

Definition at line 638 of file glwidget.cpp.

void GLWidget::mousePressEvent ( QMouseEvent *  event)
protected

Definition at line 611 of file glwidget.cpp.

void GLWidget::mouseReleaseEvent ( QMouseEvent *  event)
protected

Definition at line 622 of file glwidget.cpp.

VFLResult GLWidget::openVideoFile ( const QString &  videoFilePath,
int *  hRes,
int *  vRes 
)

Opens a video file.

The video file should be in a format, that is readable by a codec installed on the target machine. The widget is using the custom CVideoFrameToTextureLoader class to open the video file. It can also be called to change to video file.

Parameters
videoFilePatha QString containing the path to the video file in windows format
hResa pointer to an integer receiving the horizontal resolution of the loaded video
vResa pointer to an integer receiving the vertical resolution of the loaded video
Returns
returns VFL_OK if the operation completed successfully
See Also
loadVideoFile(int startFrame, int stepSize, int endFrame)

Definition at line 194 of file glwidget.cpp.

void GLWidget::paintGL ( )
protected

Definition at line 151 of file glwidget.cpp.

void GLWidget::resizeGL ( int  width,
int  height 
)
protected

Definition at line 184 of file glwidget.cpp.

void GLWidget::setBoxSize ( int  boxSize)

Sets the scale factor of the volume box in z-Direction.

This value is saved regardless of the set style. When the box style is chosen, the change becomes visible. Nonetheless, the method initiates a redraw

Parameters
boxSizean integer specifying the scale factor
See Also
setStyle(bool horseShoeView)

Definition at line 702 of file glwidget.cpp.

void GLWidget::setFrameOffset ( int  frameOffset)

Changes the offset of the displayed video.

The frame offset changes the first frame that is visible on the bounding value. All other frames are rotated accordingly. When the frame offset is set, a redraw is initiated.

Parameters
frameOffsetinteger that specifies the start frame (starts at 0)

Definition at line 430 of file glwidget.cpp.

void GLWidget::setMetric ( VVMetric  metric)

Sets the used metric.

The avaliable metrices are VV_METRIC_NONE, VV_METRIC_YDIF, VV_METRIC_YMSE, VV_METRIC_YNDIF, VV_METRIC_YNMSE or VV_METRIC_IQDIF. Depending on the metric and if it's shown first the method can take a long time to calculate the neccessary prerequisits for the volume visualisation. This method initiates a redraw.

Parameters
metricVVMetric value that specifies the desired metric

Definition at line 709 of file glwidget.cpp.

void GLWidget::setStepSize ( float  stepSize)

Sets the stepsize used by the ray casting algorithm.

Use this method with caution. Very small values can overtax the graphics card easyly. This method initiates a redraw.

Parameters
stepSizefloat value specifying the step size (0 < stepSize < 1)

Definition at line 696 of file glwidget.cpp.

void GLWidget::setStyle ( bool  horseShoeView)

Sets the style of the displayed video volume.

There are only two options. Horse show view or block view. When this method is called, a redraw is initiated.

Parameters
horseShoeViewboolean that specifies the style; if true the horse shoe view is selected, block view is otherwise chosen
See Also
setBoxSize(int boxSize)

Definition at line 437 of file glwidget.cpp.

void GLWidget::setTransferFunction ( GLfloat *  tfArray,
int  arraySize 
)

Sets the used transfer function.

This parameter has to be set to get any good result. The transfer function must be an evenly spaced aray of 4 component float vectors. The components are RGBA. The values are distributed over the luminace axis and specify, the opacity (A) over the complete range of the luminace. For all the metrics accept VV_METRIC_NONE the color values are also used to define the color of the voxels with this luminance. The vectors in between are interpolated.

Parameters
tfArraypointer to a float array
arraySizenumber of 4-component float vectors
See Also
setMetric(VVMetric metric)

Definition at line 771 of file glwidget.cpp.

QSize GLWidget::sizeHint ( ) const

Definition at line 79 of file glwidget.cpp.

void GLWidget::wheelEvent ( QWheelEvent *  event)
protected

Definition at line 630 of file glwidget.cpp.

Member Data Documentation

PFNGLBINDVERTEXARRAYPROC GLWidget::glBindVertexArray
protected

Definition at line 150 of file glwidget.h.

PFNGLGENVERTEXARRAYSPROC GLWidget::glGenVertexArrays
protected

Definition at line 149 of file glwidget.h.

PFNGLTEXIMAGE3DPROC GLWidget::glTexImage3D
protected

Definition at line 151 of file glwidget.h.


The documentation for this class was generated from the following files: