[vtkusers] Get the right voxel from the GetScalarPointer method

Matei MANCAS matei.mancas at tcts.fpms.ac.be
Thu May 15 12:02:14 EDT 2003


Hi everybody!!!

I'm trying to directly access to image voxels. 

I first tried this :
float* voxel=(float*)(mon_grad->GetOutput()->GetScalarPointer(x,y,z));
voxel[0] contains the value of voxel placed in x, y and z so it works well...

    BUT 

I need to use the more complicated way :
float* voxel=(float*)(mon_grad->GetOutput()->GetScalarPointer());

In this case voxel is a pointer on the first element of a 1 dimensional Tab....
Does anyone knows how this structure is really made???

I tried to get the x,y,z voxel by doing :

voxel[x+y*dim(x)+z*dim(x)*dim(y)] or
voxel[z+y*dim(z)+x*dim(x)*dim(z)] or others....

And it never worked or is never the same voxel then when I use the first method!

So please help me : what is the magic formula to get the right voxel from a 
float* voxel=(float*)(mon_grad->GetOutput()->GetScalarPointer());


Thanks by advance!


Matei 




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


More information about the vtkusers mailing list