[Insight-users] Connecting ITK to VTK in Java

S Schrem sschrem at yahoo.com
Wed Sep 15 14:14:56 EDT 2004


Hello,

About connecting ITK to VTK in Java.

I'm having problems hooking up the output of an ITK
filter to a VTK filter using Java.
I am an ITK newbie but a veteran VTK-Java user.

I have done the following (under Windows XP, VS .Net,
Java 1.4.2):

Built VTK 4.4 with Java wrapping.
Built ITK 1.8 with Java Wrapping.
   Some advice for building ITK 1.8 for Java:
      - Part of the build process is sensitive to long
path names. Keep them short or it will fail.
      - CMake scripts assume that the 'classpath'
environment variable is defined and will fail if
undefined.

Built a Java class that connects ITK->VTK via native
calls
Built a JNI-compatible C++ class that performs
ITK->VTK connection for Unsigned Charx2 via callbacks
(e.g.
pVTKImageImport->SetUpdateInformationCallback(pITK_VTKImageExport->GetUpdateInformationCallback());...)

Built a Java-VTK test app that uses a vtkImageActor in
a vtkRenderer in vtkRenderWindow with a
vtkRenderWindowInteractor (copied from a VTK tutorial
for simplicity).

It works, although it seems fragile in that it is very
sensitive to the lifetime of the itk object referenced
directly by my jni code (e.g.
itkVTKImageExportUC2_Pointer). This manifests itself
by the following stack dump:
My current workaround is to declare the itk object as
static in the java code.

Has someone written a stable ITK to VTK connection in
Java?
Are there guidelines as to how a JNI based java class
needs to reference C++ itk instances?


Thank you,
Serge Schremmer



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


More information about the Insight-users mailing list