[vtkusers] vtkImageData

Amy Squillacote ahs at cfdrc.com
Mon Apr 7 09:55:40 EDT 2008


Hi Stefan,

What are the dimensions of the vtkImageData you are trying to generate? 
You haven't specified them anywhere (using either vtkImageData's 
SetDimensions or SetExtent method).

- Amy

Stefan Huber wrote:
> Hi,
>
> i have an Array with pointdata and i want to generate imagadata to use vtk. How can i do it? Can you give me an example, how i can create an imagadataobject? my code doesn't work.
>
> my code:
>
> vtkImageData *img = vtkImageData::New();
> img->AllocateScalars();
> img->SetScalarTypeToInt();
>
> vtkCellArray * scalars = vtkCellArray::New();
> for(int i= 0; i< size; i++){
>   scalars->InsertNextCell(dat[i]);
> }
> img->GetPointData()->SetScalars(scalars);
> img->GetPointData()->CopyAllOn();
> img->Update();
> img->UpdateData();
>
> thanx,
> Stefan
>   

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list