[vtkusers] SetCutPlane not working in vtkImageResliceMapper

David Gobbi david.gobbi at gmail.com
Thu Mar 28 11:46:33 EDT 2013


On Wed, Mar 27, 2013 at 6:41 PM, Debjit Ghosh <dghosh at chla.usc.edu> wrote:
> I am not sure I explained myself right.
>
> I am currently slicing the volume by setting the camera's Position, Focal
> Point and View Up. The normal of the plane is calculated by the sensor's
> rotation matrix as follows:
>
> double *default_norm = {0,0,-1};
> double *normal;
>
> matrix->MultiplyPoint(this->default_norm, normal);
>
> //Calculate the focal point
> double focalPt[3];
> double centerofvol[] = {dimX/2, dimY/2, dimZ/2};
> vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
> plane->SetOrigin(dimX/2, dimY/2, 0);
> plane->SetNormal(normal);
> plane->ProjectPoint( centerofvol, focalPt );
>
> position[0] = focalPt[0] + distfromcam * this->normal[0];
> position[1] = focalPt[1] + distfromcam * this->normal[1];
> position[2] = focalPt[2] + distfromcam * this->normal[2];
>
> cam->SetPosition(position);             //Orientation of the slice plane
> cam->SetFocalPoint(focalPt);    //Point at which my plane is fixed
> cam->SetViewUp(0,0,-1);
>
> This was working perfectly and I don't need to touch it at all except that,
> the echocardiology demands that the volumes be rotated a certain way and
> this I do using keyboard units sitting next to an echo expert. So let's say
> at (30, 0, 180), the slices are now real as the echocardiogram would have
> been and these values are going to be saved for future use.
>
> Until here the slicing works beautifully. But after I have set the slice's
> orientation using RotateX, RotateY, RotateZ the problem starts where the
> image is rotating around in the screen or is upside down or diagonal etc
> based on the angles the slice has been rotated to.
>
> ----------------------------------
>
> From what you said, and based on what I did, there isn't an anatomical
> vector as such to to project to a plane. I would need to find out the view
> up vector from the new orientation of the volume and then plug it into the
> camera settings in place of leaving it as {0,0,-1}.
>
> How would I find the view up vector based on the new orientation of the
> volume to say (30, 0, 150) or something...?

If you already had a system where the view up vector was set correctly
before the rotation was applied, then can't you just apply the rotation to
vector you use as the view up vector?

I always think of these visualization problems by considering what
my degrees of freedom are, and what my constraints are.  As long as
I'm doing all my rotations with either matrices or quaternions, the math
works out nicely because everything is linear.  I almost never express
orientations as a series of x,y,z rotations because it makes the math
much more complicated...

 - David



More information about the vtkusers mailing list