[Insight-users] reading DICOM with itk and JAVA

a.bongers at mediri.com a.bongers at mediri.com
Wed May 24 05:27:27 EDT 2006


Hi,

I've been having some problems to read dicom files with itk when using
the JAVA wrapper.
What I did is just to translate the c++ sample code in the "itk-draft
guide 2.2.0 " into Java. Although it works fine in c++ the translated
code does not: the Java Compiler tells me that the parameter for the
reader.setImageIO( DicomImageIO) method does not have the correct type.
It expects the type parameter "itkImageIOBase" and ist gets
"itkDicomImageIO_Pointer"

I wonder why it doesn't work in Java although it works in c++. Some bug
the wrapping ? Would be really great if somebody could help me with this
!

Here ist the code snippet in Java:

itkImageFileReaderUC2_Pointer reader =
itkImageFileReaderUC2.itkImageFileReaderUC2_New();
    itkImageFileWriterUC2_Pointer writer =
itkImageFileWriterUC2.itkImageFileWriterUC2_New();

itkGDCMImageIO_Pointer gdcmImageIO = itkGDCMImageIO.itkGDCMImageIO_New();

reader.SetImageIO( gdcmImageIO );


At this point I get the following error from the Java Compiler :


C:\Daten\itkTest210306>javac -classpath
C:\Programme\itk\Wrapping\CSwig\Java\Rel
ease\InsightToolkit.jar itkTest.java
itkTest.java:21: SetImageIO(InsightToolkit.itkImageIOBase) in
InsightToolkit.itk
ImageFileReaderUC2_Pointer cannot be applied to
(InsightToolkit.itkGDCMImageIO_P
ointer)
        reader.SetImageIO( gdcmImageIO );
              ^




Thanks a lot

André


More information about the Insight-users mailing list