Discussion:
[mitk-users] problem using my new interaction module
Paolo Cabras
2017-06-09 13:23:03 UTC
Permalink
Hello everyone,

I am new to MITK and I am creating an application using MITK as an
external toolkit. I used 'mitk_create_executable' (in my CMake
project) and I am trying to create my own module for managing the user
interaction. As a start, I copied and (slightly) modified gizmo module
and tried to use the modified version in my GUI. I put the code in
Modules directory within my cmake source directory and organized the
files as in [1].

The build process succeeds, but when I run the application, an exception
is thrown at
'interactor->LoadStateMachine("myStateMachine.xml",us::ModuleRegistry::GetModule("myModule"));'.
Debugging a bit further, it seems that the problem is that
ModuleRegistry::GetModule returns 0, since no module with that name was
found. However, it is recognized when used in
mitk_create_executable(my_app
DEPENDSMitkCoreMitkQtWidgetsExtMitkIGTBasemyModule).

What Am I missing ? Is that possible to create modules like this?
Actually, ModuleRegistry recognizes myModule if I add it within the
Awesome-project as explained in [1].

I am using QtCreator with Qt5.7, win 7, compiler msvc 2013 - 32 bit,
MITK 2016.11.0 .

Thank you for your time.

Best regards,

Paolo


[1] http://docs.mitk.org/2016.03/NewModulePage.html


---- my project CMakeLists.txt ------------

cmake_minimum_required(VERSION 3.2 FATAL_ERROR)

project(myProject)

# MITK

find_package(MITK 2016.03 REQUIRED)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

# QT5

set(CMAKE_AUTOMOC ON)

find_package(Qt5Widgets REQUIRED QUIET)


add_subdirectory(Modules) # where myModule source files are, same path
organization as in [1]

mitk_create_executable(my_app

DEPENDS MitkCore MitkQtWidgetsExt MitkIGTBase myModule

)

--------- module Cmake ----------

MITK_CREATE_MODULE( myModule
INCLUDE_DIRS
PUBLIC include
PRIVATE src
DEPENDS MitkCore
WARNINGS_AS_ERRORS
)
Paolo Cabras
2017-06-21 07:12:01 UTC
Permalink
Hello,

I solved the problem. Some building options and output path were missing
in the CMakeLists.txt . Thank you for your time.

Paolo
Post by Paolo Cabras
Hello everyone,
I am new to MITK and I am creating an application using MITK as an
external toolkit. I used 'mitk_create_executable' (in my CMake
project) and I am trying to create my own module for managing the
user interaction. As a start, I copied and (slightly) modified gizmo
module and tried to use the modified version in my GUI. I put the code
in Modules directory within my cmake source directory and organized
the files as in [1].
The build process succeeds, but when I run the application, an
exception is thrown at
'interactor->LoadStateMachine("myStateMachine.xml",us::ModuleRegistry::GetModule("myModule"));'.
Debugging a bit further, it seems that the problem is that
ModuleRegistry::GetModule returns 0, since no module with that name
was found. However, it is recognized when used in
mitk_create_executable(my_app
DEPENDSMitkCoreMitkQtWidgetsExtMitkIGTBasemyModule).
What Am I missing ? Is that possible to create modules like this?
Actually, ModuleRegistry recognizes myModule if I add it within the
Awesome-project as explained in [1].
I am using QtCreator with Qt5.7, win 7, compiler msvc 2013 - 32 bit,
MITK 2016.11.0 .
Thank you for your time.
Best regards,
Paolo
[1] http://docs.mitk.org/2016.03/NewModulePage.html
---- my project CMakeLists.txt ------------
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project(myProject)
# MITK
find_package(MITK 2016.03 REQUIRED)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# QT5
set(CMAKE_AUTOMOC ON)
find_package(Qt5Widgets REQUIRED QUIET)
add_subdirectory(Modules) # where myModule source files are, same path
organization as in [1]
mitk_create_executable(my_app
DEPENDS MitkCore MitkQtWidgetsExt MitkIGTBase myModule
)
--------- module Cmake ----------
MITK_CREATE_MODULE( myModule
INCLUDE_DIRS
PUBLIC include
PRIVATE src
DEPENDS MitkCore
WARNINGS_AS_ERRORS
)
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
Virus-free. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mitk-users mailing list
https://lists.sourceforge.net/lists/listinfo/mitk-users
--
Paolo Cabras
Research Engineer
Automatic, Vision and Control Team
ICUBE (UMR 7357 CNRS-Université de Strasbourg)
+33 (0) 3 88 11 90 68
Continue reading on narkive:
Loading...