[vtkusers] insert more than one value in a vtkUnsignedCharArray in one operation ...

arnaud garcia arnaud_garcia_fr at yahoo.fr
Fri Nov 8 10:26:38 EST 2002


hello,

I would like to create a vtkImageData  from an image data stacks. In the stack i have method to extract all pixels of a slice.

I did it with a vtkUnsignedCharArray.InsertNextValue((char)pixels[j]), but it is very slow ...., because i insert all the pixels values one by one in the array...

 byte[] pixels = (byte[])stack.getPixels(i); // retrieve all pixels of the slice (image values)
 vtkUnsignedCharArray array=new vtkUnsignedCharArray();
 for (int j=0;j<width*height;j++) 
      array.InsertNextValue((char)pixels[j]);

// build the ImageData from the vtkUnsignedCharArray 
  vtkImageData id=new vtkImageData();
  id.GetPointData().SetScalars(array);

I think, it is possible to insert all the pixels of one slice in one time in the vtkUnsignedCharArray, but i don't know how to do this with java/vtk.

 

thanks for help

arnaud


                         

 



---------------------------------
Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20021108/530a2ec0/attachment.htm>


More information about the vtkusers mailing list