[vtkusers] Picking in DICOM series

Duster U aralol2015 at gmail.com
Tue Sep 19 07:17:20 EDT 2017


Hi,
Below my code that i tried to pick the coordinates has been given.Please
reply if any modifications needs to be done,or if my approach is wrong

Thanks in Advance


void MyVtkInteractorStyleImage::OnMouseMove()
{
    //std::cout << "Picking pixel: " <<
this->Interactor->GetEventPosition()[0]<< " " <<
this->Interactor->GetEventPosition()[1] << std::endl;

this->Interactor->GetPicker()->Pick(this->Interactor->GetEventPosition()[0],
                       this->Interactor->GetEventPosition()[1],
                       0,  // always zero.

 this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer());

    double pos[3];
    this->Interactor->GetPicker()->GetPickPosition(pos);
   //std::cout << "Picked value: " << pos[0] << " " << pos[1] << " " <<
pos[2] << std::endl;

     int x = pos[0];
     int y = pos[1];
     std::cout << "(x,y) = (" << x << "," << y << ")" << std::endl;
     vtkSmartPointer<vtkCoordinate> coordinate =
                  vtkSmartPointer<vtkCoordinate>::New();
     coordinate->SetCoordinateSystemToWorld();
     coordinate->SetValue(x,y,0);
     double* world = coordinate->GetValue();
     std::cout << "World coordinate: " << world[0] << ", " << world[1] <<
", " << world[2] << std::endl;



    // Forward events
    vtkInteractorStyleImage::OnMouseMove();

}


On Mon, Sep 18, 2017 at 5:16 PM, Duster U <aralol2015 at gmail.com> wrote:

> Hi Liu Peng,,
>
> Thanks for the reply.Let me try the different coordinate system and will
> let u know if it works.
>
> Thanks
>
> On Sat, Sep 16, 2017 at 9:53 AM, Liu_tj <tjlp at netease.com> wrote:
>
>> As there are several kind of coordinate system in VTK, you need to check
>> the check values are world, viewport, normalized viewport coordinate.
>>
>> Perhaps you can post your code here and the forum guys can help you.
>>
>> Thanks
>>
>> 在2017-09-15,"Duster U" <aralol2015 at gmail.com> 写道:
>>
>> -----原始邮件-----
>> *发件人:*"Duster U" <aralol2015 at gmail.com>
>> *发送时间:*2017年09月15日 星期五
>> *收件人:*"Liu_tj" <tjlp at netease.com>
>> *抄送:*"vtkusers" <vtkusers at vtk.org>
>> *主题:*Re: [vtkusers] Picking in DICOM series
>>
>>
>> Hi Liu Peng,
>>
>> I have tried different dicom samples of different resolutions.When i use a sample of 320*320,the max value that i get from the picker is 150*150,and this too varies with samples.when i tried with another 320*320 sample max value that i got was 160*160.
>>
>>
>> Thanks
>>
>>
>> On Thu, Sep 14, 2017 at 5:50 PM, Liu_tj <tjlp at netease.com> wrote:
>>
>>> How do you know the values are wrong?
>>>
>>>
>>>
>>> 在2017-09-14,"Duster U" <aralol2015 at gmail.com> 写道:
>>>
>>> -----原始邮件-----
>>> *发件人:*"Duster U" <aralol2015 at gmail.com>
>>> *发送时间:*2017年09月14日 星期四
>>> *收件人:*"vtkusers" <vtkusers at vtk.org>
>>> *主题:*[vtkusers] Picking in DICOM series
>>>
>>>
>>>
>>> Hi,
>>>
>>> I've been trying to implement a Picker in the OnMouseMove of a custom
>>> vtkinteractorstyleImage,so that i can get the pixel coordinates of an image
>>> while hovering over an image.Now I've tried both the Point Picker and the
>>> Prop Picker to do so,,both gives the coordinates but the problem is that
>>> the values are not correct.So am i missing anything?
>>> and i am new to vtk,So please help me out
>>>
>>> Thanks in Advance
>>>
>>>
>>>
>>>
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170919/3da46a91/attachment.html>


More information about the vtkusers mailing list