[vtkusers] vtkPicker returned actor

Lonni Besançon lonni.besancon at gmail.com
Mon Feb 29 09:18:27 EST 2016


Hello David,

Sorry I omitted this detail. Indeed that's exactly what I'm doing. 
Here the complete pipeline:
/vtkSmartPointer<vtkImageData> ima = reslice->GetOutput();
vtkSmartPointer<vtkDataArray> data = ima->GetPointData()->GetScalars();
vtkSmartPointer<vtkTexture> texture = vtkSmartPointer<vtkTexture>::New();
texture->SetInputData(ima);
texture->InterpolateOn();
....
vtkSmartPointer<vtkPolyDataMapper> planeMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
planeMapper->SetInputConnection(plane->GetOutputPort());
...
vtkSmartPointer<vtkActor> planeActor = vtkSmartPointer<vtkActor>::New();
planeActor->SetTexture(texture);
planeActor->SetMapper(planeMapper);/

I tried your solution with the following code:
/if(picker->GetActor() == foo->planeActor){
        picker->PickTextureDataOn();
        double position[3];
        picker->GetMapperPosition(position);
        LOGW("Point position Initial = %f ::: %f :::
%f",position[0],position[1],position[2]);
        double point[4];
        point[0] = position[0] ;
        point[1] = position[1] ;
        point[2] = position[2] ;
        point[3] = 1 ;
        resliceAxes->MultiplyPoint(point, point); // My reslice axes matrix
        LOGW("Position in Volume = %f  ;;  %f  ;;  %f ;;
%f",point[0],point[1],point[2],point[3] );

}
/

Yet the values I get are weird. I tried having the plane parallel to the
screen at a given depth d, and the volume actor not moved at all. The first
log is ok though, it gives me values such as:
0.125766 ::: 0.176741 ::: 0.000000
However the values I get after the multiplication do not seem so good, no
matter where I trick to "click" I always get X value between 51.5 and 52.5 (
X = 51.5 is the middle of the x dimension of my data ), and Y values between
47 and 48 (similarly 47 is the middle of the y dimension of my data).
The depth value I get however correspond very well to the position of my
plane, so I'm guessing this value is good.

Am I doing something wrong? Or maybe the pipeline description I gave you was
not enough.

Thanks again for your help



--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkPicker-returned-actor-tp5736763p5736920.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list