[vtkusers] Getting image data quickly into Java objects
Jeff Lee
jeff at cdnorthamerica.com
Thu Jun 5 14:46:28 EDT 2003
mabey something like...
vtkImageData imgData = ...
vtkPNGWriter writer = new vtkPNGWriter();
writer.SetInput(imgData);
writer.WriteToMemoryOn();
writer.Write();
vtkUnsignedCharArray arr = writer.GetResult();
byte[] bytes = new byte[arr.GetNumberOfTuples()];
for (int i = 0; i < arr.GetNumberOfTuples(); ++i) {
bytes[i] = (byte)arr.GetTuple1(i);
}
...
Greg Scott wrote:
> I've seen in the past people have asked a similar question, yet I've
> found no answers.
>
> I would like to move the RGB data from a vtkImageData instance into
> Java, i.e. into a byte[] array. As I understand it, the usual
> GetScalarPointer methods are not available in the Java wrapping of VTK.
>
> Can anyone suggest a fast way to do this, other than looping through
> the entire image data doing GetPoint... on each one, which returns,
> say a float.
>
> Any suggestions would be much appreciated.
> Thanks
> Greg
>
More information about the vtkusers
mailing list