[vtkusers] converting java array to vtkimage data

Sebastien Jourdain sebastien.jourdain at kitware.com
Fri Apr 23 15:55:26 EDT 2010


Hi Nikhil,

"Exception in thread "main"
java.lang.UnsatisfiedLinkError:vtk.vtkImageData.VTKInit()J

Means their is an issue with the link to the native layer.

So make sure those library have well been loaded before. Because depending
on your code and system,
those library might not be loaded when you use vtkImageData and might be
loaded when used with other VTK functions. Try to write  "new vtkPanel();"
prior the "vtkImageData image = new vtkImageData();".
(vtkPanel embed this native library loading lines...)

Seb


On Fri, Apr 23, 2010 at 3:20 PM, nikhil singhania <niksinghania at gmail.com>wrote:

> Sir,
> Thank you for your reply.The code is working for all other vtk
> functions just giving error for  vtkimagedata .Does vtkimagedata
> require any additional file to be loaded. Environmental variable  path
> is also set.
> Thank You.
>
> Best regards,
> Nikhil
>
> On 23/04/2010, Sebastien Jourdain <sebastien.jourdain at kitware.com> wrote:
> > Hi Nikhil,
> >
> > You forgot to load the system library.
> >
> > You have to add the following line in your code as well as having
> depending
> > on your system the directory that content the vtk library inside the
> > environment vairiable PATH/LD_LIBRARY_PATH/DYLD_LIBRARY_PATH
> (win/unix/mac).
> >
> > static {
> >     System.loadLibrary("vtkCommonJava");
> >     System.loadLibrary("vtkFilteringJava");
> >     System.loadLibrary("vtkIOJava");
> >     System.loadLibrary("vtkImagingJava");
> >     System.loadLibrary("vtkGraphicsJava");
> >     System.loadLibrary("vtkRenderingJava");
> >     try {
> >       System.loadLibrary("vtkHybridJava");
> >     } catch (Throwable e) {
> >       System.out.println("cannot load vtkHybrid, skipping...");
> >     }
> >     try {
> >       System.loadLibrary("vtkVolumeRenderingJava");
> >     } catch (Throwable e) {
> >       System.out.println("cannot load vtkVolumeRendering, skipping...");
> >     }
> >   }
> >
> > Seb
> >
> > On Fri, Apr 23, 2010 at 2:57 PM, nikhil singhania
> > <niksinghania at gmail.com>wrote:
> >
> >> Sir,
> >> I am writing a code to convert java array to image data..but getting an
> >> error:
> >>
> >> "Exception in thread "main" java.lang.UnsatisfiedLinkError:
> >> vtk.vtkImageData.VTKInit()J
> >>        at vtk.vtkImageData.VTKInit(Native Method)
> >>        at vtk.vtkObject.<init>(vtkObject.java:96)
> >>        at vtk.vtkDataObject.<init>(vtkDataObject.java:1206)
> >>        at vtk.vtkDataSet.<init>(vtkDataSet.java:225)
> >>        at vtk.vtkImageData.<init>(vtkImageData.java:347)
> >>        at javaapplication2.fileread.main(fileread.java:49)"
> >>
> >> here is some part of code...
> >>
> >>  vtkImageData image = new vtkImageData();
> >>  image.SetDimensions(500, 500, 50);
> >>  image.SetOrigin(0.0, 0.0, 0.0);
> >>  image.SetSpacing(0.33,0.33,0.33);
> >>  image.SetScalarTypeToChar();
> >>  image.AllocateScalars();
> >>  vtkDataArray array = image.GetPointData().GetScalars();
> >>
> >>  for(int iZ = 0; iZ < 50; iZ++){
> >>            for(int iY= 0; iY < 500; iY++){
> >>                      for(int iX = 0; iX < 500; iX++){
> >>                                 array.InsertNextTuple1(arr[iZ][iY][iX]);
> >>                        }
> >>               }
> >>   }
> >>
> >> Please help.
> >>
> >> Thank You.
> >> --
> >> Nikhil Kumar
> >> rit2007033
> >> b.tech IT 6th sem
> >> IIIT Allahabad
> >> contact at 9793905858
> >> email: rit2007033 at iiita.ac.in
> >>          niksinghania at gmail.com
> >> http://profile.iiita.ac.in/RIT2007033/
> >> _______________________________________________
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Please keep messages on-topic and check the VTK FAQ at:
> >> http://www.vtk.org/Wiki/VTK_FAQ
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtkusers
> >>
> >
>
>
> --
> Nikhil Kumar
> rit2007033
> b.tech IT 6th sem
> IIIT Allahabad
> contact at 9793905858
> email: rit2007033 at iiita.ac.in
>          niksinghania at gmail.com
> http://profile.iiita.ac.in/RIT2007033/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100423/bd18be68/attachment.htm>


More information about the vtkusers mailing list