[Insight-users] Redirect OutputWindow in Java?
Aron Helser
helser at 3rdtech.com
Tue Mar 4 09:17:14 EST 2008
I've come to the conclusion that what I wanted to do is impossible.
There is no way to derive from an Itk class in Java and influence the
behavior of the underlying C class, because of the underlying JNI layer
- there are static methods that get called by the Java classes that
essentially act like plain function calls. And besides that, I was
creating the itkOutputWindow object so that it's internal data was null,
anyway - you have to use the itkOutputWindow_Pointer object to get a
functional object.
Hope this helps the one other person who is trying to use itk via the
java wrappers. :-)
This issue might be worthy of consideration in this project, too:
http://www.itk.org/Wiki/Proposals:Logging
-Aron
Aron Helser wrote:
> I'm trying to redirect or at least disable the OutputWindow in itk
> wrapped for Java.
> I create a class like this:
>
> public class ItkConsoleOutput extends itkOutputWindow {
> public ItkConsoleOutput() {
> super();
> }
>
> public void DisplayDebugText(String arg0) {
> System.out.println("ITK debug: " + arg0);
> }
>
> //.... similar for other output types.....
> }
>
> Then set it up as I create my ITK handler object, in the constructor:
> public class ItkLoader {
> private static ItkConsoleOutput ms_OutputWindow = null;
>
> public ItkLoader() {
> // initialize output from ITK library to go to console.
> if (ms_OutputWindow == null) {
> ms_OutputWindow = new ItkConsoleOutput();
> itkOutputWindow.SetInstance(ms_OutputWindow);
> //itkOutputWindow.SetInstance(null); // doesn't make any
> difference either.
> }
> }
> }
>
> I still get a blank OutputWindow showing up sometimes, with no
> messages in it and not responding to the mouse. I'm integrating into a
> large app that primarily uses a Swing interface.
>
> Any idea how to make this work? Do I need to just hack the
> itkOutputWindow.java file generated by Swig?
>
> Regards,
> Aron
>
More information about the Insight-users
mailing list