[vtkusers] Native arrays to VTK arrays in Java - how to do it efficiently

sacha.jp at pg.com sacha.jp at pg.com
Thu Mar 29 11:13:40 EST 2001


What is an efficient way of converting native data in Java to VTK, say
vtkDataArray, vtkImageData, or vtkStructuredPoints?

I am using something like this:

     short[] a = new a[65536];
     ...
     vtkShortArray data = new vtkShortArray();
     data.SetNumberOfComponents(1);
     data.SetNumberOfTuples(a.length);
     for(int i=0; i<a.length; ++i)
          data.SetValue(i, a[i]);

For large arrays it is very slow since values are copied one by one.
Is there a more efficient way to do it in Java ?

Thanks,

Jarek






More information about the vtkusers mailing list