[Insight-users] reading DICOM with itk and JAVA

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Wed May 24 05:38:32 EDT 2006


Hi,

On Wed, 24 May 2006 11:27:27 +0200, <a.bongers at mediri.com> wrote:

> 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 );

can you try to replace this line by the following one ?

  reader.SetImageIO( gdcmImageIO.GetPointer() );

Gaetan

>
>
> 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é
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr


More information about the Insight-users mailing list