[vtkusers] How to use vtkBitArray

林立凡 kigihanko at sina.com
Tue Aug 11 22:31:50 EDT 2009


I am trying to display  a volume data,which is 512*512*331 byte array.
I decide to use vtkImageData +vtkBitArray to display it,however,I have encounted some problems:
 
//Read dat data
vtkBitArray arr = new vtkBitArray();
arr.Allocate(dimsX * dimsY * dimsZ, 1);
arr.SetArray(array, dimsX * dimsY * dimsZ, 1);//array is a array which type is byte
//Volume Rendeing
vtkImageData id = new vtkImageData();
 id.SetDimensions(dimsX, dimsY, dimsZ);
 id.SetScalarTypeToChar();// this line can't be used!
 id.SetNumberOfScalarComponents(3);
  id.AllocateScalars();
  id.GetPointData().SetScalars(arr); 
 
Do anyone knows how to fix the code above?Thx very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090812/605cef30/attachment.htm>


More information about the vtkusers mailing list