[vtkusers] Add data to vtkImageData object
salmon monviola
Jordy.Salmon at rennes.inra.fr
Thu Sep 9 11:14:50 EDT 2010
Hi,
I'm newbie in VTK, so it's perhaps a basic question :
How add data to a cell to store them in a vtkImageData (and write it in
a vti file)
// Create an image data
vtkSmartPointer<vtkImageData> imageData =
vtkSmartPointer<vtkImageData>::New();
// Specify the size of the image data
imageData->SetDimensions(2,3,1);
int* dims = imageData->GetDimensions();
for (int z = 0; z < dims[2]; z++)
{
for (int y = 0; y < dims[1]; y++)
{
for (int x = 0; x < dims[0]; x++)
{
// ???? _HOW TO ADD HERE DATA like a 2 D ARRAY TO THE CELL (or
point) of x,y,z coordinates ????_
}
}
}
vtkSmartPointer<vtkXMLImageDataWriter> writer =
vtkSmartPointer<vtkXMLImageDataWriter>::New();
writer->SetFileName(outputFilename.c_str());
writer->SetInput(imageData);
writer->Write();
Thank you,
Jordy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100909/9a7b4d22/attachment.htm>
More information about the vtkusers
mailing list