[Insight-users] Redirect OutputWindow in Java?

Aron Helser helser at 3rdtech.com
Mon Feb 25 09:16:33 EST 2008


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