[vtkusers] SetCutPlane not working in vtkImageResliceMapper

David Gobbi david.gobbi at gmail.com
Mon Oct 15 16:57:42 EDT 2012


Just a short addendum to my last email, that might make the
SliceFacesCamera option easier to understand.

When SliceFacesCamera and SliceAtFocalPoint are on, the
vtkImageResliceMapper will automatically set the SlicePlane
to the focal plane.  The "focal plane" is the plane that faces
the camera and passes through the focal point.  In other words,
setting the camera's FocalPoint sets the "Origin" of the slice
plane, and moving the camera's Position relative to the focal
point controls the "Normal" of the slice plane.  The slice is
always facing the camera.

 - David

On Mon, Oct 15, 2012 at 2:23 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi Debjit,
>
> If you want to "slap it to the screen" then you need to use
> SliceFacesCameraOn instead of using the vtkPlane to control the
> slicing.
>
> With SliceFacesCameraOn, you can control the slicing by changing the
> pose of the camera (i.e. by changing the Position, FocalPoint, and
> ViewUp).  With SliceFacesCameraOn, you cannot change the slicing with
> the vtkPlane (because SliceFacesCameraOn overrides the vtkPlane).
> However, from what you are trying to do, it sounds like
> SliceFacesCameraOn + camera positioning is a much better way for you
> to control the slicing than with the vtkPlane.
>
>  - David
>
>
> On Mon, Oct 15, 2012 at 11:56 AM, Debjit Ghosh <dghosh at chla.usc.edu> wrote:
>> Thank you very much. You are right!
>>
>>
>>
>> So I turned SliceFacesCamera Off and it SetSlicePlane with a vtkPlane
>> object. Now, though the corresponding slice has been extracted, there are
>> two issues that I face, that I would appreciate your advice on, immensely.
>>
>>
>>
>> - The image is getting visualized as a plane slanted in 3D space which I had
>> to move with Shift + LeftMousePressed to align - How do I slap it onto the
>> screen so it is straight?
>>
>> - I was updating the normal in a Timer and incrementing it to test whether I
>> can do this dynamically and it took effect only the first time
>>
>>
>>
>> Perhaps it's due to my lack of experience in 3D slicing but these are the
>> updates that I have tried calling:
>>
>>
>>
>>                TimerEvent()
>>
>>                {
>>
>>                                              vtkSmartPointer<vtkPlane>
>> slicePlane = vtkSmartPointer<vtkPlane>::New();
>>
>>                                              slicePlane =
>> resliceMapper->GetSlicePlane();
>>
>>                                              slicePlane->Print(std::cout);
>>
>>                                              x+=0.01; y +=0.01; z+=0.01;
>>
>>                                              slicePlane->SetNormal(x, y, z);
>>
>>                                              slicePlane->SetOrigin(103.5,
>> 111.5, 175.5);
>>
>>
>> resliceMapper->SetSlicePlane(slicePlane);
>>
>>
>>
>>                                              resliceMapper->Modified();
>>
>>                                              imageSlice->Render(renderer);
>>
>>
>>
>>                                              renderer->ResetCamera();
>>
>>                                              interactor->Modified();
>>
>>                                              interactor->Render();
>>
>>                }
>>
>>
>>
>> Basically, I have tried all the possible updates that I could :| But in
>> vain. Could you please advise which update needs to be called?
>>
>>
>>
>> Thank you!
>>
>>
>>
>>
>>
>> From: David Gobbi [via VTK] [mailto:ml-node+[hidden email]]
>>
>> Sent: Friday, October 12, 2012 5:23 PM
>> To: Ghosh, Debjit
>> Subject: Re: SetCutPlane not working in vtkImageResliceMapper
>>
>>
>>
>> Hi Debjit,
>>
>> You probably have SliceFacesCamera turned on for the mapper.  This
>> will override any plane that you set manually.
>>
>> If you are using SliceFacesCamera and SliceAtFocalPoint, then the way
>> to change the slice is by changing the camera's position and focal
>> point.
>>
>>  - David
>>
>>
>> On Fri, Oct 12, 2012 at 6:01 PM, Debjit Ghosh <[hidden email]> wrote:
>>> I have been facing an issue where I called the SetSlicePlane(vtkPlane*)
>>> with
>>> a normal and/or an origin but the visualization didn't change. I had
>>> called
>>> the interactor->Render(), called the Modified() on the ImageResliceMapper
>>> but neither made the difference.
>>>
>>> It would be great if someone could tell me what I am missing here.



More information about the vtkusers mailing list