[vtkusers] generate 3D images from 2D bmp files in java

Rémi DUCCESCHI remi.ducceschi at gmail.com
Wed Jun 13 10:03:16 EDT 2012


Hello!

I'm trying since a few days to display a 3D image in a JFrame. I build this
image from bmp 2D files thanks to a vtkBMPReader.
I actually am using vtk 5.08 with java 6.32 on windows 7 32 bits.
The code below takes place in the constructor of a JFrame sublclass :

        reader = new vtkBMPReader();
        render = new vtkRenderer();

        // we open the pictures and we theorically create a 3D picture
        reader.SetFileNames(paths);
        reader.Update();

        // we put it in a mapper
        vtkPolyDataMapper mapper = new vtkPolyDataMapper();
        mapper.SetInputConnection(
reader.GetOutputPort());

        // and we put the mapper in an actor
        vtkActor actor = new vtkActor();
        actor.SetMapper(mapper);

        // finally, we put the actor in a renderer
        render.AddActor(actor);

        vtkRenderWindow renderW = new vtkRenderWindow();
        renderW.AddRenderer(render);
        vtkRenderWindowPanel panel = new vtkRenderWindowPanel(renderW);

// I'm doing this because the code below don't work neither
// panel.GetRenderer().AddActor(sphereActor);

        add(panel, BorderLayout.CENTER);

        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        pack();
        setVisible(true);

at the end, I want to display the 3D image in the JFrame, but all I get is
a crash from a dll. I think I'm not using the objects the right way, but
there is few documentation on java binding (and particularly on the
vtkRenderWindowPane).
The code in this example works fine :
http://julian-ibarz.developpez.com/tutoriels/jeux/introduction-VTK/#LII-E

Thank you for your help! I can send you my source files or the log of the
errors if you want.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120613/f6397d86/attachment.htm>


More information about the vtkusers mailing list