[Insight-users] Java wrappers import/export data

Jarek Sacha jarek at ieee.org
Sat, 06 Mar 2004 20:37:40 -0500


Alejandro Canales Ochoa wrote:

>Bill told me that there is not difficult for them to provide an API for importing/exporting images from/to java. He is figuring out how this API should be before implement it. I hope in the near future we can see that API.
>  
>
I did developed some code to reading/writing ITK data in MetaImage 
format. The code is available at
http://sourceforge.net/project/showfiles.php?group_id=44711&package_id=46607
brief description at
http://ij-plugins.sourceforge.net/3d-toolkit
In the code look for package net.sf.ij.io.metaimage. This code was 
developed in early days of ITK and supports older version of the 
MetaImage format. I am working on updating the code to current MetaImage 
specs and to make it work in the javax.imageio framework (read/write 
data as standard java.awt.image.BufferedImage, no dependency on JAI, no 
dependency on ImageJ).

You will find in the same package (ij-3D-toolkit) examples of using VTK 
image filters from Java (no rendering). Communication of images between 
VTK and Java is done through temporary files, in the VTK format.

The communication through files is actually quite efficient, filtering 
is typically much longer than file transfer. On of the possible options 
to speed the transfer is to send data through memory mapped files using 
the java.nio package. Though, I did not test this yet. The java.nio and 
memory mapped files are used, for instance, in the Java 1.5 code of the 
new XAWT module (communication between AWT and X11 on UNIX systems), 
there is some info on that at:
http://servlet.java.sun.com/javaone/sf2003/conf/sessions/display-1999.en-60358.jsp

Jarek