[vtkusers] Accessing the data in an image file

Thomas Deschamps tdeschamps at lbl.gov
Tue May 7 20:24:48 EDT 2002


Hi all vtk-users,

I would liks to know how to access the scalar values in one dataset.
I have a 3D structured points dataset (a medical image). I would like to
obtain a pointer (vtkDataArray *) to the values in the dataset, or a way
to obtain the scalar value, at one point (i,j,k) in the dataset.
I just want a copy of the values, I do not necessarily want to modify
them.
Here is a sample of my code.

    vtkStructuredPointsReader *reader =
vtkStructuredPointsReader::New();
    reader -> SetFileName(filename);
    reader -> Update();

    vtkStructuredPoints * dataPoints = reader -> GetOutput();

    dataPoints -> GetExtent( xBegin,yBegin,zBegin,xEnd,yEnd,zEnd );

Thank you very much for your help.

Thomas




More information about the vtkusers mailing list