Hi Tangi,

If you haven’t already loaded a dataset, the renderer probably doesn’t have a 
correct view geometry. Just rightclick a node in the datamanager and select 
“Global Reinit”. This should reset the views so that the global bounding box 
includes all existing objects at their current positions. You can get the same 
by calling
mitk::RenderingManager::GetInstance()->InitializeViews(myDataStorage->ComputeBoundingGeometry3D(myDataStorage
 ->GetAll()));  // reset render window geometry to include all objects

Best Regards,
  Jochen


Von: Tangi Meyer [mailto:[email protected]]
Gesendet: Donnerstag, 19. November 2009 14:13
An: [email protected]
Betreff: [mitk-users] [CAMDASS] Camera viewport control and other IGT stuff.

Dear MITK users,

I'm trying to use IGT with our Polaris Spectra Passive Toolkit.

The IGT example module is used as a basis. So I've rebuilt a plugin which uses 
most of the original IGT example plugin (I removed all recording and plotting).

My primary goal is to track and visualize the NDI rigid bodies into the 3D 
window from the standard view.

So I reused code parts from the IGT tutorial and IGT testing.

Basically:

Draw a cone associated to my NDI device

  mitk::Cone::Pointer cone = mitk::Cone::New();                 //instantiate a 
new cone
  float scale[] = {100.0, 100.0, 100.0};
  cone->GetGeometry()->SetSpacing(scale);                       //scale it a 
little that so we can see something
  mitk::DataTreeNode::Pointer node = mitk::DataTreeNode::New(); //generate a 
new node to store the cone into
  //the DataStorage.
  node->SetData(cone);                          //The data of that node is our 
cone.
  node->SetName("My tracked object");           //The node has additional 
properties like a name
  node->SetColor(1.0, 0.0, 0.0);                //or the color. Here we make it 
red.
  this->GetDefaultDataStorage()->Add(node);     //After adding the Node with 
the cone in it to the
  //DataStorage, MITK will show the cone in the
  //render windows.

  //For updating the render windows we use another filter of the MITK-IGT 
pipeline concept. The
  //NavigationDataObjectVisualizationFilter needs as input a NavigationData and 
a
  //PolyData. In our case the input is the source and the PolyData our cone.

  //First we create a new filter for the visualization update.
  m_Visualizer = mitk::NavigationDataObjectVisualizationFilter::New();
  m_Visualizer->SetInput(0, m_Source->GetOutput(0));        //Then we connect 
to the pipeline.
  m_Visualizer->SetBaseData(0, cone);  //After that we have to assign the cone 
to the input

Try to position the viewport camera as the NDI reference camera (in the middle 
of the NDI IR cameras) so that my tracked object is in the field of view.

  mitk::CameraVisualization::Pointer myFilter = 
mitk::CameraVisualization::New();
  //mitk::GlobalInteraction::GetInstance()->Initialize("global");

  // Define position for the navigation data
  mitk::NavigationData::PositionType position;
  position[0] = 0;
  position[1] = 0;
  position[2] = 0;
  // Define orientation for the navigation data
  mitk::NavigationData::OrientationType orientation;
  orientation[0] = 0;
  orientation[1] = 0;
  orientation[2] = 0;
  orientation[3] = 1;

  // set parameters of navigation data
  mitk::NavigationData::Pointer nd1 = mitk::NavigationData::New();
  nd1->SetPosition(position);
  nd1->SetOrientation(orientation);

  myFilter->SetInput(nd1);
  // set renderer
  
myFilter->SetRenderer(mitk::BaseRenderer::GetInstance(m_MultiWidget->mitkWidget4->GetRenderWindow()));
  //Update filter
  myFilter->Update();

In order to make it simple, all this code is in the OnTestNavigation() method 
of the plugin.

I did try to adapt my camera orientation but nothing is visible. Two objects 
appear in the datamanager: My tracked Object and MyInstrument 0.

It is probably obvious so I'm digging in the documentation but any help is 
appreciated.

Thanks.

Tangi

-------------------------------------
Tangi MEYER
Virtual and Augmented Reality
System and Software Engineer
Leuvensesteenweg 325
B-1932 Zaventem - Belgium
Telephone:  +32 (0) 2 721 54 84
Fax:             +32 (0) 2 721 54 44
-------------------------------------
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to