[vtkusers] (no subject)
Monica Hernandez
moniquisma at colacao.es
Sat Aug 31 04:05:45 EDT 2002
Greetings:
I want to create an vtkImageData object with some specified parameters
and use it for accessing to its scalar values.
If I do this:
//begining of program
//using vtk 3.0
#include <vtkImageData.h>
//creation of the vtkImageData object with the specified parameters
vtkImageData *vtkimage = vtkImageData::New();
vtkimage->SetExtent(0,49,0,49,0,49);
vtkimage->SetScalarType(VTK_FLOAT);
vtkimage->SetSpacing(1.0,1.0,1.0);
vtkimage->SetOrigin(0,0,0);
vtkimage->SetNumberOfScalarComponents(1);
float *ptr = (float*) vtkimage->GetScalarPointer();
int incX, incY, incZ, ext[6];
vtkimage->GetContinuousIncrements(ext,incX,incY,incZ);
for (int z=0; z<50; z++){
for (int y=0; y<50; y++){
for (int x=0; x<50; x++){
cerr << x <<" " << y << " " << z << endl;
cerr << *ptr <<endl;
ptr++;
}
ptr +=incY;
}
ptr +=incZ;
}
//end of program
Things observed:
1) When I execute this code there is a fatal error at x=34 y=18 z=49.
2)Also incX=1091008010 and incY=-1287636448 (I don't know if the function
GetContinuosIncrements is working correctly, maybe the error is here)
I would like to know how can I access with ptr to all possible scalar
values of my object.
Thank you very much.
--------------------------------------------------------------------------
----------------------------------------
Mónica Hernández Giménez
Lab. 3.05 Dpto. Ingeniería Electrónica y Comunicaciones
Centro Politécnico Superior. Universidad de Zaragoza
Tlfno. (+34) 976761000 Ext.5288
Fax: (+34) 976762111
e-mail: mhg at posta.unizar.es
--------------------------------------------------------------------------
----------------------------------------
More information about the vtkusers
mailing list