[vtkusers] How to get native scalar pointer from a vtkImageReader?
Amy Squillacote
amy.squillacote at kitware.com
Thu Oct 18 07:52:21 EDT 2007
Hi James,
First you'll need to manually call Update() on your instance of
vtkImageReader. Then do something similar to the code shown below.
vtkImageReader *reader = vtkImageReader::New();
...
reader->Update();
vtkImageData *output = reader->GetOutput();
void *ptr = output->GetScalarPointer();
You can find out the scalar type of the scalars in the vtkImageData
using the GetScalarType() or GetScalarTypeAsString() methods. Then you
can cast the pointer to the raw data to the correct type.
- Amy
James Zhou wrote:
> Hi,
>
> I read the 3D data into the vtk pipeline using vtkImageReader. Now I
> want to get the native scalar pointer (i.e. the pointer that points to
> the raw data), could you please give me any information on how to do
> this?
>
> Thanks!
>
> James
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
--
Amy Squillacote
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
Phone: (518) 371-3971 x106
More information about the vtkusers
mailing list