[vtkusers] Picking in DICOM series

Liu_tj tjlp at netease.com
Thu Sep 21 22:50:12 EDT 2017


Hi, Duster,

Below is my code (I use a vtkpoitwidget). Not sure whether it is helpful to you.

              int clickpoint[2];
                double pickpoint[3];
                _widget->GetInteractor()->GetEventPosition(clickpoint);
                vtkCellPicker* picker = vtkCellPicker::New();
                picker->SetTolerance(0.0005);
                picker->Pick(clickpoint[0], clickpoint[1], 0, _widget->GetCurrentRenderer());
                picker->GetPickPosition(pickpoint);


Thanks.


在2017-09-19,"Duster U" <aralol2015 at gmail.com> 写道: -----原始邮件-----
发件人:"Duster U" <aralol2015 at gmail.com>
发送时间:2017年09月19日 星期二
收件人:"Liu_tj" <tjlp at netease.com>
抄送:"vtkusers" <vtkusers at vtk.org>
主题:Re: Re: [vtkusers] Picking in DICOM series


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/20170922/480289e7/attachment.html>


More information about the vtkusers mailing list