Thanks Sascha,
the problem still persists ...
so, just to be sure: where should I put the .xml files? In
Modules\Segmentation\Resources or in
Plugins\org.mitk.gui.qt.multilabelsegmentation\resources\Interactions ?
Miguel, have you tried adding Sascha's latest suggestion? Where are you
having your Interactions folder with the .xml files?
For the sake of clarity, I will summarize below what we have so far:
1) I have added the following files in my plugin folder:
Plugins\org.mitk.gui.qt.multilabelsegmentation\resources\Interactions\SegmentationInteraction.xml
Plugins\org.mitk.gui.qt.multilabelsegmentation\resources\Interactions\ConfigSegmentation.xml
2) I have added the following CMake code in files.cmake:
set(CPP_FILES)
usFunctionEmbedResources(CPP_FILES
LIBRARY_NAME "org_mitk_gui_qt_multilabelsegmentation"
ROOT_DIR resources
FILES Interactions/SegmentationInteraction.xml
Interactions/ConfigSegmentation.xml
)
3) The following code in my plugin's mitkPluginActivator:
#include <usModuleInitialization.h>
Q_EXPORT_PLUGIN2(org_mitk_gui_qt_multilabelsegmentation,
mitk::PluginActivator)
US_INITIALIZE_MODULE("Segmentation",
"org_mitk_gui_qt_multilabelsegmentation")
4) a method in my view:
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() );
}
}
the .xml files are not found
thank you,
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
>
>
> On 12/04/2013 06:11 PM, Sebastian Ordas wrote:
>> ok, the crash was my fault: I left something uninitialized in the plugin
>> destructor
>>
>> now the remaining issue is that the .xml files are not found...
>>
>> will come back with the end of this story ...
>>
>> best regards,
>> sebastian
>>
>> On 04/12/2013 12:53 p.m., Sebastian Ordas wrote:
>>> thank you Sascha,
>>>
>>> so, summarizing what I have done so far:
>>>
>>> Objective: add my own display interactor from a plugin (not in a
>>> module)
>>>
>>> 1) I have added the following files in my plugin folder:
>>>
>>> Plugins\org.mitk.gui.qt.multilabelsegmentation\resources\Interactions\SegmentationInteraction.xml
>>>
>>>
>>>
>>> Plugins\org.mitk.gui.qt.multilabelsegmentation\resources\Interactions\ConfigSegmentation.xml
>>>
>>>
>>>
>>>
>>> 2) I have added the following CMake code in files.cmake:
>>>
>>> set(CPP_FILES)
>>>
>>> usFunctionEmbedResources(CPP_FILES
>>> LIBRARY_NAME "org_mitk_gui_qt_multilabelsegmentation"
>>> ROOT_DIR resources
>>> FILES Interactions/SegmentationInteraction.xml
>>> Interactions/ConfigSegmentation.xml
>>> )
>>>
>>> 3) The following code in my plugin's mitkPluginActivator:
>>>
>>> #include <usModuleInitialization.h>
>>>
>>> Q_EXPORT_PLUGIN2(org_mitk_gui_qt_multilabelsegmentation,
>>> mitk::PluginActivator)
>>> US_INITIALIZE_MODULE("Segmentation",
>>> "org_mitk_gui_qt_multilabelsegmentation")
>>>
>>> 4) a method in my view:
>>>
>>> void QmitkMultiLabelSegmentationView::InitializeListeners()
>>> {
>>> if (m_Interactor.IsNull())
>>> {
>>> us::ModuleContext* moduleContext = us::GetModuleContext();
>>> m_Interactor = mitk::SegmentationInteractor::New();
>>> m_Interactor->LoadStateMachine( "SegmentationInteraction.xml");
>>> /// crashes here
>>> m_Interactor->SetEventConfig ( "SegmentationConfig.xml");
>>> us::GetModuleContext()->RegisterService<mitk::InteractionEventObserver>(
>>>
>>> m_Interactor.GetPointer(), us::ServiceProperties() );
>>> }
>>> }
>>>
>>> 5) I will build in debug mode and see why it crashes there ...
>>>
>>> more soon,
>>> sebastian
>>>
>>> On 04/12/2013 11:40 a.m., Sascha Zelzer wrote:
>>>> On 12/04/2013 03:28 PM, Sebastian Ordas wrote:
>>>>> Dear List,
>>>>>
>>>>> the following line of code :
>>>>>
>>>>> m_ServiceRegistration =
>>>>> us::GetModuleContext()->RegisterService<mitk::InteractionEventObserver>(m_CurrentObserver.GetPointer(),
>>>>>
>>>>>
>>>>>
>>>>> props);
>>>>>
>>>>> is giving me a link error as below:
>>>>>
>>>>> Error 1 error LNK2019: símbolo externo "class
>>>>> us::ModuleContext *
>>>>> __cdecl us::GetModuleContext(void)"
>>>>> (?GetModuleContext@us@@YAPEAVModuleContext@1@XZ) sin resolver al
>>>>> que se
>>>>> hace referencia en la función "protected: void __cdecl
>>>>> QmitkMultiLabelSegmentationView::InitializeListeners(void)"
>>>>> (?InitializeListeners@QmitkMultiLabelSegmentationView@@IEAAXXZ)
>>>>> D:\binX64\mitk\MITK-build\Plugins\org.mitk.gui.qt.multilabelsegmentation\QmitkMultiLabelSegmentationView.obj
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> It looks like I'm missing some link dependency to CppMicroServices
>>>>> from
>>>>> my plugin, right?
>>>>>
>>>>> Any hint is greatly welcome!
>>>>>
>>>>> regards
>>>>> sebastian
>>>>>
>>>> Hi Sebastian,
>>>>
>>>> please read the "Add a new state machine" thread from the mailing
>>>> list.
>>>>
>>>> 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
>
------------------------------------------------------------------------------
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