On 12/05/2013 05:17 PM, Miguel Nunes wrote:
Thanks for going through all that work Sascha.
My resources vector has size zero, but a name is printed which is the same I pass on the line:
US_INITIALIZE_MODULE("My Module", "org_proj_plugin")
Maybe something is not right in your CMake files then. Looks like the
generated resource .cpp file was not compiled into the plug-in's shared
library.
I wonder if you could send us your own plugin, sascha, in zip file, so we can
compare, build and run locally.
I attached a patch file where I just added some code to the image
navigator plug-in for testing purposes.
Best,
Sascha
Kind regards,
Miguel
On Thursday, December 5, 2013 16:23 CET, Sascha Zelzer <[email protected]> wrote:
Guys, I just tried it myself and added some interaction xml files to a
plug-in and instantiate a mitk::DataInteractor and loaded the plug-ins
xml files. Everything worked okay so far.
@Sebastian I noticed the your config xml file was written differently in
the files.cmake file and your C++ code.
You can list all embedded resources of your plug-in by doing something
like this:
us::Module* module = us::GetModuleContext()->GetModule();
std::vector<us::ModuleResource> resources = module->FindResources("/", "*",
true);
for (std::vector<us::ModuleResource>::iterator iter = resources.begin(); iter
!= resources.end(); ++iter)
{
MITK_INFO << "[" << module->GetName() << "] resource: " <<
iter->GetResourcePath();
}
- Sascha
On 12/05/2013 03:21 PM, Miguel Nunes wrote:
yes, I confirm.
Also, on the plugin's ..._resources.cpp fie I can see the xml were found and
generated:
static const unsigned char us_resource_data[] = {
// D:\src\* PATH * \resources\Interactions\StatemachineVrvis.xml
0x0,0x0,0x0,0x90,
0x0,0x0,0x0,0xdd,0x55,0x8f,0x4d,0xa,0x2,0x31,0xc,0x85,0xf7,0x9e,0x22,0xe4,
0x2,0x73,0x81,...,
// D:\src\ *PATH*\resources\Interactions\StatemachineVrvisConfig.xml
0x0,0x0,0x0,0xbf,
0x0,0x0,0x1,0x9c,0x95,0x91,0x41,0xe,0x82,0x40,0xc,0x45,0xf7,0x9e,0xa2,0xb2,
0x27,0x5c,...
};
On Thursday, December 5, 2013 15:12 CET, Sebastian Ordas <[email protected]> wrote:
yes, just like this:
void QmitkMultiLabelSegmentationView::InitializeListeners()
{
if (m_Interactor.IsNull())
{
us::ModuleContext* moduleContext = us::GetModuleContext();
m_Interactor = mitk::SegmentationInteractor::New();
m_Interactor->LoadStateMachine( "SegmentationInteraction.xml",
moduleContext->GetModule());
m_Interactor->SetEventConfig ( "SegmentationConfig.xml",
moduleContext->GetModule());
us::GetModuleContext()->RegisterService<mitk::InteractionEventObserver>(
m_Interactor.GetPointer(), us::ServiceProperties() );
}
}
On 05/12/2013 11:10 a.m., Sascha Zelzer wrote:
Just to make sure: Did you call LoadStateMachine("...xml",
GetModuleContext()->GetModule()) using the second argument to provide
the module instance which contains the embedded xml file?
On 12/05/2013 02:38 PM, Miguel Nunes wrote:
Sebastian,
I just tested my plugin and I continue without success. The same
Error remains in the MITK plugin tab says:
" Part initialization error:
D:\src\MITK2013.09.0\Core\Code\Interactions\mitkStateMachineContainer.cpp:73:
Resource not valid. State machine pattern not
found:StatemachineVrvis.xml "
Do you have any new stuff on this issue?
On Thursday, December 5, 2013 13:37 CET, "Miguel Nunes"
<[email protected]> wrote:
Hi Sebastian,
Sorry for taking so long to reply but out of nowhere Poco stopped
working and I am re-buidling the whole MITK framework from scratch,
which takes some hours as u know.
Comparing my code to yours, I can only say we have exactly the same
thing from all points from 1 to 4, except in dont have the line
Q_EXPORT_PLUGIN2(..., mitk::PluginActivator)
And since MITK is not ready yet in my machine I cannot test with
this extra line.
As soon as I am ready, I will email the list.
Best,
Miguel
On Thursday, December 5, 2013 13:21 CET, Sebastian Ordas
<[email protected]> wrote:
Hi Miguel,
Are you still stuck on loading the xml files from your plugin?
Let me know if you have tried the suggestion below. It did not work
for me
best regards,
sebastian
On 04/12/2013 02:29 p.m., Sascha Zelzer wrote:
Hi,
in
m_Interactor->LoadStateMachine( "SegmentationInteraction.xml");
you are not specifying a module as the second argument. It will
default to the "Mitk" module for searching the XML file, which of
course doesn't contain it. Use
m_Interactor->LoadStateMachine( "SegmentationInteraction.xml",
GetModuleContext()->GetModule());
instead. The same goes for the SetEventConfig() method call. I agree
that the documentation is lacking and the API could be improved...
Best,
Sascha
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users
--
VRVis Zentrum fuer Virtual Reality und Visualisierung
Forschungs-GmbH FN: 195369h, HG Wien
Donau-City-Strasse 1 +43(0)1 20501 30100
A-1220 Wien, Austria web:<http://www.vrvis.at>
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users
diff --git a/Plugins/org.mitk.gui.qt.imagenavigator/files.cmake b/Plugins/org.mitk.gui.qt.imagenavigator/files.cmake
index 71882b2..d7ad24a 100644
--- a/Plugins/org.mitk.gui.qt.imagenavigator/files.cmake
+++ b/Plugins/org.mitk.gui.qt.imagenavigator/files.cmake
@@ -30,6 +30,13 @@ foreach(file ${SRC_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/${file})
endforeach(file ${SRC_CPP_FILES})
+usFunctionEmbedResources(CPP_FILES
+ LIBRARY_NAME "org_mitk_gui_qt_imagenavigator"
+ ROOT_DIR resources
+ FILES Interactions/MyInteractor.xml
+ Interactions/MyInteractorConfig.xml
+)
+
foreach(file ${INTERNAL_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/internal/${file})
endforeach(file ${INTERNAL_CPP_FILES})
diff --git a/Plugins/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp b/Plugins/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp
index bfbcf73..b569c29 100644
--- a/Plugins/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp
+++ b/Plugins/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp
@@ -23,6 +23,12 @@ See LICENSE.txt or http://www.mitk.org for details.
#include <berryConstants.h>
+#include <usGetModuleContext.h>
+#include <usModuleContext.h>
+#include <usModule.h>
+#include <usModuleResource.h>
+
+#include <mitkDataInteractor.h>
const std::string QmitkImageNavigatorView::VIEW_ID = "org.mitk.views.imagenavigator";
@@ -56,6 +62,24 @@ void QmitkImageNavigatorView::CreateQtPartControl(QWidget *parent)
mitk::IRenderWindowPart* renderPart = this->GetRenderWindowPart();
this->RenderWindowPartActivated(renderPart);
+
+ us::Module* module = us::GetModuleContext()->GetModule();
+
+ std::vector<us::ModuleResource> resources = module->FindResources("/", "*", true);
+ for (std::vector<us::ModuleResource>::iterator iter = resources.begin(); iter != resources.end(); ++iter)
+ {
+ MITK_INFO << iter->GetResourcePath();
+ }
+
+ mitk::DataInteractor::Pointer interactor = mitk::DataInteractor::New();
+ if (!interactor->LoadStateMachine("MyInteractor.xml", module))
+ {
+ MITK_WARN << "Error loading state machine";
+ }
+ if (!interactor->SetEventConfig ("MyInteractorConfig.xml", module))
+ {
+ MITK_WARN << "Error loading state machine configuration";
+ }
}
void QmitkImageNavigatorView::SetFocus ()
diff --git a/Plugins/org.mitk.gui.qt.imagenavigator/src/internal/mitkImageNavigatorPluginActivator.cpp b/Plugins/org.mitk.gui.qt.imagenavigator/src/internal/mitkImageNavigatorPluginActivator.cpp
index 5dafa9f..335d674 100644
--- a/Plugins/org.mitk.gui.qt.imagenavigator/src/internal/mitkImageNavigatorPluginActivator.cpp
+++ b/Plugins/org.mitk.gui.qt.imagenavigator/src/internal/mitkImageNavigatorPluginActivator.cpp
@@ -19,6 +19,8 @@ See LICENSE.txt or http://www.mitk.org for details.
#include <QtPlugin>
+#include <usModuleInitialization.h>
+
namespace mitk {
void ImageNavigatorPluginActivator::start(ctkPluginContext* context)
@@ -34,3 +36,5 @@ namespace mitk {
}
Q_EXPORT_PLUGIN2(org_mitk_gui_qt_imagenavigator, mitk::ImageNavigatorPluginActivator)
+
+US_INITIALIZE_MODULE("ImageNavigator", "org_mitk_gui_qt_imagenavigator")
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users