Hi Michela,
sure, you can store as many point sets into one data storage as you like.
But you are right, you will have to be sure, that the right one receives your
events.
One way to do that is to explicitly add pointsetinteractor1 to
GlobalInteraction if you want to set points onto image1
and removing this interactor afterwards. If you want to set points onto image2,
you add PSinteractor2 to GlobalInteraction. Then the two interactors don't
interfere with each other.
See mitk\Modules\QmitkExt\QmitkPointListWidget for a widget, that shows points
in a table and has a button to add and remove an interactor to
GlobalInteraction.
It is used by the bundle PointBasedRegistration
(http://docs.mitk.org/nightly-qt4/org_8pointbased_8reg.html) ; yet in a more
unstructured way, but as I mentioned in the previous post, a widget building up
a correspondence between two pointsets (point 1 from ps1 corresponds to point 5
from ps2...) is on the way.
But generally speaking, doesn't the above mentioned bundle fulfill the
requirements?
Best Regards,
Ingmar
Von: Michela Schorta [mailto:[email protected]]
Gesendet: Mittwoch, 10. November 2010 13:54
An: Wegner Ingmar
Cc: [email protected]
Betreff: Re: [mitk-users] set points in two pic files
Dear Ingmar,
thank you for your fast answer.
We want to realize a registration between two pictures, but for now we only
want to try a simple one with landmarks.
The points we'd like to set on the pictures will be our landmarks. So we will
need to have two pointsets, which can't be realized with one datastorage, or
can it?
Is it possible to build up two GlobalInteractions? I've tried it over the
simple constructor with two different names, but it didn't work either and made
the same thing like before.
Best, Michela
Am 09.11.2010 15:48, schrieb Wegner Ingmar:
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]<mailto:[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