한국어
Qt
 

VTK(Visualization Toolkit)는 과학 데이터를 조작하고 표시하기 위해 널리 사용되는 오픈소스 소프트웨어 시각화 툴킷이다. 3D 렌더링을 위한 도구 및 상호 작용을 위한 3D위젯과 광범위한 2D 플로팅 기능이 함께 제공된다. Qt 에도 이미 훌륭한 시각화 및 차트 모듈이 있지만 조금 더 활용 폭이 넓은 시각화 툴킷의 대안으로 사용할 수 있다.

Linux, Windows 및 Mac을 포함한 거의 모든 곳에서 실행되고 BSD 스타일 라이선스로 사용할 수 있어서 공개 및 비공개 소스 응용 프로그램 모두에서 어떤 용도로든 자유롭게 사용할 수 있다.

Qt 응용프로그램에서 VTK를 사용할 수 있게하는 것은 QVTKRenderWidget 클래스에 의해 가능하다. 이 타입은 QVTKOpenGLNativeWidget 의 별칭으로 이 클래스는 vtkGenericOpenGLRenderWindow 와 함께 작동하도록 QOpenGLWidget 을 확장한 것이다.
QVTKOpenGLNativeWidget 이 QOpenGLWidget 을 사용하여 OpenGL 컨텍스트를 생성하기 때문에 QSurfaceFormat(QOpenGLWidget::setFormat 또는 QSurfaceFormat::setDefaultFormat)을 사용하면 적절한 창과 컨텍스트를 생성할 수 있다.

QVTKOpenGLNativeWidget의 일반적인 사용법은 다음과 같다.

// before initializing QApplication, set the default surface format.
QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
 
vtkNew<vtkGenericOpenGLRenderWindow> window;
QPointer<QVTKOpenGLNativeWidget> widget = new QVTKOpenGLNativeWidget(...);
widget->SetRenderWindow(window.Get());
 
// If using any of the standard view e.g. vtkContextView, then
// you can do the following.
vtkNew<vtkContextView> view;
view->SetRenderWindow(window.Get());
 
// You can continue to use `window` as a regular vtkRenderWindow
// including adding renderers, actors etc.

vtkGenericOpenGLRenderWindow는 플랫폼 독립 렌더 창으로 자신의 OpenGL 컨텍스트와 드로어블을 사용하여 렌더 창 구현을 제공한다.

classvtkGenericOpenGLRenderWindow_inherit_graph.png

QVTKOpenGLWindow는 Qt 응용 프로그램에서 VTK 렌더링 결과를 표시하는 메커니즘 중 하나다. QVTKOpenGLWindow는 QOpenGLWindow를 확장하여 vtkGenericOpenGLRenderWindow의 렌더링 결과를 표시한다.
QVTKOpenGLWindow는 QOpenGLWindow를 기반으로 하여 최상위 창에서 렌더링하기 위한 것이다.

classQVTKOpenGLWindow_coll_graph.png

Qt의 다양한 위젯을 통해 사용자 인터페이스를 구성하여 프로그램에 포괄적인 사용자 인터랙션을 추가할 수 있다.

SurfacePlotQt.png

 

예제 프로젝트: SurfacePlotQt.zip

VTK Git 저장소에서 소스코드를 가져올 수 있고 VTK 에서 제공하는 Qt 및 C++ 로 작성된 많은 예제는 유용하게 활용할 수 있다.

Qt 응용프로그램을 개발시 사용되는 클래스는 doxygen 문서 를 참고하자.