[vtkusers] vtkImageData

Stefan Huber Huber.Ste at gmx.at
Tue Apr 8 08:27:59 EDT 2008


Hi Amy

thank you, i added the dimension and changed the datatyp and the dimension of my array and now it works.

I only have some problems to convert the imagedata object to an array. How can i get the values from the imagedata to write it to an array?

   arr[i*width+j] = img->GetPointData->GetScalars()->GetTupel1(id);

doesn't work.
Do you know why?

thanx Stefan

-------- Original-Nachricht --------
> Datum: Mon, 07 Apr 2008 08:55:40 -0500
> Von: Amy Squillacote <ahs at cfdrc.com>
> An: Stefan Huber <Huber.Ste at gmx.at>
> CC: vtkusers at vtk.org
> Betreff: Re: [vtkusers] vtkImageData

> 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
> 

-- 
Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games! 
http://games.entertainment.gmx.net/de/entertainment/games/free



More information about the vtkusers mailing list