[IGSTK-Users] Display my first object with QT

Özgür Güler ozgur_guler at gmx.at
Mon Dec 16 18:39:37 EST 2013


Hi Steve,

you have to build also the scene graph, which describes the spatial
relationship between the objects in your scene. In your case it contains
just a cube and the view.

//identity transform
igstk::Transform transform;
transform.SetToIdentity( igstk::TimeStamp::GetLongestPossibleTime() );

// scene graph
// view3D->cube
cube->RequestSetTransformAndParent( transform, view3D );

Best,
Ozgur

On Fri, Dec 13, 2013 at 10:51 AM, <steve.berger at istb.unibe.ch> wrote:
> Hi,
>
> I'm starting to use IGSTK and try to simply display a cube in the QT's
main
> windows. My code is very basic and compile, the window pop-up but nothing
is
> displayed in the windows (it's only gray).
> Could anyone give me a clue? I'm puzzled with that from 3 days...
>
> Bellow are my codes, and the software versions I am using.
>
> Thanks a lot for your support,
> Cheers,
> Steve
>
>
>
> The main:
> int main(int argc, char *argv[])
> {
> QApplication app(argc,argv);
>
> MainWindow w;
> w.show();
>
> return app.exec();
> }
>
>
>
> The MainWindow.h:
>
> #ifndef MAINWINDOW_H
> #define MAINWINDOW_H
> #include <QtGui>
> #include "igstkBoxObject.h"
> #include "igstkBoxObjectRepresentation.h"
> #include "igstkView3D.h"
> #include "igstkQTWidget.h"
>
> class MainWindow : public QMainWindow
> {
> public:
> MainWindow();
>
> };
> #endif
>
>
>
>
> The MainWindow.cpp
>
> #include "MainWindow.h"
> MainWindow::MainWindow()
> {
> //initialize the RealTimeClock.
> igstk::RealTimeClock::Initialize();
>
> // Create the box
> typedef igstk::BoxObject ObjectType;
> typedef igstk::BoxObjectRepresentation ObjectRepresentationType;
> ObjectType::Pointer cube = ObjectType::New();
> ObjectRepresentationType::Pointer cubeRepresentation =
> ObjectRepresentationType::New();
> cubeRepresentation->SetColor( 0.0, 0.0, 1.0 );
> cubeRepresentation->SetOpacity( 1.0 );
> cubeRepresentation->RequestSetBoxObject(cube);
>
> // View 3D
> typedef igstk::View3D View3DType;
> View3DType::Pointer view3D = View3DType::New();
> view3D->RequestResetCamera();
> view3D->RequestAddObject( cubeRepresentation );
> view3D->SetRefreshRate( 30 );
> view3D->RequestStart();
>
> //QT Widget
> igstk::QTWidget * myQTWidget = new igstk::QTWidget();
> myQTWidget->RequestSetView( view3D );
> setCentralWidget( myQTWidget );
> }
>
>
> The software versions:
> QT 4.8.5
> ITK 4.4.2
> VTK 5.10.1
> IGSTK 5.2
>
> During the installation of VTK, I checked
> VTK_USE_QT ON
> VTK_USE_QTCHARTS ON
> VTK_USE_RENDERING ON
>
> During installation of IGSTK, I checked
> IGSTK_USE_Qt ON
> DESIRED_QT_VERSION 4
> QT_QMAKE_EXECUTABLE /usr/local/Trolltech/Qt-4.8.5/bin/qmake
>
>
>
> Thanks a lot for your help!
> Steve
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users

-- 
*********************************************************************
Dr. Dipl.-Ing. Özgür Güler, Bakk. techn. PhD
Research Assistant
4D-Visualization Laboratory
Univ. ENT Clinic
Innsbruck Medical University
Anichstr. 35, A-6020 Innsbruck, Austria

tel.: +43 512 504 23428, fax.: +43 512 504 25231

voxelmaster.eu
www.gueler.at
*********************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20131216/a818ca42/attachment.html>


More information about the IGSTK-Users mailing list