[vtkusers] VtkResliceImageViewer cordinate system (world and display)

sfaisalali91 sfaisal.ali91 at gmail.com
Wed Nov 21 08:30:08 EST 2018


I modified my call back to pick a point and add a node on it , strangely i
realized that when ever i click on the image, the prop picker returns NULL! 
Please can any one help me with this, i am using 3 vtkResliceImageViewers
with orientations set to axial, coronal and saggital. and below is my call
back for picking a point on sagittal view.

if (ev == vtkCommand::LeftButtonPressEvent)
{
    vtkRenderWindowInteractor *rwi = dynamic_cast< vtkRenderWindowInteractor
* >(caller);
    int X = rwi->GetEventPosition()[0];
    int Y = rwi->GetEventPosition()[1];

    // Okay, making sure that the pick is in the current renderer
    if (!this->RIW[0]->GetRenderer() ||
!this->RIW[0]->GetRenderer()->IsInViewport(X, Y))
    { return; }
    
    //PropPicker Initialized earlier
    this->PropPicker->Pick(X, Y, 0.0, this->RIW[0]->GetRenderer());
    vtkAssemblyPath* path = this->PropPicker->GetPath();
    
    int found = 0;
    int i;
    if (path != NULL)
      {
	// lets consider the possibility that we may be using a shared picker
	vtkCollectionSimpleIterator sit;
	path->InitTraversal(sit);
	vtkAssemblyNode *node;
	for (i = 0; i < path->GetNumberOfItems() && !found; ++i)
	{
	  node = path->GetNextNode(sit);
	  if (node->GetViewProp() == this->Prop)
	  {
	    found = 1;
	  }
	}
      }

     if (found)
	{
	  double q[3];
	  this->PropPicker->GetPickPosition(q);
          
           for (int i = 0; i < 3; i++)
	   {
	       NodeCreation(this->RIW[i], q[0], q[1], q[2]);
	       this->RIW[i]->Render();
	    }
	 }
	 else
	{
             // the above implementation Always returns Null with no paths
detected! why ???
	     return;
	}
}

Please can some one help me with this, Thank you. 


Regards 

Ali



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list