Dear Michela,
the problem is, that there only is one GlobalInteraction and it doesn't 
distinct between two different data storages.
It processes all connected interactors. Because you add both interactors to the 
same GlobalInteraction, it decides, that the first PointSetInteractor, that can 
handle the event as good as the second PSInteractor (method 
PointSetInteractor::CanHandleEvent(...)), receives the event.
Thus the points only get added into the first pointset. (You can check this by 
first adding PointSetInteractor of Node2 to GlobalInteraction and then adding 
PSInteractor of Node1 to it; then points are displayed in the renderWindow2)
If you have to build up two different data storages, you will also have to take 
care of two RenderingManagers, two EventMappers and two GlobalInteractions.

So why not take one data storage, enable renderer specific visualization of the 
images, and using two PointListWidgets to take care of PointSetInteraction.
Actually a colleague is currently working on a CorrespondingPointSetWidget, so 
a widget, that displays the data of two pointsets with correspondence.
Would that be a solution for you or do you have to use two data storages?

If so, we can help with further examples.

Best Regards,
Ingmar

Von: Michela Schorta [mailto:[email protected]]
Gesendet: Dienstag, 9. November 2010 09:22
An: [email protected]
Betreff: [mitk-users] set points in two pic files

Hello

I'd like to code an application which is able to load two files (.pic files) 
and show them in one window. Futhermore I'd like to set points on both 
pictures. For this I copied the code of example 5, but implemented two 
datastorages (for each picture one). The problem is now that setting points on 
the left picure works as it has to, but when I set points on the right picture, 
the points are shown in the left picture. Isn't it possible to create two 
PointSetInteractor? How could I solve this problem? Underneath is my code for 
setting the points and creating and show the window. Thanks for your help in 
advance.



  // Create PointSet and a node for it
  mitk::PointSet::Pointer pointSet1 = mitk::PointSet::New();
  mitk::PointSet::Pointer pointSet2 = mitk::PointSet::New();
  mitk::DataNode::Pointer pointSetNode1 = mitk::DataNode::New();
  mitk::DataNode::Pointer pointSetNode2 = mitk::DataNode::New();
  pointSetNode1->SetData(pointSet1);
  pointSetNode2->SetData(pointSet2);

  // Add the node to the tree
  ds1->Add(pointSetNode1);
  ds2->Add(pointSetNode2);

  // Create PointSetInteractor, associate to pointSetNode and add as
  // interactor to GlobalInteraction

  mitk::GlobalInteraction::GetInstance()->AddInteractor(
    mitk::PointSetInteractor::New("pointsetinteractor", pointSetNode1)
  );
  mitk::GlobalInteraction::GetInstance()->AddInteractor(
    mitk::PointSetInteractor::New("pointsetinteractor", pointSetNode2)
  );

  // Create toplevel widget with horizontal layout
  QWidget toplevelWidget;
  QHBoxLayout layout;
  layout.setSpacing(2);
  layout.setMargin(0);
  toplevelWidget.setLayout(&layout);

  // Create a RenderWindow
  QmitkRenderWindow renderWindow1(&toplevelWidget);
  QmitkRenderWindow renderWindow2(&toplevelWidget);
  layout.addWidget(&renderWindow1);
  layout.addWidget(&renderWindow2);

  // Tell the RenderWindow which (part of) the datastorage to render
  renderWindow1.GetRenderer()->SetDataStorage(ds1);
  renderWindow2.GetRenderer()->SetDataStorage(ds2);

  // Initialize the RenderWindow
  mitk::TimeSlicedGeometry::Pointer geo1 = 
ds1->ComputeBoundingGeometry3D(ds1->GetAll());
  mitk::TimeSlicedGeometry::Pointer geo2 = 
ds2->ComputeBoundingGeometry3D(ds2->GetAll());
  mitk::RenderingManager::GetInstance()->InitializeViews(geo1);
  mitk::RenderingManager::GetInstance()->InitializeViews(geo2);

  // Select a slice
  mitk::SliceNavigationController::Pointer sliceNaviController1 = 
renderWindow1.GetSliceNavigationController();
  if (sliceNaviController1)
    sliceNaviController1->GetSlice()->SetPos( 0 );
  mitk::SliceNavigationController::Pointer sliceNaviController2 = 
renderWindow2.GetSliceNavigationController();
  if (sliceNaviController2)
    sliceNaviController2->GetSlice()->SetPos( 20 );

   // Show window
    toplevelWidget.show();
    toplevelWidget.setWindowTitle("Registrierung");

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to