Professional Documents
Culture Documents
A. Costa 2013
VTK & QT
You must turn on the following options in the advanced VTK
build configuration:
• Follow the link:
• http://www.vtk.org/Wiki/VTK/Tutorials/QtSetup
• hello.cpp
• hello.h
• main.cpp
Qmake the .pro file
hello.pro file
*************
CONFIG += qt
HEADERS += hello.h
Variables
SOURCES += hello.cpp \
main.cpp
*************
*************
CONFIG += qt debug
HEADERS += hello.h
SOURCES = hello.cpp \
main.cpp
*************
Adding Platform-Specific Source Files
*******************
win32 {
SOURCES += hellowin.cpp
}
***********************
Boolean expressions:
***********************
!exists( main.cpp ) {
error( "No main.cpp file found" )
}
***********************
Common Projects
• Application
• Library
• Plugin
The app template
TEMPLATE = app
TEMPLATE = lib
FIND_PACKAGE(Qt4 REQUIRED)
FIND_PACKAGE(VTK)
INCLUDE(${VTK_USE_FILE})
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR} )
QT4_WRAP_CPP(MOCSrcs ${VTKScratchesHeaders} )
QT4_WRAP_UI(UISrcs ${VTKScratchesUI})
CMake
Finally, CMake needs to know the name of the resulting executable and what to
link it to.
return app.exec();
}
VTKScratches.h
#ifndef VTKScratches_H
#define VTKScratches_H
#include <vtkSmartPointer.h>
#include <QMainWindow>
#include "MainPanel.h"
class Ui_VTKScratches;
class VTKScratches : public QMainWindow
{
Q_OBJECT
public:
// Constructor/Destructor
VTKScratches();
~VTKScratches();
void addMainPanel();
public slots:
void on_actionAbout_triggered();
void on_actionExit_2_triggered();
private:
Ui_VTKScratches *ui;
MainPanel* m_mainPanel;
};
#endif
What is VTK
• Data-flow driven paradigm
Implicit Objects:
Data
Filter 1 Actor
Data
It is the visualized
windows RenderWindow
Mapper
It gives the
RenderWindowInteractor
interactivity
Actor
VTK Memory Management
• One way to create a VTK object is
• http://www.vtk.org/Wiki/Smart_Pointers