diff --git a/Modules/Core/include/shape.h b/Modules/Core/include/shape.h index 210bd29814..541c6166ae 100644 --- a/Modules/Core/include/shape.h +++ b/Modules/Core/include/shape.h @@ -1,41 +1,51 @@ #ifndef SHAPE_H #define SHAPE_H + +#include #include +#include +#include "mitkProportionalTimeGeometry.h" + namespace mitk { - class MITKCORE_EXPORT Shape + class MITKCORE_EXPORT Shape: public itk::DataObject { public: + mitkClassMacroItkParent(Shape, itk::DataObject); //static int nshapes; Shape() = default;// { nshapes++; } virtual ~Shape() = default; //{ nshapes--; } double x, y; void move(double dx, double dy); virtual double area() = 0; virtual double perimeter() = 0; }; class MITKCORE_EXPORT Circle : public Shape { private: double radius; public: + mitkClassMacro(Circle, Shape); + itkCloneMacro(Self); Circle(double r);// : radius(r) {} double area() override; double perimeter() override; + mitk::ProportionalTimeGeometry::Pointer area_vec(); + }; class MITKCORE_EXPORT Square : public Shape { private: double width; public: Square(double w);// : width(w) {} double area() override; double perimeter() override; }; } #endif diff --git a/Modules/Core/src/DataManagement/shape.cpp b/Modules/Core/src/DataManagement/shape.cpp index f6a4d1fad0..5895f1acf5 100644 --- a/Modules/Core/src/DataManagement/shape.cpp +++ b/Modules/Core/src/DataManagement/shape.cpp @@ -1,38 +1,46 @@ #include #define M_PI 3.14159265358979323846 /* Move the shape to a new location */ void mitk::Shape::move(double dx, double dy) { x += dx; y += dy; } /* namespace mitk { int Shape::nshapes = 0; }*/ mitk::Circle::Circle(double r): radius(r) {} double mitk::Circle::area() { return M_PI*radius*radius; } double mitk::Circle::perimeter() { return 2*M_PI*radius; } mitk::Square::Square(double w) : width(w) {} double mitk::Square::area() { return width*width; } double mitk::Square::perimeter() { return 4*width; } + +mitk::ProportionalTimeGeometry::Pointer mitk::Circle::area_vec() +{ + mitk::ProportionalTimeGeometry::Pointer m_Geo2; + m_Geo2 = mitk::ProportionalTimeGeometry::New(); + m_Geo2->Initialize(2); + return m_Geo2; +} diff --git a/Wrapping/Python/CMakeLists.txt b/Wrapping/Python/CMakeLists.txt index d10561022e..eb12854867 100644 --- a/Wrapping/Python/CMakeLists.txt +++ b/Wrapping/Python/CMakeLists.txt @@ -1,88 +1,88 @@ include(mitkTargetLinkLibrariesWithDynamicLookup) project(MITK_Python) set(CMAKE_SHARED_LINKER_FLAGS "" CACHE INTERNAL "" FORCE) set(CMAKE_MODULE_LINKER_FLAGS "" CACHE INTERNAL "" FORCE) mitk_check_dynamic_lookup(MODULE SHARED MITK_UNDEFINED_SYMBOLS_ALLOWED ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) option(MITK_PYTHON_THREADS "Enable threaded python usage by unlocking the GIL." ON ) option(MITK_PYTHON_EGG "Add building of python eggs to the dist target." OFF ) option(MITK_PYTHON_WHEEL "Add building of python wheels to the dist target." ON ) mark_as_advanced( MITK_PYTHON_THREADS MITK_PYTHON_EGG MITK_PYTHON_WHEEL ) set(libraries MitkCore #MitkCLCore #MitkCLUtilities - #ITKCommon + ITKCommon #MitkSegmentation #MitkMultilabel #MitkDICOM #MitkDICOMImageIO #MitkRT ) if(MITK_USE_MatchPoint) list(APPEND libraries MitkMatchPointRegistration ) endif() mitkSwigPrepareFiles(pyMITK MITKWRAP.i ${libraries}) set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_GLOBAL_FLAGS} -features autodoc=1 -keyword) if(MITK_PYTHON_THREADS) list(APPEND CMAKE_SWIG_FLAGS -threads) endif() set(CMAKE_SWIG_OUTDIR ${MITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY}) set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD) swig_add_library(pyMITK LANGUAGE python SOURCES MITKWRAP.i) set_property(TARGET pyMITK PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Wrapping") target_link_libraries(pyMITK ${libraries}) mitk_target_link_libraries_with_dynamic_lookup(${SWIG_MODULE_pyMITK_REAL_NAME} ${Python3_LIBRARIES}) set_target_properties(pyMITK PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY}" ) execute_process(COMMAND ${SWIG_EXECUTABLE} -python -external-runtime) if(DEFINED SKBUILD) #message("SKBuild exists") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/pyMITK.py ${CMAKE_CURRENT_SOURCE_DIR}/Packaging/__init__.py #${MITK_DOC_FILES} DESTINATION pyMITK COMPONENT Runtime ) install( TARGETS ${SWIG_MODULE_pyMITK_REAL_NAME} RUNTIME DESTINATION pyMITK LIBRARY DESTINATION pyMITK COMPONENT Runtime ) else() #message("SKBuild missing") include(LegacyPackaging.cmake) endif() diff --git a/Wrapping/Python/MITKWRAP.i b/Wrapping/Python/MITKWRAP.i index 2831d93e28..695bac0fb9 100644 --- a/Wrapping/Python/MITKWRAP.i +++ b/Wrapping/Python/MITKWRAP.i @@ -1,13 +1,25 @@ %begin %{ #ifdef _MSC_VER #define SWIG_PYTHON_INTERPRETER_NO_DEBUG #endif %} %module pyMITK #define MITKCORE_EXPORT - %{ + +#include #include + +using mitk::Operation; +using mitk::BaseProperty; +using mitk::BaseGeometry; +using mitk::TimeGeometry; +using mitk::PropertyList; +using mitk::Point3D; +using itk::DataObject; %} + +%include %include +