[vtkusers] how to get the mouse position and scalar value on that position i

James Z. stayinmd at yahoo.com
Sat Sep 2 09:26:35 EDT 2006


Hi, Dean,
  
  I tried the  vtkImageCoordinateWidget widget using following codes:
  
  coordWidget->SetViewProp((vtkProp*)(win->ImageViewer->GetImageActor()));
  coordWidget->SetInput(reader->GetOutput()); coordWidget->SetInteractor(win->ImageViewer->GetRenderWindow()->GetInteractor()); 
  coordWidget->DisplayTextOn();
  coordWidget->PlaceWidget();
  coordWidget->SetEnabled(1);
  
  where "ImageViewer" is an object of vtkImageViewer2. I can compile the  codes successfully, but during running the program, when the mouse  moves over the imageviewer, the error appears. The error occurs in  "ProcessEvents" of vtkImageCoordinateWidget. Would you please give me  any idea on how to solve this problem?
  
  Thanks a lot!
  
  James
  

dean.inglis at camris.ca wrote:  James,

wherever you see SetProp, GetProp, or RemoveProp
change the code in the widget to 
SetViewProp, GetViewProp, or RemoveViewProp.
The former methods were deprecated a while ago
from VTK 5.0+ due to name conflictswith some
Microsoft SDK methods.

Dean


> 
> From: "James Z." 
> Date: 2006/08/29 Tue AM 05:59:47 GMT-04:00
> To: dean.inglis at camris.ca
> Subject: Re: Re: [vtkusers] how to get the mouse position and scalar value on that position i
> 
> hi, Dean,
>   
>   I just tried "SetViewProp", and it shows the following error:
>   
>   error C2039: 'SetViewProp' : is not a member of 'vtkImageCoordinateWidget'
>   
>   Sorry to bother you again. I hope to get some idea from you!
>   
>   Regards,
>   
>   James
> 
> dean.inglis at camris.ca wrote:  try SetViewProp
> 
> > 
> > From: "James Z." 
> > Date: 2006/08/28 Mon AM 10:35:06 GMT-04:00
> > To: dean.inglis at camris.ca
> > Subject: Re: Re: [vtkusers] how to get the mouse position and scalar value on that position i
> > 
> > Hi, Dean,
> >   
> >   Thank you very much for your reply.
> >   
>  > Your reply solves part of my problem. But there is still a  problem: the method "SetProp()" is always compiled as "SetPropA()" in  my program even if I write "SetProp()" in my program. So duing the link  stage, the following error appears:
> >   
> > error  LNK2001: unresolved external symbol "public: void __thiscall  vtkImageCoordinateWidget::SetPropA(class vtkProp *)"  (?SetPropA at vtkImageCoordinateWidget@@QAEXPAVvtkProp@@@Z)
> >   
> >   RelWithDebInfo/MyProject.exe : fatal error LNK1120: 1 unresolved externals
> >   Error executing link.exe.
> >   
> >   Would you please give me any information on how to solve this program?
> >   
> >   Many thanks,
> >   
> >   James
> >   
> >   
> > dean.inglis at camris.ca wrote:  Hi James,
> > 
> > just cast to vtkProp since vtkImageActor
> > inherits from it:
> > 
> > coordWidget->SetProp((vtkProp*)(ImageViewer->GetImageActor()));
> > 
> > Dean
> > 
> > >   
> > >   vtkImageCoordinateWidget *coordWidget = vtkImageCoordinateWidget::New();
> > >   coordWidget->SetInput(reader->GetOutput());
> > >   coordWidget->SetProp(ImageViewer->GetImageActor()); // this line has problem
> > >   
> > >   But the last line of the above codes has problem, the error information is as follows:
> > >   
> > >   error C2664: 'SetPropA' : cannot convert parameter 1 from 'class vtkImageActor *' to 'class vtkProp *'
>  > > Types pointed to are unrelated; conversion requires  reinterpret_cast, C-style cast or function-style cast Error executing  cl.exe.
> > 
> > 
> > 
> > 
> >  __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around 
> > http://mail.yahoo.com 
> > 
> 
> 
> 
>    
> ---------------------------------
> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1/min.
> 



 		
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060902/75c88f39/attachment.htm>


More information about the vtkusers mailing list