[vtkusers] How to create a color vtkImageData?
Андрей Глухов
realandron at gmail.com
Sat Mar 20 10:50:47 EDT 2010
If I set SetNumberOfScalarComponents (3) and fills the array with
vtkMath.Random a color image is displayed,but if I substituted specific
values, the image is displayed in grayscale. How to create an array?
//code
vtkImageData vol = new vtkImageData();
vol.SetDimensions(512, 512, 1);
vol.SetSpacing(10, 10, 10);
vol.SetOrigin(0, 0, 0);
vol.AllocateScalars();
vol.SetNumberOfScalarComponents(3);
vtkFloatArray scalars = new vtkFloatArray();
for (int i = 0; i < 512; i++)
{
for (int j = 0; j < 512; j++)
{
scalars.InsertTuple1(i * 512 + j,vtkMath.Random(0,
2000));//Why grayscale with my values??
}
}
vol.GetPointData().SetScalars(scalars);
vol.Update();
vtkImageViewer viewer = new vtkImageViewer();
viewer.SetInput(vol);
viewer.SetSize(512, 512);
viewer.Render();
--
С Уважением,
Андрей.
Best regards, Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100320/4029ec67/attachment.htm>
More information about the vtkusers
mailing list