[vtkusers] SetCutPlane not working in vtkImageResliceMapper

David Gobbi david.gobbi at gmail.com
Mon Oct 22 19:52:30 EDT 2012


Hi Debjit,

Thanks for the images, they're exactly what I expected.  You are
trying to extract oblique slices from a cone-shaped (or
pyramid-shaped) 3D ultrasound volume, and then show them on the
screen.  On the screen, they will look a lot like regular 2D B-mode
ultrasound images.

Now, about the camera, I think that you misunderstood some things from
my last email:

a) Do not think about camera position in terms of "Roll" and "Pitch".
When I mentioned them in my last email, I only mentioned them as
things to _avoid_.  Roll and Pitch should not appear anywhere in the
code that you are using to try to solve this problem.  And Roll and
Pitch are independent of distance, so I don't understand your question
about how I relate them to distance.

b) The normal vector is the normal to your slice plane.  You use the
normal to compute the camera distance, and then you call
camera->SetPosition(Position) to set the camera to that position.  You
need to compute the position from the normal (i.e. you must know the
normal of the slice plane that you want to see).

c) The focal point should not be set to the center of the volume.
What I said was, the focal point must be close to the center of the
volume in order for the image to be centered on the screen.  I didn't
say the focal point should be set to be exactly at the center of the
volume.  That's why in my last email I mentioned using
vtkPlane::ProjectPoint() as a method to compute the focal point from
the center of the volume, given the Origin and Normal of your desired
slice plane.  (e.g. choose Origin to be the top of your cone, and
choose Normal to be the normal of the slice you want to show, and then
use vtkPlane::ProjectPoint() to compute the FocalPoint that you would
use to set up the camera).

My proposed method requires that SliceFacesCamera is ON and that
SliceAtFocalPoint is also ON.  Otherwise, setting FocalPoint will not
have the desired effect.

I notice that you are using an interactor.  Don't (at least not yet).
Get it working with a static renderer before you try to get it working
with an interactor.

Just choose an Origin and Normal for that define a slice plane that
you want to see, and then use these to compute the FocalPoint and
Distance for the camera that will make the camera's focal plane the
same as that chosen slice plane (use the methods that I described in
my previous email).

 - David


On Mon, Oct 22, 2012 at 1:15 PM, Debjit Ghosh <dghosh at chla.usc.edu> wrote:
> Thank you David. So I have been working on the camera alone and here is what
> I have done:
>
> Fixing the focal point as the center of the volume I have realized is
> essential to centering the image on the screen.
>
> vtkSmartPointer<vtkCamera> cam = ren->GetActiveCamera();
> cam->SetPosition(x,y,z);
> cam->SetViewUp(0, 0, -1);
> cam->SetFocalPoint(dimX/2, dimY/2, dimZ/2);
> interactor->Render();
>
> (with the SliceFacesCamera ON and SliceAtFocalPoint OFF)
>
>
> Now, with regards to setting up of position: you mentioned that I need to
> apply the formula,
> Position[0] = FocalPoint[0] + distance*normal[0];
> Position[1] = FocalPoint[1] + distance*normal[1];
> Position[2] = FocalPoint[2] + distance*normal[2];
>
> My question is:
> a) How are you relating "roll and pitch" to distance?
> b) Here you say that I am to multiply distance to the normal vector, but
> when I am using the vtkCamera object as mentioned above, the normal is
> controlled by the position variable itself? So there is no variable as the
> normal
> c) By setting the focal point to the center of the volume, will I still be
> able to slice the volume starting from the tip of the cone till the base? My
> slicing always has to start from the tip of the cone - only then will my
> visualizations always be as in image 1 (slice starting from the tip of the
> cone), and never anything else like image 2, image 3 (slice starting from
> elsewhere).
>
> I have also added an image of the 3D volume so this will help make the idea
> of slicing from the tip of the cone simpler.
> <http://vtk.1045678.n5.nabble.com/file/n5716760/3D_View_of_the_volume.png>
> <http://vtk.1045678.n5.nabble.com/file/n5716760/Image_1.png>
> <http://vtk.1045678.n5.nabble.com/file/n5716760/Image_2.png>
> <http://vtk.1045678.n5.nabble.com/file/n5716760/Image_3.png>



More information about the vtkusers mailing list