[vtkusers] Rapid access to scalar data in vtkImageData

David Doria daviddoria at gmail.com
Tue Oct 11 16:17:15 EDT 2011


On Mon, Oct 10, 2011 at 11:41 AM, Martijn Steenwijk
<martijnsteenwijk at gmail.com> wrote:
> You might be looking for an iterator, something like this:
> reader->Update();
> ImagePointer img = reader->GetOutput();
> ImageIteratorType img_it(img, img->GetLargestPossibleRegion() );
> for(img_it.GoToBegin(); !img_it.IsAtEnd(); ++img_it){
>     double value = img_it.Get();
> }
> Best,
> Martijn

Martijn, this is the VTK list :)

Jothy, I think you're looking for imageData->GetScalarPointer(). Then
you can access the data with normal pointer arithmetic.

David



More information about the vtkusers mailing list