Hi,
the explanations from Markus and Christian were tailored for MITK
"Modules" which automatically get a module context via our CMake build
system.
In your case, you are developing a plug-in, which is not a traditional
MITK Module and hence does not get a module context automatically and
also does not evaluate the RESOURCE_FILES CMake variable in the
files.cmake file.
You have three options:
1.) Split your code into a module and a plug-in. The module will contain
the Qt independent interaction stuff.
2.) Embed your xml file as a Qt resource and nag the MITK developers to
enhance the interaction API such that it can also handle std::istream
objects to read xml files from.
3.) Make your plug-in a hybrid by manually adding "module capabilities".
This is what you already did partially by giving it a module context.
For embedding resources "the module way", you need to call the
usFunctionEmbedResources() CMake function yourself to embed your xml
files. See its documentation here:
http://docs.mitk.org/nightly-qt4/group__MicroServicesCMake.html#ga28d86dce8ac374e6563ba3d5fbca225a
Best,
Sascha
On 12/02/2013 05:51 PM, Alyson Roger wrote:
Thank you Markus. The problem I find now is that the linker does not
find the definition of GetModuleContext() in my plugin. After reading
a little more, I've tried to configure a module context in my plugin
this way:
#include <usModuleInitialization.h>
US_INITIALIZE_MODULE("My Module", "org_mycompany_myplugin")
I added those two lines in my plugin activator source file. Now the
linked finds the definition of GetModuleContext, but following the
code in debug mode I get to usModule.cpp line 269:
if (d->resourceTreePtrs.empty())
{
return ModuleResource();
}
where it finds an empty resource tree.
I don't know if I'm not adding correctly the xml files (I'm doing it
exactly as you specified) or I'm not defining the module in my plugin
correctly in the activator.
Thanks,
Aly
2013/12/2 Markus Engel <[email protected]
<mailto:[email protected]>>
Hi Alyson and Miguel,
In order for MITK to correctly find your statmachine patterns you
need to use the MITK resource mechanism as described in
http://docs.mitk.org/nightly-qt4/InteractionMigration.html#IncludeFiles.
What you basically have to do is put your XML file in a folder
following this pattern:
<your-plugin-folder>/resources/Interactions/
(By the way, the names of the folders have to be like that!)
In your files.cmake of your plugin you need to put the following line:
set(RESOURCE_FILES Interactions/dummyStatemachine.xml )
Note that you must NOT add the ‘resources’ to this path!
When you have instantiated your interactor and try to load the
statemachine you will use the method LoadStateMachine()
that has two parameters. The first one is the name of the XML
file, the second one is the module in which the XML file is
actually located.
The code you posted below will look for the XML file in the Core
as no module has been given.
The correct way to do it would be:
us::ModuleContext* moduleContext = us::GetModuleContext();
someInteractor = mitk::MyOwnInteractor::New();
someInteractor->LoadStateMachine( “MyPattern.xml”,
moduleContext->GetModule() );
someInteractor-> SetEventConfig ( “MyConfig.xml”,
moduleContext->GetModule() );
In order for your interactor to receive events from the
renderwindow you need to register it with the cppMicroServices:
us::GetModuleContext()->RegisterService<mitk::InteractionEventObserver>(
someInteractor.GetPointer(), us::ServiceProperties() );
This should make your interactor work correctly.
I hope this helps you on your way to your first interactor!
Greets,
Markus
*Von:*Alyson Roger [mailto:[email protected]
<mailto:[email protected]>]
*Gesendet:* Montag, 2. Dezember 2013 14:55
*Cc:* [email protected]
<mailto:[email protected]>
*Betreff:* Re: [mitk-users] Add a new state machine
Hello Mitk users,
I have been through the mitk code and I can't find where the
PointSet.xml is referenced to be found in the Qt project.
Does someone have a clue to help us solving this state machine issue?
Thank you,
2013/11/29 Miguel Nunes <[email protected] <mailto:[email protected]>>
Hello MITK Team,
I also have this problem, but unfortunately I haven't reach Alyson
stage.
I have gone through the step10 example and the documentation but I
have no idea how to configure the interaction for my own
QmitkRenderWindow. I tried setting it up with a VtkInteractor
that I have in my stand alone vtk application, but it seems mitk
ignores that, and goes back in using the interactor found in
stdmultiwidget thing.
so, my questions are:
1) Where should the xml files be for my plugin?
2) what have I to do to connect to those xml files?
3) what have I to do to connect those interactions (mouse and
keyboard) with the qmitkrenderwindow of my plgin?
Thank you,
Miguel
Em 29-11-2013 16:53, Alyson Roger escreveu:
Hi Mailing List,
I am trying to do something simple : use my own State Machine
in a .xml file for my plug in in the mitkWorkBench. A part in
the tutorial that is not clear to me is how I include my state
machine into the GlobalInteraction. I know the code must be in
the form
m_CurrentInteractor = mitk::PointSetDataInteractor::New();
m_CurrentInteractor->LoadStateMachine("PointSet.xml");
m_CurrentInteractor->SetEventConfig("PointSetConfig.xml");
As Step 10 of the tutorial.
But I would like to know where do I have to put my .xml file
so the LoadStateMachine does not crash when I run my Plug In
with my state machine. I intended to use
InteractionEventHandler::AddEventConfig but it didn't work.
I really hope that someone will be able to help me because I
have been stuck during days with the interaction part, which
is new for me.
Thank you very much
--
*Alyson ROGER*
/[email protected] <mailto:[email protected]>_/
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into
your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of
AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/mitk-users
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business.
Most IT
organizations don't have a clear picture of how application
performance
affects their revenue. With AppDynamics, you get 100% visibility
into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of
AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/mitk-users
--
*Alyson ROGER*
ingénieur diplômée INSA de Lyon
Génie Electronique
06 20 60 07 47
/[email protected] <mailto:[email protected]>_/
--
*Alyson ROGER*
ingénieur diplômée INSA de Lyon
Génie Electronique
06 20 60 07 47
_/[email protected] <mailto:[email protected]>/_
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users