[vtkusers] VoxelGradient Help
Vivek Gupta
vivekg at mac.com
Fri Mar 19 17:16:00 EST 2004
Hi,
I am using the example program Medical3.cxx as my starting point. Here is what I am trying to do. I have a device I am interfacing with that enables me to move around in 3 space, I have hooked up that device with VTK (in Medical3.cxx) such that when ever the vtkRenderer is modified there is a callback that let's me grab the transform matrix going from global coordinates to view coordinates. I take the inverse of this and store it.
Then in a separate thread my device is being sampled for it's location, I use that thread to then compute the device coordinates to global coordinates (using the previously saved matrix). This is used to update the Positionof my probe on the screen (a sphere). This part is working fine (though I have to force a refresh of the window by doing a key press to see the update).
The next part is where I have my problem. As I move through the dataset shown in Medical3.cxx (which is the <VTKData>/Data/headsq/quarter dataset) I would like to print out the gradient at my current location (if I am within the dataset). I've tried the following functions from vtkImageData:
int ComputeStructuredCoordinates (float x[3], int ijk[3], float pcoords[3])
void GetVoxelGradient (int i, int j, int k, vtkDataArray *s, vtkDataArray *g)
I use the first to take my global coordinates to figure out my cell and the second to try to get my gradient vectors. However, I don't think I am using these functions correctly since ComputeStructuredCoordinates never returns a 1 (indicating that I am in the volume).
Does anyone have any suggestions.
Thanks,
Vivek
More information about the vtkusers
mailing list