[Insight-users] More on java wrappers

Alejandro Canales Ochoa aco at cion.com.mx
Sun, 29 Feb 2004 22:59:04 -0600


Hi everyone

This weekend I was trying to integrate ITK in my java application. The result is not very promising as I expected. The wrapper shows an inconsistent behavior, at least from the point of view of the Insight user’s guide; I was unable to complete some very basic examples. 
For example, I try the Read-Write example and do not work at all. Here is my java code:

itkImageFileReaderUS2_Pointer reader = itkImageFileReaderUS2.itkImageFileReaderUS2_New();
itkImageFileWriterUS2_Pointer writer = itkImageFileWriterUS2.itkImageFileWriterUS2_New();
reader.SetFileName(args[0]);
writer.SetFileName(args[1]);
writer.SetInput(reader.GetOutput());
writer.Update();

The output image is the same width and height as the original but is all black. After several trials I can get an image only if I use a filter (BinaryThreshold or CannyEdgeDetection for example) followed by the IntensityRescalerFilter. 

Another thing that is a mystery for me is how to import/export an image in/from the wrappers. As you can guess I *really* need to access pixel data (at least for displaying, not using VTK) and for feed the ITK filter from data that comes from my application. The ITK user’s guide shows the use of ImportImageFilter for importing the data, but this filter is missing (at least in my build). For accessing the pixel data the guide tells me that I need to use iterators, and shows how to create one, but the class itkImageRegionConstIterator is not present too. Either I don’t know how to make an instance of itkImageXX_Pointer from SWIGTYPE_p_itk__ImageTXXX_X_t, which is the type of the output in the filters, this for accessing via getPixel() method.

As you can see I am in a deep trouble because I can not make a substantial advance in my duty.

I hope someone can help me because, I am lost in those issues.

Regards and thanks in advance.
Alejandro Canales