Commit 1f104974 authored by saubatn's avatar saubatn

FEATURE 144 Add CamiTK Core exposition to Python.

FIXED Missing inclusions of Component/image and Component/Mesh subdirectories.

90% of CamiTK Core is exposed to Python. At the moment, methods using VTK in their signature are not exposed.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1201 ec899d31-69d1-42ba-9299-647d76f65fb3
parent c7ca223c
// local header files
#include <Action.h>
#include <ActionExtension.h>
#include <ActionWidget.h>
<?xml version="1.0"?>
<typesystem>
<!-- CamiTK sdk classes exposition to Python -->
<object-type name="camitk::Action" />
<object-type name="camitk::ActionExtension" />
<enum-type name="camitk::Action::ApplyStatus" />
<object-type name="camitk::ActionWidget" />
</typesystem>
// local header files
#include <MainWindow.h>
#include <Application.h>
#include <SettingsDialog.h>
......
......@@ -23,6 +23,8 @@
// Shiboken asks to call %FUNCTION_NAME in the injected code
// here we don't need it ( %0 = (%CPPTYPEWrapper *)%CONVERTTOPYTHON[camitk::%CPPTYPE](app); doesn't work)
// simply delete it and directly call application wrapper
// TODO : understand how the conversion / wrapper handle objects
// If we comment the 2 above lines, the imp application (throught imp.py) will seg fault at runtime.
camitk::%CPPTYPE* app = new %FUNCTION_NAME(%1, argc, argv, %4, %5);
delete app;
......@@ -32,6 +34,7 @@
</inject-code>
</modify-function>
</object-type>
<object-type name="camitk::SettingsDialog" />
</typesystem>
......@@ -6,3 +6,11 @@
# Shiboken PATH to look for typesystem.xml adn global.h files, recursively udapted
set(SHIBOKEN_TYPESYSTEM_PATH ${SHIBOKEN_TYPESYSTEM_PATH}:${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
set(SHIBOKEN_GLOBAL_H_PATH ${SHIBOKEN_GLOBAL_H_PATH}:${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
# Find core subdirectories
get_subdirectories(CORE_COMPONENT_SUBDIR_LIST)
# --- add every given library
foreach(COMP_NAME ${CORE_COMPONENT_SUBDIR_LIST})
add_subdirectory(${COMP_NAME})
endforeach()
\ No newline at end of file
// subdirectories header files
#include "./component/image/global_sdk_libraries_core_component_image.h"
#include "./component/mesh/global_sdk_libraries_core_component_mesh.h"
// local header files
#include <Component.h>
#include <InterfaceNode.h>
......
#---------------------------------------------------------------------------------
#
# Recursively parse subdirectories for classes to expose
#
#---------------------------------------------------------------------------------
# Shiboken PATH to look for typesystem.xml adn global.h files, recursively udapted
set(SHIBOKEN_TYPESYSTEM_PATH ${SHIBOKEN_TYPESYSTEM_PATH}:${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
set(SHIBOKEN_GLOBAL_H_PATH ${SHIBOKEN_GLOBAL_H_PATH}:${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
// local header files
#include <ImageComponent.h>
#include <ImageComponentExtension.h>
#include <MedicalDataOriginDialog.h>
#include <SingleImageComponent.h>
<?xml version="1.0"?>
<typesystem>
<!-- CamiTK sdk classes exposition to Python -->
<object-type name="camitk::ImageComponent" />
<!-- <object-type name="camitk::ImageComponentExtension" /> -->
<object-type name="camitk::MedicalDataOriginDialog" />
<object-type name="camitk::SingleImageComponent" />
</typesystem>
#---------------------------------------------------------------------------------
#
# Recursively parse subdirectories for classes to expose
#
#---------------------------------------------------------------------------------
# Shiboken PATH to look for typesystem.xml adn global.h files, recursively udapted
set(SHIBOKEN_TYPESYSTEM_PATH ${SHIBOKEN_TYPESYSTEM_PATH}:${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
set(SHIBOKEN_GLOBAL_H_PATH ${SHIBOKEN_GLOBAL_H_PATH}:${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
// local header files
#include <MeshComponent.h>
#include <MeshComponentExtension.h>
<?xml version="1.0"?>
<typesystem>
<!-- CamiTK sdk classes exposition to Python -->
<object-type name="camitk::MeshComponent" />
<!-- <object-type name="camitk::MeshComponentExtension" /> -->
</typesystem>
<?xml version="1.0"?>
<typesystem>
<!-- CamiTK actions subdirectories typesystem files -->
<load-typesystem name="typesystem_sdk_libraries_core_component_image.xml" generate="yes" />
<load-typesystem name="typesystem_sdk_libraries_core_component_mesh.xml" generate="yes" />
<!-- CamiTK sdk classes exposition to Python -->
<!-- <object-type name="camitk::Component" />
<enum-type name="camitk::Component::Representation" />
<object-type name="camitk::Component" >
<modify-function signature="Component(const QString &amp;, const QString &amp;, camitk::Component::Representation)">
<inject-code class="target" position="beginning">
// Force Shiboken not to instanciate Component (which is abstract) throught ComponentWrapper constructor
// Let Shiboken believes we have called the constructor, which is not the case due to comments.
// cptr = new ComponentWrapper();
</inject-code>
</modify-function>
<modify-function signature="Component(camitk::Component*, const QString &amp;, camitk::Component::Representation)">
<inject-code class="target" position="beginning">
// Force Shiboken not to instanciate Component (which is abstract) throught ComponentWrapper constructor
// Let Shiboken believes we have called the constructor, which is not the case due to comments.
// cptr = new ComponentWrapper();
</inject-code>
</modify-function>
</object-type>
<enum-type name="camitk::Component::Representation" />
<object-type name="camitk::InterfaceNode" />
<object-type name="camitk::InterfaceBitMap" />
<enum-type name="camitk::InterfaceBitMap::PossibleOrientation" />
<object-type name="camitk::InterfaceNode" >
<modify-function signature="getChildren()" remove="all" />
<modify-function signature="InterfaceNode()">
<inject-code class="target" position="beginning">
// Force Shiboken not to instanciate InterfaceNode (which is abstract) throught InterfaceNodeWrapper constructor
// Let Shiboken believes we have called the constructor, which is not the case due to comments.
// cptr = new InterfaceNodeWrapper();
</inject-code>
</modify-function>
</object-type>
<object-type name="camitk::InterfaceGeometry" />
<object-type name="camitk::InterfaceBitMap">
<modify-function signature="InterfaceBitMap()">
<inject-code class="target" position="beginning">
// Force Shiboken not to instanciate InterfaceBitMap (which is abstract) throught InterfaceBitMapWrapper constructor
// Let Shiboken believes we have called the constructor, which is not the case due to comments.
// cptr = new InterfaceBitMapWrapper();
</inject-code>
</modify-function>
</object-type>
<enum-type name="camitk::InterfaceBitMap::PossibleOrientation" />
<object-type name="camitk::InterfaceGeometry">
<modify-function signature="InterfaceGeometry()">
<inject-code class="target" position="beginning">
// Force Shiboken not to instanciate InterfaceGeometry (which is abstract) throught InterfaceGeometryWrapper constructor
// Let Shiboken believes we have called the constructor, which is not the case due to comments.
// cptr = new InterfaceGeometryWrapper();
</inject-code>
</modify-function>
</object-type>
<enum-type name="camitk::InterfaceGeometry::EnhancedMode" />
<enum-type name="camitk::InterfaceGeometry::RenderingMode" />
<enum-type name="camitk::InterfaceGeometry::GlyphType" />
<object-type name="camitk::InterfaceProperty" />-->
<object-type name="camitk::InterfaceProperty">
<modify-function signature="InterfaceProperty()">
<inject-code class="target" position="beginning">
// Force Shiboken not to instanciate InterfaceProperty (which is abstract) throught InterfacePropertyWrapper constructor
// Let Shiboken believes we have called the constructor, which is not the case due to comments.
// cptr = new InterfacePropertyWrapper();
</inject-code>
</modify-function>
</object-type>
</typesystem>
......@@ -7,4 +7,7 @@
// include here the classes you want to be exposed to Python for sdk/library/core
#include <ExtensionManager.h>
#include <Core.h>
#include <HistoryItem.h>
// #include <HistoryComponent.h>
......@@ -8,7 +8,12 @@
<load-typesystem name="typesystem_sdk_libraries_core_viewer.xml" generate="yes" />
<!-- Add here C++ Classes to expose to Python -->
<object-type name="camitk::Core" />
<object-type name="camitk::ExtensionManager" />
<enum-type name="camitk::ExtensionManager::ExtensionType" />
<!--<object-type name="camitk::HistoryComponent" />
<enum-type name="camitk::HistoryComponent::Type" />-->
<object-type name="camitk::HistoryItem" />
</typesystem>
// local header files
// #include <AbortException.h>
#include <ConsoleStream.h>
// #include <Log.h>
#include <ObjectController.h>
#include <SliderSpinBoxWidget.h>
#include <SliderTextWidget.h>
......
<?xml version="1.0"?>
<typesystem>
<!-- CamiTK sdk classes exposition to Python -->
<!--<object-type name="camitk::AbortException" />-->
<object-type name="camitk::ConsoleStream" />
<!-- <object-type name="camitk::Log" /> -->
<object-type name="camitk::ObjectController" />
<object-type name="camitk::ObjectControllerPrivate" />
<enum-type name="camitk::ObjectController::ViewMode" />
<object-type name="camitk::SliderSpinBoxWidget" />
<object-type name="camitk::SliderTextWidget" />
</typesystem>
// local header files
#include <ActionViewer.h>
#include <Explorer.h>
#include <MedicalImageViewer.h>
#include <Viewer.h>
#include <PropertyExplorer.h>
<?xml version="1.0"?>
<typesystem>
<!-- CamiTK sdk classes exposition to Python -->
<!-- <object-type name="camitk::Viewer" /> -->
<object-type name="camitk::ActionViewer" />
<object-type name="camitk::Explorer" />
<object-type name="camitk::MedicalImageViewer" />
<enum-type name="camitk::MedicalImageViewer::LayoutVisibility" />
<object-type name="camitk::Viewer" />
<object-type name="camitk::PropertyExplorer" />
</typesystem>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment