Commit 895c90d5 authored by SZPYRKA Jean-Luc's avatar SZPYRKA Jean-Luc

Merge branch 'release/2.3.0'

parents 8d8c5ff7 0d02dba0
# Change Log:
## 2.3.0 17-Oct-2018
- Add a GL video view (GLSL 1.2)
- Add a Raster video view
- Implement corresponding examples
## 2.2.2 9-Oct-2018
- Specify the vtk opengl format directly in the objects
......
......@@ -23,8 +23,8 @@ project(dtkVisualization)
## ###################################################################
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 2)
set(${PROJECT_NAME}_VERSION_PATCH 2)
set(${PROJECT_NAME}_VERSION_MINOR 3)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......@@ -62,6 +62,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-deprecated-declarations")
## ###################################################################
## Dependencies - cmake
## ###################################################################
......@@ -74,7 +76,7 @@ include(GenerateExportHeader)
find_package(VTK REQUIRED)
find_package(Qt5 COMPONENTS Core Widgets OpenGL Xml REQUIRED)
find_package(Qt5 COMPONENTS Core Widgets OpenGL Xml Multimedia MultimediaWidgets REQUIRED)
find_package(dtkFonts 2.0.0 REQUIRED)
find_package(dtkWidgets 2.1.0 REQUIRED)
......
# dtk-visualization
`dtk-visualiazation` is a bridge between Qt and VTK and requires no additional dependency. Assuming VTK datasetsas an input it provides visualization option in a most intuitive way as possible. Therefore, few filters are used.
`dtk-visualization` is a bridge between Qt and VTK and requires no additional dependency. Assuming VTK datasets as an input it provides visualization option in a most intuitive way as possible. Therefore, few filters are used.
Its purpose is double:
- As a standalone viewer through its `dtkVisualizationViewer` application, it is a quick and lightweight alternative to ParaView
- As a set of layer, it is intended to be injected in many application to have a maintained, efficient and robust visualization system
......@@ -35,7 +35,7 @@ if(APPLE)
set(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES} dtkVisualizationViewer.mm)
endif(APPLE)
set(${PROJECT_NAME}_SOURCES_RCC dtkVisualizationViewer.qrc)
set(${PROJECT_NAME}_SOURCES_QRC dtkVisualizationViewer.qrc)
set_property(SOURCE qrc_dtkVisualizationViewer.cpp PROPERTY SKIP_AUTOMOC ON)
......@@ -43,10 +43,10 @@ set_property(SOURCE qrc_dtkVisualizationViewer.cpp PROPERTY SKIP_AUTOMOC ON)
## Build rules
## #################################################################
qt5_add_resources(${PROJECT_NAME}_SOURCES_QRC ${${PROJECT_NAME}_SOURCES_RCC})
qt5_add_resources(${PROJECT_NAME}_SOURCES_RCC ${${PROJECT_NAME}_SOURCES_QRC})
add_executable(${PROJECT_NAME} MACOSX_BUNDLE
${${PROJECT_NAME}_SOURCES_QRC}
${${PROJECT_NAME}_SOURCES_RCC}
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
......
......@@ -33,12 +33,12 @@ dtkVisualizationViewerStack::dtkVisualizationViewerStack(QWidget *parent) : QSta
d = new dtkVisualizationViewerStackPrivate;
d->layout = new dtkWidgetsLayout(this);
d->layout->setCreator(create);
d->settings = new dtkWidgetsSettings(this);
this->addWidget(d->layout);
this->addWidget(d->settings);
connect(d->layout, SIGNAL(create()), this, SLOT(create()));
}
dtkVisualizationViewerStack::~dtkVisualizationViewerStack(void)
......@@ -51,13 +51,11 @@ dtkWidgetsLayout *dtkVisualizationViewerStack::layout(void)
return d->layout;
}
void dtkVisualizationViewerStack::create(void)
dtkWidgetsWidget *dtkVisualizationViewerStack::create(const QString& name)
{
dtkVisualizationView3D *view = new dtkVisualizationView3D;
dtkWidgetsController::instance()->insert(view);
Q_UNUSED(name);
d->layout->current()->setView(view);
return new dtkVisualizationView3D;
}
void dtkVisualizationViewerStack::keyPressEvent(QKeyEvent *event)
......
......@@ -17,6 +17,7 @@
#include <QtWidgets>
class dtkWidgetsLayout;
class dtkWidgetsWidget;
class dtkVisualizationViewerStack : public QStackedWidget
{
......@@ -29,8 +30,8 @@ public:
public:
dtkWidgetsLayout *layout(void);
public slots:
void create(void);
public:
static dtkWidgetsWidget *create(const QString& name);
protected:
void keyPressEvent(QKeyEvent *);
......
......@@ -31,8 +31,6 @@ int main(int argc, char **argv)
qputenv("XDG_CURRENT_DESKTOP", "GNOME");
#endif
QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
QApplication application(argc, argv);
application.setApplicationName("dtkVisualizationViewer");
application.setOrganizationName("inria");
......
......@@ -17,6 +17,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/examples)
add_subdirectory(dtkVisualizationOverlayPaneItem)
add_subdirectory(dtkVisualizationOverlayRope)
add_subdirectory(dtkVisualizationPlot2D)
add_subdirectory(dtkVisualizationViewVideo)
add_subdirectory(dtkVisualizationViewVideoMixed)
######################################################################
### CMakeLists.txt ends here
## Version: $Id$
##
######################################################################
##
### Commentary:
##
######################################################################
##
### Change Log:
##
######################################################################
##
### Code:
project(dtkVisualizationViewVideo)
## #################################################################
## Sources
## #################################################################
set(${PROJECT_NAME}_SOURCES main.cpp)
## #################################################################
## Build rules
## #################################################################
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${${PROJECT_NAME}_SOURCES})
target_link_libraries(${PROJECT_NAME} Qt5::Core)
target_link_libraries(${PROJECT_NAME} Qt5::Gui)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} Qt5::OpenGL)
target_link_libraries(${PROJECT_NAME} Qt5::Multimedia)
target_link_libraries(${PROJECT_NAME} Qt5::MultimediaWidgets)
target_link_libraries(${PROJECT_NAME} dtkVisualization)
######################################################################
### CMakeLists.txt ends here
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include <QtCore>
#include <QtGui>
#include <QtWidgets>
#include <QtMultimedia>
#include <QtMultimediaWidgets>
#include <dtkVisualization>
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
class dummyWindow : public QFrame
{
Q_OBJECT
public:
dummyWindow(QWidget *parent = nullptr);
~dummyWindow(void);
public slots:
void update(int requestId, const QImage& img);
private:
QCamera *camera;
QCameraImageCapture *camera_capture;
private:
dtkVisualizationViewVideo *viev;
dtkVisualizationViewVideoGL *view;
dtkVisualizationViewVideoRaster *vieu;
};
dummyWindow::dummyWindow(QWidget *parent) : QFrame(parent)
{
this->camera = new QCamera(QCameraInfo::defaultCamera());
this->camera_capture = new QCameraImageCapture(this->camera);
this->vieu = new dtkVisualizationViewVideoRaster(this);
this->vieu->setTitle("Live stream Raster");
this->viev = new dtkVisualizationViewVideo(this);
this->viev->setTitle("Live stream GL < 2.1");
this->view = new dtkVisualizationViewVideoGL(this);
this->view->setTitle("Live stream GL = 2.1");
QCameraViewfinder *viewfinder = new QCameraViewfinder;
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->addWidget(this->vieu);
layout->addWidget(this->viev);
layout->addWidget(this->view);
connect(this->camera_capture, &QCameraImageCapture::imageCaptured, this, &dummyWindow::update);
this->camera->setViewfinder(viewfinder);
this->camera->setCaptureMode(QCamera::CaptureStillImage);
this->camera->start();
QTimer *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this->camera_capture, [=] (void) {
camera_capture->capture();
});
timer->start(1.0/15.0 * 1000);
}
dummyWindow::~dummyWindow(void)
{
}
void dummyWindow::update(int id, const QImage& image)
{
Q_UNUSED(id);
this->vieu->setImage(image);
this->viev->setImage(image);
this->view->setImage(image);
QFrame::update();
}
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
QSurfaceFormat format;
format.setRenderableType(QSurfaceFormat::OpenGL);
format.setVersion(2, 1);
format.setProfile(QSurfaceFormat::CoreProfile);
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
format.setSamples(32);
QSurfaceFormat::setDefaultFormat(format);
QApplication application(argc, argv);
dummyWindow *window = new dummyWindow;
window->resize(1000, 500);
window->show();
window->raise();
return application.exec();
}
// ///////////////////////////////////////////////////////////////////
#include <main.moc>
//
// main.cpp ends here
## Version: $Id$
##
######################################################################
##
### Commentary:
##
######################################################################
##
### Change Log:
##
######################################################################
##
### Code:
project(dtkVisualizationViewVideoMixed)
## #################################################################
## Sources
## #################################################################
set(${PROJECT_NAME}_SOURCES main.cpp)
## #################################################################
## Build rules
## #################################################################
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${${PROJECT_NAME}_SOURCES})
target_link_libraries(${PROJECT_NAME} Qt5::Core)
target_link_libraries(${PROJECT_NAME} Qt5::Gui)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} Qt5::OpenGL)
target_link_libraries(${PROJECT_NAME} Qt5::Multimedia)
target_link_libraries(${PROJECT_NAME} Qt5::MultimediaWidgets)
target_link_libraries(${PROJECT_NAME} dtkVisualization)
target_link_libraries(${PROJECT_NAME} ${VTK_LIBRARIES})
######################################################################
### CMakeLists.txt ends here
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include <QtCore>
#include <QtGui>
#include <QtWidgets>
#include <QtMultimedia>
#include <QtMultimediaWidgets>
#include <dtkVisualization>
#include <QVTKOpenGLWidget.h>
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
class dummyWindow : public QSplitter
{
Q_OBJECT
public:
dummyWindow(QWidget *parent = nullptr);
~dummyWindow(void);
public slots:
void update(int requestId, const QImage& img);
private:
QCamera *camera;
QCameraImageCapture *camera_capture;
private:
dtkVisualizationView3D *view_3;
dtkVisualizationViewVideoRaster *view_v;
};
dummyWindow::dummyWindow(QWidget *parent) : QSplitter(parent)
{
this->camera = new QCamera(QCameraInfo::defaultCamera());
this->camera_capture = new QCameraImageCapture(this->camera);
this->view_v = new dtkVisualizationViewVideoRaster(this);
this->view_v->setTitle("Live stream Raster Mixed with vtk");
this->view_v->resize(800, 400);
this->view_3 = new dtkVisualizationView3D(this);
QCameraViewfinder *viewfinder = new QCameraViewfinder;
this->setOrientation(Qt::Horizontal);
this->addWidget(this->view_v);
this->addWidget(this->view_3);
connect(this->camera_capture, &QCameraImageCapture::imageCaptured, this, &dummyWindow::update);
this->camera->setViewfinder(viewfinder);
this->camera->setCaptureMode(QCamera::CaptureStillImage);
this->camera->start();
QTimer *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this->camera_capture, [=] (void) {
camera_capture->capture();
});
timer->start(1.0/15.0 * 1000);
}
dummyWindow::~dummyWindow(void)
{
}
void dummyWindow::update(int id, const QImage& image)
{
Q_UNUSED(id);
this->view_v->setImage(image);
QFrame::update();
}
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
QApplication application(argc, argv);
dummyWindow *window = new dummyWindow;
window->resize(1000, 500);
window->show();
window->raise();
return application.exec();
}
// ///////////////////////////////////////////////////////////////////
#include <main.moc>
//
// main.cpp ends here
......@@ -29,20 +29,36 @@ set(${PROJECT_NAME}_HEADERS
dtkVisualizationView2D
dtkVisualizationView2D.h
dtkVisualizationView3D
dtkVisualizationView3D.h)
dtkVisualizationView3D.h
dtkVisualizationViewVideo
dtkVisualizationViewVideo.h
dtkVisualizationViewVideoGL
dtkVisualizationViewVideoGL.h
dtkVisualizationViewVideoRaster
dtkVisualizationViewVideoRaster.h)
set(${PROJECT_NAME}_SOURCES
dtkVisualizationActor.cpp
dtkVisualizationPlot2D.cpp
dtkVisualizationPlot3D.cpp
dtkVisualizationView2D.cpp
dtkVisualizationView3D.cpp)
dtkVisualizationView3D.cpp
dtkVisualizationViewVideo.cpp
dtkVisualizationViewVideoGL.cpp
dtkVisualizationViewVideoRaster.cpp)
set(${PROJECT_NAME}_SOURCES_QRC dtkVisualization.qrc)
set_property(SOURCE qrc_dtkVisualization.cpp PROPERTY SKIP_AUTOMOC ON)
## #################################################################
## Build rules
## #################################################################
qt5_add_resources(${PROJECT_NAME}_SOURCES_RCC ${${PROJECT_NAME}_SOURCES_QRC})
add_library(${PROJECT_NAME} SHARED
${${PROJECT_NAME}_SOURCES_RCC}
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
......@@ -57,6 +73,10 @@ target_link_libraries(${PROJECT_NAME} dtkVisualizationWidgets)
target_link_libraries(${PROJECT_NAME} ${VTK_LIBRARIES})
if(APPLE)
target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
endif(APPLE)
## #################################################################
## Target properties
## #################################################################
......@@ -67,7 +87,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTA
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION}
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR})
## #################################################################
## Export header file
## #################################################################
......
......@@ -3,3 +3,6 @@
#include "dtkVisualizationPlot3D.h"
#include "dtkVisualizationView2D.h"
#include "dtkVisualizationView3D.h"
#include "dtkVisualizationViewVideo.h"
#include "dtkVisualizationViewVideoGL.h"
#include "dtkVisualizationViewVideoRaster.h"
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="">
<file>dtkVisualizationViewVideoGL.vert</file>
<file>dtkVisualizationViewVideoGL.frag</file>
</qresource>
</RCC>
#include "dtkVisualizationViewVideo.h"
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkVisualizationViewVideo.h"
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
class dtkVisualizationViewVideoPrivate : public QOpenGLWidget, protected QOpenGLFunctions
{
public:
dtkVisualizationViewVideoPrivate(QWidget *parent = nullptr);
public:
void initializeGL(void);
void paintGL(void);
void resizeGL(int, int);
public:
void recalculatePosition(void);
void renderImage(void);
void updateScene(void);
public:
QImage render_image;
QImage resize_image;
public:
float image_ratio;
public:
int render_width;
int render_height;
int render_x;
int render_y;
public:
QString title;
};