[vtkusers] picking vtkImageSlice using vtkCellPicker?
Miro Drahos
mdrahos at robodoc.com
Thu Mar 20 16:17:20 EDT 2014
Hi David,
thank you for your prompt response.
I am using VTK 5.10 and doing nothing special as far as I can tell. Here
is some more details:
I have a vector of vtkSmartPointer<vtkImageSlice> objects to display
images [my 3D CT image has several segments with different slice
thicknesses, so that's why I have a vector of them]. All the reslicing
and visualization is working as expected, so I don't suspect an issue
there.
Now I am observing LeftMouseEvent of the interactor and processing it in
my callback class to recognize when the surface model is picked. If it
is, then user can translate and rotate it. The callback class is derived
from both vtkCommand and QObject (to be able to use signal/slots of Qt
that this is part of) and I am implementing FindPickedActor(int x, int
y) method as I have seen it throughout VTK many times.
I have tried to use different pickers, and decided for vtkCellPicker
instead of vtkPropPicker, to be able to set tolerance (user can make the
surface model transparent and then might want to pick just the outline
-- intersection of the surface and the image reslice plane. Picking
outline is hard with no tolerance).
Picking surface model works just fine.
Here is the Print() of one of my vtkImageSlice instance:
vtkImageSlice (0x4ecbd30)
Debug: Off
Modified Time: 64690
Reference Count: 3
Registered Events: (none)
Dragable: On
Pickable: On
AllocatedRenderTime: 860.822
EstimatedRenderTime: 0
NumberOfConsumers: 1
RenderTimeMultiplier: 0.863803
Visibility: On
PropertyKeys: none.
useBounds: 1
IsIdentity: true
Position: (0, 0, 0)
Orientation: (0, 0, 0)
Origin: (0, 0, 0)
Scale: (1, 1, 1)
Bounds:
Xmin,Xmax: (-100, 100)
Ymin,Ymax: (-100, 100)
Zmin,Zmax: (-90.625, -2.5)
UserTransform: (none)
UserMatrix: (none)
Property:
Debug: Off
Modified Time: 64690
Reference Count: 3
Registered Events: (none)
ColorWindow: 260.1
ColorLevel: 119.85
UseLookupTableScalarRange: Off
LookupTable: 0x156088a0
Opacity: 1
Ambient: 0.3
Diffuse: 1
InterpolationType: Linear
LayerNumber: 0
Checkerboard: Off
CheckerboardSpacing: 10 10
CheckerboardOffset: 0 0
Backing: Off
BackingColor: 0 0 0
Mapper:
Debug: Off
Modified Time: 96181
Reference Count: 3
Registered Events: (none)
Executive: 0x4ecc950
ErrorCode: Success
Information: 0x4ecc440
AbortExecute: Off
Progress: 1
Progress Text: (None)
TimeToDraw: 0
ClippingPlanes: (none)
SlicePlane: 0x4691280
SliceAtFocalPoint: Off
SliceFacesCamera: Off
Border: On
Background: Off
NumberOfThreads: 8
JumpToNearestSlice: Off
AutoAdjustImageQuality: On
SeparateWindowLevelOperation: On
ResampleToScreenPixels: On
SlabThickness: 0
SlabType: Mean
SlabSampleFactor: 2
ImageSampleFactor: 1
Interpolator: 0x4ecf330
Bounds: (-100, 100) (-100) (100) (-90.625) (-2.5)
I will make a simple mock program and try to isolate the problem.
Thank you once again!
Miro
On 03/20/2014 12:31 PM, David Gobbi wrote:
> Hi Miro,
>
> You'll have to provide more details, because I use vtkCellPicker on
> vtkImageSlice all the time. It's even part of the nightly VTK testing.
> Is there anything special about the way you use the vtkImageSlice?
> What version of VTK are you using?
>
> David
>
> On Thu, Mar 20, 2014 at 1:15 PM, Miro Drahos <mdrahos at robodoc.com> wrote:
>> Hi all,
>> I am rendering an image slice using vtkImageSlice and a surface (vtkActor).
>> When I perform picking using vtkCellPicker, I always pick the surface actor,
>> even if it is in the background, behind the vtkImageSlice.
>> If I try to pick the vtkImageSlice (and the ray does not intersect the
>> surface actor), the Pick() method returns 0, as well as picker->GetPath()
>> returns NULL. The vtkImageSlice is set to be pickable.
>> I am quite baffled by this, since I'd expect to be able to pick
>> vtkImageSlice with vtkCellPicker, since it is a vtkProp3D.
>> If I use vtkPropPicker, I can pick the image slice fine, but I would prefer
>> to use vtkCellPicker so that I can specify picking tolerance.
>> Can someone shed some light on this?
>> Thank you tons!
>> Miro
More information about the vtkusers
mailing list