[Insight-users] ImageJ and ITK on Solaris

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Mon Jun 12 14:08:12 EDT 2006


On Monday 12 June 2006 17:56, Michael Bell wrote:
> Gaetan,
>
> Here is the best reference:
> http://www.itk.org/pipermail/insight-users/2004-February/006985.html
>

thanks :-)
Sad there's not much details

> The ImageFileWriter worked. What does that tell you?

It tell me that a simple pipeline which made of class from the same .so file 
work.

The code you wrote works for me, so I guess it is a solaris related issue. Can 
you try to remove the if-else-endif block below, in JavaCWD.cxx

if defined(__linux__)
# include <dlfcn.h>

int JavaCWD::Load(const char* lib)
{
  return dlopen(lib, RTLD_GLOBAL|RTLD_NOW)? 1:0;
}
#else
int JavaCWD::Load(const char* lib)
{
  return 0;
}
#endif


to keep only



# include <dlfcn.h>
int JavaCWD::Load(const char* lib)
{
  return dlopen(lib, RTLD_GLOBAL|RTLD_NOW)? 1:0;
}


? I think the problem comes from there: dlopen is not used with the right 
flags. I'm not very sure about how it works on solaris, but hopefully it 
should work :-)

Gaetan


>
> thanks,
> michael
>
> On 6/12/06, Gaetan Lehmann <gaetan.lehmann at jouy.inra.fr> wrote:
> > On Mon, 12 Jun 2006 15:40:59 +0200, Michael Bell <michael.bell at acm.org>
> >
> > wrote:
> > > All,
> > >
> > > I am trying to use itk within ImageJ on Solaris. The following
> > > smoothing code works fine in ImageJ on Linux, and fine on solaris in a
> > > stand alone java program, but I get an exception when using ImageJ:
> > >
> > > 42 itkImageFileReaderF2_Pointer reader =
> > > 43         itkImageFileReaderF2.itkImageFileReaderF2_New();
> > > 44 reader.SetFileName( "line3.png");
> > > 45 itkSmoothingRecursiveGaussianImageFilterF2F2_Pointer filter =
> > > 46         itkSmoothingRecursiveGaussianImageFilterF2F2.
> > >                  itkSmoothingRecursiveGaussianImageFilterF2F2_New();
> > > 47 filter.SetInput(reader.GetOutput());
> > > 48 filter.Update();  //exception occurs here
> > >
> > > Here is the exception:
> > > java.lang.RuntimeException:
> > > /stuff/InsightToolkit-2.6.0/Code/Common/itkImageBase.txx:249:
> > > itk::ERROR: Image(0x1a0b28): itk::ImageBase::CopyInformation() cannot
> > > cast PKN3itk10DataObjectE to PKN3itk9ImageBaseILj2EEE
> > >  at
> > > InsightToolkit.itkSmoothingRecursiveGaussianImageFilterJNI.itkSmoothing
> > >RecursiveGaussianImageFilterF2F2_Pointer_Update(Native Method)
> > >  at
> > > InsightToolkit.itkSmoothingRecursiveGaussianImageFilterF2F2_Pointer.Upd
> > >ate(itkSmoothingRecursiveGaussianImageFilterF2F2_Pointer.java:245) at
> > > itktest_.run(itktest_.java:48)
> > >  at ij.IJ.runFilterPlugIn(IJ.java:197)
> > >  at ij.IJ.runUserPlugIn(IJ.java:275)
> > >  at ij.IJ.runPlugIn(IJ.java:117)
> > >  at ij.Executer.runPlugIn(Executer.java:171)
> > >  at ij.Executer.runCommand(Executer.java:133)
> > >  at ij.Executer.run(Executer.java:63)
> > >  at java.lang.Thread.run(Thread.java:534)
> > >
> > > I am using java 1.4.2_11 for the java wrapping and for ImageJ. ITK is
> > > version 2.6. I have seen this error on the Insight-users list before,
> > > but I have not seen it resolved. I did a complete compile of ITK
> > > before running this code.
> >
> > Can you give a pointer to the mail describing this problem ?
> >
> > It looks a lot like the problem we had some time ago with python: objects
> > can't be transfered to one .so module to another .so module. Just to be
> > sure, can you replace your SmoothingRecursiveGaussianImageFilter by a
> > ImageFileWriter ?
> >
> > Gaetan
> >
> >
> > --
> > 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20060612/a923e33b/attachment.pgp


More information about the Insight-users mailing list