[Insight-users] ImageJ and ITK on Solaris

Michael Bell michael.bell at acm.org
Mon Jun 12 14:07:16 EDT 2006


Insight Developers,

In Wrapping/CSwig/SwigRuntime/JavaCWD.cxx, the load function applies
flags to linux when running dlopen. These flags also need to be
applied to Solaris (all unix perhaps?):
#if defined(__linux__) //apply to solaris also
  	 # 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

I have made this change in my local copy and tested it successfully in
my application. I don't know what the global ramifications would be.

What would it take to have ITK tested nightly on a solaris machine? I
would like to help pursue that if possible.

thanks,
michael

On 6/12/06, Michael Bell <michael.bell at acm.org> wrote:
> I think the problem might be that a linux specific fix applies also to
> Solaris. In JavaCWD.cxx, flags are send to dlopen for linux, but not
> for Solaris.
> See: http://www.itk.org/cgi-bin/viewcvs.cgi/Wrapping/CSwig/SwigRuntime/JavaCWD.cxx?r1=1.2&r2=1.3&root=Insight
>
> I'll make the change for solaris and see if that takes care of things.
>
> thanks,
> michael
>
> On 6/12/06, Michael Bell <michael.bell at acm.org> wrote:
> > Gaetan,
> >
> > Here is the best reference:
> > http://www.itk.org/pipermail/insight-users/2004-February/006985.html
> >
> > The ImageFileWriter worked. What does that tell you?
> >
> > 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.itkSmoothingRecursiveGaussianImageFilterF2F2_Pointer_Update(Native
> > > > Method)
> > > >  at
> > > > InsightToolkit.itkSmoothingRecursiveGaussianImageFilterF2F2_Pointer.Update(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
> > >
> >
> >
> > --
> > michael.bell at acm.org
> >
>
>
> --
> michael.bell at acm.org
>


-- 
michael.bell at acm.org


More information about the Insight-users mailing list