[vtkusers] Access imagedata

David Doria daviddoria at gmail.com
Fri Feb 10 13:06:40 EST 2012


On Fri, Feb 10, 2012 at 1:03 PM, cc cc <cctsinghua at gmail.com> wrote:

> Hello,
>
> I want to get value of each point. The data is from vtkVolume16Reader, the
> typical header frequently seen in vtk, used in vtkMarchingCubes. Below is
> vtkVolume16Reader from sample code.
>     vtkVolume16Reader *v16 = vtkVolume16Reader::New();
>     v16->SetDataDimensions(64,64);
>     v16->GetOutput()->SetOrigin(0.0,0.0,0.0);
>     v16->SetDataByteOrderToLittleEndian();
>     v16->SetFilePrefix("/.../VTK/VTKData/Data/headsq/quarter");
>     v16->SetImageRange(1,93);
>     v16->SetDataSpacing(3.2,3.2,1.5);
>     v16->Update();
> But how can I get value on each vertex? Please help. Best wishes.
>
> Cheng
>

You should get the output of the filter as a vtkImageData:

vtkImageData* image = v16->GetOutput();

Then you can access the data like this:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/ImageData/IterateImageData

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120210/f15f71f3/attachment.htm>


More information about the vtkusers mailing list