[vtkusers] Issues with coordinate conversion, possible VTK bugs?

Bill Q bill.q.hdp at gmail.com
Tue May 23 09:40:41 EDT 2017


Hi Dan,
Thanks a lot for the reply. Yes, that's exactly the case. If I remove the
text actors, the world picker would return the correct coordinates. So,
what method should I use in order to get the correct coordinates no matter
how many actors I put in with the dicom image reader actor?

Many thanks.


Bill

On Mon, May 22, 2017 at 10:04 PM, Dan Lipsa <dan.lipsa at kitware.com> wrote:

> Bill,
> For display_to_world, the picker picks up only what is visible (closes to
> the camera). You might have several objects (several values in world
> coordinates) that end up over the same display coordinate. This might
> explain why adding those text actors changes what you pick.
>
> Dan
>
>
>
> On Sun, May 21, 2017 at 5:25 AM, Bill Q <bill.q.hdp at gmail.com> wrote:
>
>> Can anybody help? Many thanks.
>>
>> Many thanks.
>>
>>
>> Bill
>>
>> On Fri, May 19, 2017 at 11:20 PM, Bill Q <bill.q.hdp at gmail.com> wrote:
>>
>>> Hello Everyone,
>>> I encountered a weird problem in coordinate conversion.
>>>
>>> In order to check the accuracy, I converted from display to world, and
>>> from world back to display. Using the following ways:
>>>
>>>
>>> *self.world_picker = vtk.vtkWorldPointPicker()*
>>>
>>> *def *display_to_world(self, pt):
>>>     self.world_picker.Pick(pt[0], pt[1], 0, self.ren)
>>>     picker_pt = self.world_picker.GetPickPosition()
>>>     picker_pt = (picker_pt[0], picker_pt[1], 0)
>>>     *return *picker_pt
>>>
>>> *def *world_to_display(self, pt):
>>>     *if *len(pt) == 3:
>>>         pt = pt + (1.0,)
>>>     *elif *len(pt) == 2:
>>>         pt = pt + (0.0, 1.0)
>>>     self.ren.SetWorldPoint(pt)
>>>     self.ren.WorldToDisplay()
>>>     pt = self.ren.GetDisplayPoint()
>>>     pt = (pt[0], pt[1])
>>>     *return *pt
>>>
>>> pt = [5, 5]
>>>
>>> world_pt = self. world_to_display(pt)
>>>
>>> display_pt = self. world_to_display(world_pt)
>>> In some cases, it's quite accurate, which means pt equals display_pt.
>>> But, in some cases, the result is simply wrong. For example, for (5, 5),
>>> after conversions back to display, the coordinate becomes (20.89, 20.89).
>>>
>>> Any ideas?
>>>
>>>
>>> Many thanks.
>>>
>>>
>>> Bill
>>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170523/6660f6ea/attachment.html>


More information about the vtkusers mailing list