Yes! They are essential!
Ok, that's the reason.
The interactors have to set themselves into deselected mode (GlobalInteraction
asks CanHandleEvent befor the next event is passed to interactor) once a point
has been added. The pointset interaction pattern within the patch has been
modified to cause this. You can diff the files to see the changes.
So patch statemachin.xml as well and the state machines should work as expected.
Best Regards,
Ingmar
Von: Michela Schorta [mailto:[email protected]]
Gesendet: Mittwoch, 17. November 2010 13:32
An: Wegner Ingmar
Cc: [email protected]
Betreff: Re: [mitk-users] set points in two pic files
Hi Ingmar,
yes I'm quite sure. As I said, the CanHandleEvent method returns 0 for the
interactor that should not handle the event. Still it seems that the actions
are always executed by the first interactor.
When I limit the points to be set (pass n to the constructor of the interactor)
it partly works. After all points of interactor1 are used up, the events are
handled by interactor2...
Are the changes to the statemachine xml essential? I didn't change anything
there...
Cheers, Michela
Am 16.11.2010 16:16, schrieb Wegner Ingmar:
Hi Michaela,
are you sure?
Are the points in the one image (middle image) rendered in green and the others
(right image) in blue?
The color properties "unselectedcolor" are not dependent on the window, they
are dependent on the data. I haven't debugged the code yet, but in my tutorial
step application the pointsets (data) behave like they should.
The PointSetInteractor uses the one data that is specified during construction
(data connected to given DataNode).
Best Regards,
Ingmar
Von: Michela Schorta [mailto:[email protected]]
Gesendet: Dienstag, 16. November 2010 15:46
An: Wegner Ingmar
Cc: [email protected]<mailto:[email protected]>
Betreff: Re: [mitk-users] set points in two pic files
Dear Ingmar,
I adapted my code implementing the changes you proposed. The points are
rendered correctly, e.g the points are rendered in the correct renderwindow.
Nevertheless, when I access the points on the pointSetNode all the points are
stored in the same pointSetNode.
Is the pointSetInteractor using a global instance of pointSetNode to add the
points? I check if the node used in the CanHandleEvent method of my own
interactor is the same as the one passed at instantiation, and it is. Still the
points are not added to that specific node...
Any suggestions what I might be doing wrong?
Thanks and regards
Am 12.11.2010 15:31, schrieb Wegner Ingmar:
Dear Michela,
I have created a bug with an attached patch to show how to implement the
interaction you need for step5.
See bug 6047 for more details and the patch
http://bugs.mitk.org/show_bug.cgi?id=6047
The patch modifies tutorial step5:
loading two different images,
visualizing them independently in two widgets,
defining a pointset and pointsetinteractor for each image
and dividing the interaction so that points for the one image can only be added
in the one window and vice versa
You can apply the patch to the core and test it on tutorial Step5.
Short explanation on the patch: It contains a new class
NodeDependentPointSetInteractor, that is derived from PointSetInteractor and
derives method CanHandleEvent. Within this method a check on the render
specific visibility property of one specified dataNode is done. If the event
was sent by a renderwindow in which the specified data node is visible, the
standard procedure for checking the possibility to handle an event is
processed. If not, 0 is returned and thus the event rejected.
I hope this helps to clear things up. I will check the changes more thoroughly
and commit them to the trunk once accepted.
Best Regards,
Ingmar
Von: Michela Schorta [mailto:[email protected]]
Gesendet: Mittwoch, 10. November 2010 13:54
An: Wegner Ingmar
Cc: [email protected]<mailto:[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");
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users