[vtkusers] ROI via RubberRect [RE: Drawing on vtkImageViewer]

Nigel Nunn nNunn at ausport.gov.au
Thu May 30 11:28:24 EDT 2002


> I load a stack of image and visualize it with vtkImageViewer 
> well now I would to draw a rect for select a region of 
> interest (ROI)... 
 
Have not used vtkImageViewer, and do understand TCL, but using 
VC++ to get rubberband selection of a rectangular region in a 
vtkWin32OpenGLRenderWindow, I do somat like this: 
 
Switch picker, e.g.:  
 
  if (m_nUserMode != USER_MODE_Select) 
  { 
    m_IRen->SetPicker(m_wpPicker); 
  } 
  else 
  { 
    m_IRen->SetPicker(m_cellPicker); 
  } 
 
 
vtkWorldPointPicker gives smoother picking.  CellPicker jumps 
around to the nearest "pickable" cell, but WorldPointPicker 
simply picks a point from world-space.  You may also need to 
adjust the "Pickable" attribute of the actors in the scene. 
(May also help to switch from camera mode to actor mode.) 
 
------------------------------------------------------- 
OnLButtonDown: 
  OnChar('p',0,0);     // get the picker to grab anchor point

 
------------------------------------------------------- 
OnMouseMove: 
 
  // Let Vtk handler do its thing
  vtkMFCRenderView::OnMouseMove(nFlags, point);

  if (m_bDraggingRect)
  {
    OnChar('p',0,0);     // get the picker to grab second corner
    UpdateRubberRect()   // use the two points to redraw the rectangle
  }
 
------------------------------------------------------- 
OnLButtonUp: 
 
  if (m_bDraggingRect) 
    FinishRectangle(); 
 
This is working very well, but seems too complex. 
Anyone got a simpler way to do it? 
thanks, 
Nigel 


**********************************************************************
This message is intended for the addressee named and may contain 
confidential and privileged information. If you are not the intended 
recipient please note that any form of distribution, copying or use of 
this communication or the information in it is strictly prohibited and 
may be unlawful. If you receive this message in error, please delete it 
and notify the sender.

Keep up to date with what's happening in Australian sport.
Visit http://www.ausport.gov.au
**********************************************************************



More information about the vtkusers mailing list