[vtkusers] Add data to vtkImageData object

Jothy jothybasu at gmail.com
Thu Sep 9 11:43:47 EDT 2010


Use vtkImageData->SetScalarComponentFrom...


Jothy

On Thu, Sep 9, 2010 at 4:14 PM, salmon monviola <Jordy.Salmon at rennes.inra.fr
> wrote:

>  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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100909/765e83f1/attachment.htm>


More information about the vtkusers mailing list