diff --git a/CMake/BuildConfigurations/All.cmake b/CMake/BuildConfigurations/All.cmake index 6a3b24125e..2e65fd8460 100644 --- a/CMake/BuildConfigurations/All.cmake +++ b/CMake/BuildConfigurations/All.cmake @@ -1,45 +1,44 @@ set(MITK_CONFIG_PACKAGES ) set(_apple_package_excludes) set(_package_excludes ${_apple_package_excludes} OpenCL OpenMP SYSTEM_Boost Boost_LIBRARIES SYSTEM_PYTHON SUPERBUILD POLHEMUS_TRACKER MICROBIRD_TRACKER MICROBIRD_TRACKER_INCLUDE_DIR MICROBIRD_TRACKER_LIB MICRON_TRACKER OPTITRACK_TRACKER SPACENAVIGATOR TOF_KINECT TOF_KINECTV2 TOF_MESASR4000 TOF_PMDCAMBOARD TOF_PMDCAMCUBE TOF_PMDO3 US_TELEMED_SDK videoInput - WIIMOTE ) get_cmake_property(_cache_vars CACHE_VARIABLES) foreach(_cache_var ${_cache_vars}) string(REGEX REPLACE "MITK_USE_(.+)" "\\1" _package "${_cache_var}") if(_package AND NOT _package STREQUAL _cache_var) list(FIND _package_excludes ${_package} _index) if(_index EQUAL -1) list(APPEND MITK_CONFIG_PACKAGES ${_package}) endif() endif() endforeach() set(MITK_BUILD_ALL_APPS ON CACHE BOOL "Build all MITK applications" FORCE) set(MITK_BUILD_ALL_PLUGINS ON CACHE BOOL "Build all MITK plugins" FORCE) set(MITK_BUILD_EXAMPLES ON CACHE BOOL "Build the MITK examples" FORCE) set(BLUEBERRY_BUILD_ALL_PLUGINS ON CACHE BOOL "Build all BlueBerry plugins" FORCE) diff --git a/CMake/Whitelists/FlowBenchSegmentation.cmake b/CMake/Whitelists/FlowBenchSegmentation.cmake index 60c1587601..c0eedb2dfb 100644 --- a/CMake/Whitelists/FlowBenchSegmentation.cmake +++ b/CMake/Whitelists/FlowBenchSegmentation.cmake @@ -1,55 +1,54 @@ set(enabled_modules Core CppMicroServices DICOM DICOMPM DataTypesExt AlgorithmsExt DICOMQI Multilabel SceneSerializationBase DICOMPMIO DICOMImageIO ContourModel DICOMSegIO LegacyGL MapperExt SceneSerialization LegacyIO IOExt MultilabelIO AppUtil QtWidgets QtWidgetsExt Segmentation SegmentationUI PlanarFigure Annotation SurfaceInterpolation GraphAlgorithms ImageExtraction ImageStatistics ) set(enabled_plugins org.blueberry.core.commands org.blueberry.core.expressions org.blueberry.core.runtime org.blueberry.ui.qt org.blueberry.ui.qt.help org.blueberry.ui.qt.log -org.mitk.core.ext org.mitk.core.services org.mitk.gui.common org.mitk.gui.qt.application org.mitk.gui.qt.common org.mitk.gui.qt.datamanager org.mitk.gui.qt.ext org.mitk.gui.qt.flow.segmentation org.mitk.gui.qt.flowapplication org.mitk.gui.qt.imagenavigator org.mitk.gui.qt.properties org.mitk.gui.qt.segmentation org.mitk.gui.qt.stdmultiwidgeteditor org.mitk.planarfigure ) diff --git a/Documentation/Doxygen/3-DeveloperManual/Application/DevelopmentApplication.dox b/Documentation/Doxygen/3-DeveloperManual/Application/DevelopmentApplication.dox index baf97ed86f..587d9c2803 100644 --- a/Documentation/Doxygen/3-DeveloperManual/Application/DevelopmentApplication.dox +++ b/Documentation/Doxygen/3-DeveloperManual/Application/DevelopmentApplication.dox @@ -1,27 +1,22 @@ /** \page DevelopmentApplication Developing with the MITK Application Framework MITK offers a powerful application featuring a plugin system and many predefined plugins. You can configure this application to offer a set of functionality to the user and easily create an installer. Working with the application, you will have to learn about extension points and the Blueberry framework itself. If you are new to the matter, please also consult \ref Architecture and \ref FirstSteps. The BlueBerry framework extension-point reference is available here: - \subpage BlueBerryExtPointsIndex - -The MITK application extension-point reference is available here: - - - \subpage mitkExtPointsIndex - */ diff --git a/Documentation/Doxygen/3-DeveloperManual/Application/ExtensionPointReference.dox b/Documentation/Doxygen/3-DeveloperManual/Application/ExtensionPointReference.dox deleted file mode 100644 index e324ea7885..0000000000 --- a/Documentation/Doxygen/3-DeveloperManual/Application/ExtensionPointReference.dox +++ /dev/null @@ -1,64 +0,0 @@ -/** - -\page mitkExtPointsIndex MITK Extension-Point Reference - -- \subpage mitkExtPointsIndex_InputDevices - -\page mitkExtPointsIndex_InputDevices Input Devices - -\tableofcontents - -\section mitkExtPointsIndex_InputDevices_Identifier Identifier - -\c org.mitk.core.ext.inputdevices - -\section mitkExtPointsIndex_InputDevices_Description Description - -This extension point is used to define additional input devices. - -\section mitkExtPointsIndex_InputDevices_ConfigurationMarkup Configuration Markup - -\code{.unparsed} - - -\endcode - -- point: a fully qualified identifier of the target extension point -- id: an optional identifier of the extension instance -- name: an optional name of the extension instance - -\code{.unparsed} - - -\endcode - -- id: the identifier of the input device -- name: an optional name of the input device -- class: a fully qualified name of the class that implements mitk::IInputDevice. - -\code{.unparsed} - -\endcode - -An optional subelement whose body should contain text providing a short description of the input device. - -\section mitkExtPointsIndex_InputDevices_Examples Examples - -\code{.unparsed} - - - My new 20-dimensional input device - - -\endcode - -*/ diff --git a/Documentation/Doxygen/3-DeveloperManual/DeveloperManualPortal.dox b/Documentation/Doxygen/3-DeveloperManual/DeveloperManualPortal.dox index 678ce379c8..8ab74c6556 100644 --- a/Documentation/Doxygen/3-DeveloperManual/DeveloperManualPortal.dox +++ b/Documentation/Doxygen/3-DeveloperManual/DeveloperManualPortal.dox @@ -1,31 +1,28 @@ /** \developersguidemainpage{DeveloperManualPortal} Developer Manual Development with MITK can happen under several conditions. Depending on whether you are using the Toolkit or the entire application, different sections may apply to you. In case you are unsure about what you need, please refer to \link Architecture The Architecture of MITK text\endlink. An extensive Introduction to MITK is available under \link StartingDevelopment Starting your MITK Development\endlink. Once you have made yourself familiar with MITK, you should have a look at the \link Concepts Development Concepts\endlink, as MITK implements a lot of high-level functionality. Knowing about these concepts will prevent you from reimplementing functionality. Once you start consuming more specific functionality, the \link MITKModuleManualsListPage Module Manual\endlink will be helpful to understand how a specific plugin works and what functionality it provides. */ diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/CMakeFAQ.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/CMakeFAQ.dox index eb1e126554..475dd319e3 100644 --- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/CMakeFAQ.dox +++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/CMakeFAQ.dox @@ -1,44 +1,44 @@ /** \page CMAKE_FAQ CMake FAQ \section CMAKE_FAQ_General A general comment MITK uses %CMake for configuration. If you want to develop either using MITK as a toolkit or by extending the capabilities of the applications provided by us, we recommend using %CMake for your own project too. While it might be possible to use MITK in conjunction with other options, such as QMake or setting up your own project manually it will invariably involve a lot of work and probably hacks as well. As we do have no experience with this, we will not be able to help you. Be prepared to do a lot of tweaking on by yourself. This guide does not try to give a general introduction to CMake, instead it tries to answer some basic questions that might arise for those new to %CMake, to help you get started on MITK. For a more comprehensive introduction on %CMake see here. We will assume in this guide, that the path to your source is /MITK/. \section CMAKE_FAQ_Question Basic Questions \subsection CMAKE_FAQ_Question_WhereGetIt Where do I get CMake and what version do I need? See \ref BuildInstructions_Prerequisites. \subsection CMAKE_FAQ_Question_NewPluginNothing I coded a new plugin for the Workbench and nothing happened. Why? Do note that you need to move the source to the Plugins directory and you will have to add the plugin to the config file (most likely Plugins/PluginList.cmake). After that see \ref CMAKE_FAQ_Question_HowDoIActivatePlugin. \subsection CMAKE_FAQ_Question_HowDoIActivatePlugin I want to use a plugin, how do I activate it?
  1. Start %CMake in the `MITK-build` directory inside your superbuild folder. E.g. `cd ~//MITK-build` `ccmake .` or `cmake-gui .`
  2. Optional: *Configure* to see all %CMake variables.
  3. Find the variable `MITK_BUILD_` and activate it. The `` refers to the package name of the plugin.
    - E.g. the plugin-id (also, the package name) `org.mitk.core.ext` is the sub-directory of same name in plugins directory (`~/MITK/Plugins/`). + E.g. the plugin-id (also, the package name) `org.mitk.gui.qt.application` is the sub-directory of same name in plugins directory (`~/MITK/Plugins/`).
  4. *Configure*, again
  5. *Generate*
  6. Rebuild the `MITK-build` target using your development environment.
\subsection CMAKE_FAQ_Question_HowDoIActivateModule I want to use a module, how do I activate it? Modules are build automatically if a plugin that requires them is activated. See \ref CMAKE_FAQ_Question_HowDoIActivatePlugin. \subsection CMAKE_FAQ_Question_HowOwnToolkits MITK always downloads the toolkits, but I want to use my own. This is covered in \ref HowToNewProjectCustomizingMITKConfigure. \subsection CMAKE_FAQ_Question_HowOwnProjectMITK I want to use an MITK plugin in my own project but I can not find it. See \ref HowToNewProjectAddingMITKFunctionality. */ diff --git a/Examples/Plugins/org.mitk.example.gui.customviewer/manifest_headers.cmake b/Examples/Plugins/org.mitk.example.gui.customviewer/manifest_headers.cmake index 058dcf0b91..170a057a2d 100644 --- a/Examples/Plugins/org.mitk.example.gui.customviewer/manifest_headers.cmake +++ b/Examples/Plugins/org.mitk.example.gui.customviewer/manifest_headers.cmake @@ -1,9 +1,8 @@ set(Plugin-Name "MITK Example Custom Viewer") set(Plugin-Version "1.0.0") set(Plugin-Vendor "German Cancer Research Center (DKFZ)") set(Plugin-ContactAddress "https://www.mitk.org") set(Require-Plugin - org.mitk.core.ext # Registers file reader factories org.mitk.gui.qt.application # Initializes GlobalInteraction and registers MITK Core factories ) diff --git a/Modules/Core/include/mitkInteractionConst.h b/Modules/Core/include/mitkInteractionConst.h index e83f33b429..0df91c3715 100644 --- a/Modules/Core/include/mitkInteractionConst.h +++ b/Modules/Core/include/mitkInteractionConst.h @@ -1,776 +1,762 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef mitkInteractionConst_h #define mitkInteractionConst_h //##Documentation //## @file mitkInteractionConst.h //## @brief Constants for most interaction classes, due to the generic StateMachines. //## //## Changes in Type, ButtonState or Key has to be don in mitkEventMapper.cpp, too. //## @ingroup Interaction /*Prefixes for Constants: E = Enumeration EID = EventId's Op = Operations Ac = Action Type_ = Type of Event BS_ = ButtonStates and Buttons Key_ = Keys like in QT */ namespace mitk { // Constants for EventIds; use the according constant to through an event in the code enum EEventIds { EIDNULLEVENT = 0, EIDLEFTMOUSEBTN = 1, EIDRIGHTMOUSEBTN = 2, EIDLEFTMOUSEBTNANDSHIFT = 3, EIDMIDDLEMOUSEBTN = 4, EIDLEFTMOUSEBTNANDCTRL = 5, EIDMIDDLEMOUSEBTNANDCTRL = 6, EIDRIGHTMOUSEBTNANDCTRL = 7, EIDLEFTMOUSEBTNDOUBLECLICK = 8, EIDMOUSEWHEEL = 9, EIDLEFTMOUSERELEASE = 505, EIDMIDDLEMOUSERELEASE = 506, EIDRIGHTMOUSERELEASE = 507, EIDLEFTMOUSERELEASEANDSHIFT = 508, EIDMOUSEMOVE = 520, EIDLEFTMOUSEBTNANDMOUSEWHEEL = 521, EIDRIGHTMOUSEBTNANDMOUSEWHEEL = 522, EIDMIDDLEMOUSEBTNANDMOUSEWHEEL = 523, EIDLEFTMOUSEBTNANDMOUSEMOVE = 530, EIDRIGHTMOUSEBTNANDMOUSEMOVE = 531, EIDMIDDLEMOUSEBTNANDMOUSEMOVE = 533, EIDCTRLANDLEFTMOUSEBTNANDMOUSEMOVE = 534, EIDCTRLANDRIGHTMOUSEBTNANDMOUSEMOVE = 535, EIDCTRLANDMIDDLEMOUSEBTNANDMOUSEMOVE = 536, EIDCTRLANDLEFTMOUSEBTNRELEASE = 537, EIDCTRLANDRIGHTMOUSEBTNRELEASE = 538, EIDCTRLANDMIDDLEMOUSEBTNRELEASE = 539, EIDSHIFTANDCTRLANDMIDDLEMOUSEBTN = 540, EIDSHIFTANDLEFTMOUSEBTNANDMOUSEMOVE = 541, EIDSHIFTANDCTRLANDMOUSEMOVE = 542, EIDSHIFTANDCTRLANDMOUSERELEASE = 543, EIDALTANDLEFTMOUSEBTN = 600, EIDALTANDLEFTMOUSEBTNANDMOUSEMOVE = 610, EIDALTANDLEFTMOUSERELEASE = 620, EIDCTRLANDLEFTMOUSEWHEEL = 630, EIDALTANDMOUSEWHEEL = 640, EIDALTANDMIDDLEMOUSEBTN = 641, EIDALTANDMIDDLEMOUSEBTNANDMOVE = 642, EIDALTANDMIDDLEMOUSEBTNRELEASE = 643, EIDALTANDSHIFTANDRIGHTMOUSEBTN = 644, EIDALTANDSHIFTANDRIGHTMOUSEBTNANDMOUSEMOVE = 645, EIDALTANDSHIFTANDRIGHTMOUSEBTNRELEASE = 646, EIDSHIFTANDRIGHTMOUSEPRESS = 2000, EIDSHIFTANDRIGHTMOUSEMOVE = 2001, EIDSHIFTANDRIGHTMOUSERELEASE = 2002, EIDSHIFTANDMIDDLEMOUSEPRESS = 2003, EIDSHIFTANDMIDDLEMOUSEMOVE = 2004, EIDSHIFTANDMIDDLEMOUSERELEASE = 2005, - EIDSPACENAVIGATORINPUT = 4001, // 3d Mouse, SpaceNavigator input - EIDSPACENAVIGATORKEYDOWN = 4002, // 3d Mouse, KeyDown - EIDWIIMOTEINPUT = 4003, // WiiMote input - EIDWIIMOTEBUTTON = 4004, // WiiMote home button - EIDWIIMOTEBUTTONB = 4005, // WiiMote b button EIDSTRGANDN = 10, EIDSTRGANDE = 11, EIDDELETE = 12, EIDN = 13, EIDESCAPE = 14, EIDP = 15, EIDR = 16, EIDT = 17, EIDS = 18, EIDE = 19, EIDSTRGANDALTANDA = 20, EIDSTRGANDALTANDB = 21, EIDH = 22, EIDRETURN = 23, EIDENTER = 24, EIDSPACE = 25, EIDPLUS = 26, EIDMINUS = 27, EIDSTRGANDALTANDH = 30, EIDSTRGANDALTANDI = 31, EIDSTRGANDALTANDS = 40, EIDALT = 90, EIDSTRGANDB = 91, EIDNEW = 1000, EIDOLD = 1001, EIDFINISHED = 1002, EIDNO = 1003, EIDYES = 1004, EIDSAME = 1005, EIDNOANDLASTOBJECT = 1006, EIDNOANDNOTLASTOBJECT = 1007, EIDLAST = 1008, EIDNOTLAST = 1009, EIDSTSMALERNMINUS1 = 1010, EIDSTLARGERNMINUS1 = 1011, EIDPOSITIONEVENT = 1012, EIDEDIT = 1013, EIDSMALLERN = 1014, EIDEQUALSN = 1015, EIDLARGERN = 1016, EIDEMPTY = 1017, EIDSUBDESELECT = 1020, EIDSMTOSELECTED = 1030, EIDSMTODESELECTED = 1031, EIDTIP = 1050, EIDHEAD = 1051, EIDBODY = 1052, EIDCLEAR = 1100, EIDACTIVATETOOL = 1300, EIDPRINT = 3001, EV_INIT = 5551001, EV_PREVIOUS = 5551002, EV_PATH_COLLECTION_SELECTED = 5551003, EV_NAVIGATION_SELECTED = 5551004, EV_LESS_THEN_MIN_COUNT = 5551005, EV_READY = 5551006, EV_NEXT = 5551007, EV_DONE = 5551008, EV_NEW_LANDMARK = 5551009, EV_REMOVE_LANDMARK = 5551010, EIDINSIDE = 2500, EIDA = 4001, EIDB = 4002, EIDC = 4003, EIDD = 4004, EIDF = 4005, EIDG = 4006, EIDI = 4007, EIDJ = 4008, EIDK = 4009, EIDL = 4010, EIDM = 4011, EIDO = 4012, EIDQ = 4013, EIDU = 4014, EIDV = 4015, EIDW = 4016, EIDX = 4017, EIDY = 4018, EIDZ = 4019, EID1 = 4020, EID2 = 4021, EID3 = 4022, EID4 = 4023, EID5 = 4024, EID6 = 4025, EID7 = 4026, EID8 = 4027, EID9 = 4028, EID0 = 4029, EIDFIGUREHOVER = 12340, EIDNOFIGUREHOVER = 12341 }; //##Constants for Operations - //## xomments are always examples of the usage + //## comments are always examples of the usage enum EOperations { OpNOTHING = 0, OpTEST = 1, OpNEWCELL = 10, // add a new cell OpADD = 100, // add a point or a vessel OpUNDOADD = 101, OpADDLINE = 1001, // add a line OpINSERT = 200, // insert a point at position OpINSERTLINE = 201, // insert a line at position OpINSERTPOINT = 202, OpCLOSECELL = 250, // close a cell (to a polygon) OpOPENCELL = 251, // close a cell (to a polygon) OpMOVE = 300, // move a point OpMOVELINE = 301, // move a line OpMOVECELL = 302, // move a line OpUNDOMOVE = 303, OpMOVEPOINTUP = 304, OpMOVEPOINTDOWN = 305, OpREMOVE = 400, // remove a point at position OpREMOVELINE = 401, // remove a line at position OpREMOVECELL = 402, // remove a cell OpREMOVEPOINT = 403, OpDELETE = 500, // delete OpDELETELINE = 501, // delete the last line in a cell OpUNDELETE = 502, OpDELETECELL = 505, OpSTATECHANGE = 600, // change a state OpTIMECHANGE = 601, // change a state OpTERMINATE = 666, // change a state OpSELECTPOINT = 700, OpSELECTLINE = 701, OpSELECTCELL = 702, OpSELECTSUBOBJECT = 703, // for VesselGraphInteractor // OpSELECTNEWSUBOBJECT = 704, //for VesselGraphInteractor OpSELECT = 705, OpDESELECTPOINT = 800, OpDESELECTLINE = 801, OpDESELECTCELL = 802, OpDESELECTSUBOBJECT = 803, // for VesselGraphInteractor OpDESELECTALL = 804, // for VesselGraphInteractor OpDESELECT = 805, OpNAVIGATE = 900, OpZOOM = 1000, OpSCALE = 1100, OpROTATE = 1200, OpORIENT = 1201, OpRESTOREPLANEPOSITION = 1202, OpAPPLYTRANSFORMMATRIX = 1203, OpSETPOINTTYPE = 1210, OpMODECHANGE = 1500, OpSENDCOORDINATES = 1600, OpPERIPHERYSEARCH = 2000, // used in VesselGraphInteractor OpROOTSEARCH = 2001, // used in VesselGraphInteractor OpTHICKSTVESSELSEARCH = 2002, // used in VesselGraphInteractor OpSHORTESTPATHSEARCH = 2003, // used in VesselGraphInteractor OpATTRIBUTATION = 2004, // used in VesselGraphInteractor OpDEFAULT = 2006, // used in VesselGraphInteractor OpSURFACECHANGED = 3000, // used for changing polydata in surfaces }; //##Constants for EventMapping... //##connects the statemachine.xml-File with the implemented conditions. //##within one statemachine the choice of the actionconstants is freely //## //## ActionId enum EActions { AcDONOTHING = 0, AcINITNEWOBJECT = 5, AcINITEDITOBJECT = 6, AcINITEDITGROUP = 7, AcINITMOVEMENT = 8, AcINITMOVE = 9, AcINITFOREGROUND = 45, // used in SeedsInteractor for setting the foreground seeds AcINITBACKGROUND = 46, // used in SeedsInteractor for setting the background seeds AcINITNEUTRAL = 47, // used in SeedsInteractor for setting the neutral seeds (rubber) AcINITUPDATE = 1235, // For shape model deformation AcADDPOINT = 10, AcADDPOINTRMB = 6000, // in mitralPointSetInteractor used to set a different type of point AcADD = 11, AcADDLINE = 12, AcADDANDFINISH = 13, AcADDSELECTEDTOGROUP = 64, AcCHECKPOINT = 21, AcCHECKLINE = 22, AcCHECKCELL = 23, AcCHECKELEMENT = 30, // check if there is a element close enough (picking) AcCHECKOBJECT = 31, // check if an object is hit AcCHECKNMINUS1 = 32, // check if the number of elements is equal to N-1 AcCHECKEQUALS1 = 33, // check if the number of elements in the data is equal to 1 AcCHECKNUMBEROFPOINTS = 330, // check the number of elements in the data AcCHECKSELECTED = 34, // check if the given element is selected or not AcCHECKONESELECTED = 340, // check if there is an element that is selected AcCHECKHOVERING = 341, // check if there is an element that is selected AcCHECKGREATERZERO = 35, // check if the current number of elements is greater than 0 AcCHECKGREATERTWO = 36, // check if the current number of elements is greater than two AcCHECKOPERATION = 37, // check if the operation is of one spectial type AcCHECKONESUBINTERACTOR = 38, AcCHECKSUBINTERACTORS = 39, AcFINISHOBJECT = 40, AcFINISHGROUP = 41, AcFINISHMOVEMENT = 42, AcFINISHMOVE = 43, AcFINISH = 44, AcSEARCHOBJECT = 50, AcSEARCHGROUP = 51, AcSEARCHANOTHEROBJECT = 52, // one object is selected and another object is to be added to selection AcSELECTPICKEDOBJECT = 60, // select the picked object and deselect others AcSELECTANOTHEROBJECT = 61, AcSELECTGROUP = 62, AcSELECTALL = 63, AcSELECT = 65, AcSELECTPOINT = 66, AcSELECTLINE = 68, AcSELECTCELL = 67, AcSELECTSUBOBJECT = 69, // used in VesselGraphInteractor AcDESELECTOBJECT = 70, // deselect picked from group AcDESELECTALL = 72, AcDESELECT = 75, AcDESELECTPOINT = 76, AcDESELECTLINE = 78, AcDESELECTCELL = 77, AcNEWPOINT = 80, AcNEWSUBOBJECT = 81, AcMOVEPOINT = 90, AcMOVESELECTED = 91, AcMOVE = 92, AcMOVEPOINTUP = 93, AcMOVEPOINTDOWN = 94, AcREMOVEPOINT = 100, AcREMOVE = 101, AcREMOVELINE = 102, AcREMOVEALL = 103, AcREMOVESELECTEDSUBOBJECT = 104, // used in VesselGraphInteractor AcWHEEL = 105, AcPLUS = 106, AcMINUS = 107, AcDELETEPOINT = 120, AcCLEAR = 130, // clear all elements from a list AcINSERTPOINT = 110, AcINSERTLINE = 111, AC_SET_NEXT_BUTTON_VISIBLE = 5550001, AC_SET_NEXT_BUTTON_INVISIBLE = 5550002, AC_SET_PREVIOUS_BUTTON_VISIBLE = 5550003, AC_SET_PREVIOUS_BUTTON_INVISIBLE = 5550004, AC_SET_ASSISTAND_WIDGET_STECK = 5550005, AC_SETMAX_COUNT_REF_POINTS = 5550006, AC_SET_NEXT_BUTTON_TEXT = 5550007, AC_CHECK_LANDMARK_COUNT = 5550008, AC_SET_DONE_FALSE = 5550009, AC_INIT = 55500010, AC_SET_APPLICATION_SELECTED_FALSE = 55500011, AC_SENSOR_ATTACHED = 55500012, AC_CLOSE_ASSISTENT = 55500013, AC_START_APPLICATION_TEXT = 55500014, AC_START_NAVIGATION = 55500015, AC_START_PATHCOLLECTION = 55500016, AC_LOAD_LANDMARKS = 55500017, AC_CALCULATE_LANDMARK_TRANSFORM = 55500018, AcTERMINATE_INTERACTION = 666, AcTRANSLATESTART = 1000, AcTRANSLATE = 1001, AcSCALESTART = 1002, AcSCALE = 1003, AcROTATESTART = 1004, AcROTATE = 1005, AcINITAFFINEINTERACTIONS = 1006, AcFINISHAFFINEINTERACTIONS = 1007, AcTRANSLATEEND = 1008, AcSCALEEND = 1009, AcROTATEEND = 1010, AcINITZOOM = 1011, AcZOOM = 1012, AcSCROLL = 1013, AcLEVELWINDOW = 1014, AcSCROLLMOUSEWHEEL = 1015, AcSETSTARTPOINT = 1050, AcMODEDESELECT = 1100, // set interactor in not selected mode AcMODESELECT = 1101, // set interactor in selected mode AcMODESUBSELECT = 1102, // set interacor in sub selected mode AcINFORMLISTENERS = 1200, AcASKINTERACTORS = 1201, AcCHECKGREATERONE = 1500, AcCHECKBOUNDINGBOX = 1510, AcFORCESUBINTERACTORS = 1550, AcSENDCOORDINATES = 1600, AcTRANSMITEVENT = 2000, // to transmit an event to a lower Interactor/Statemachine AcPERIPHERYSEARCH = 3000, // used in VesselGraphInteractor AcROOTSEARCH = 3001, // used in VesselGraphInteractor AcTHICKSTVESSELSEARCH = 3002, // used in VesselGraphInteractor AcSHORTESTPATHSEARCH = 3003, // used in VesselGraphInteractor AcSINGLE = 3004, // used in VesselGraphInteractor AcATTRIBUTATION = 3005, // used in VesselGraphInteractor AcDEFAULT = 3007, // used in VesselGraphInteractor AcSETVESSELELEMENT = 3008, // used in VesselGraphInteractor AcCHECKBARRIERSTATUS = 3010, // used in VesselGraphInteractor AcUPDATEMESH = 1234, // For Shape Model Interaction AcINCREASE = 49012, AcDECREASE = 49013, AcMODIFY = 49014, AcUNDOUPDATE = 1236, // For restoring a mesh after an update AcENTEROBJECT = 48000, AcLEAVEOBJECT = 48001, AcSWITCHOBJECT = 48002, AcUPDATELINE = 48003, AcINITLINE = 48004, AcTERMINATELINE = 48005, AcCREATEBOX = 48006, AcCREATEOBJECTFROMLINE = 48007, AcCANCEL = 48008, AcACTIVATETOOL = 48009, AcROTATEAROUNDPOINT1 = 49002, AcROTATEAROUNDPOINT2 = 49003, AcMOVEPOINT1 = 49004, AcMOVEPOINT2 = 49005, AcUPDATEPOINT = 49006, AcUPDATERADIUSMOUSEWHEEL = 49007, AcDISPLAYOPTIONS = 49009, AcCYCLE = 49010, AcACCEPT = 49011, - AcONSPACENAVIGATORMOUSEINPUT = 4001, // On input of 3D Mouse - AcONPACENAVIGATORKEYDOWN = 4002, // On input of 3D Mouse - AcONWIIMOTEINPUT = 4003, // used for wiimote to signal IR input - AcRESETVIEW = 4004, // used for wiimote to reset view - AcONWIIMOTEBUTTONRELEASED = 4005, // stops the surface interaction AcCHECKPOSITION = 5000, AcINITIALIZECONTOUR = 5001, AcCALCULATENEWSEGMENTATION_SP = 5002, AcINTERACTOR = 5003, AcCALCULATENEWSEGMENTATION_BB = 5004 }; /* //!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!! //EventMechanism: //If you change anything from here on, then change in mitkEventMapper.cpp (Array of constants) as well. //!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!! */ // Type of an Event; enum EEventType { Type_None = 0, // invalid event Type_Timer = 1, // timer event Type_MouseButtonPress = 2, // mouse button pressed Type_MouseButtonRelease = 3, // mouse button released Type_MouseButtonDblClick = 4, // mouse button double click Type_MouseMove = 5, // mouse move Type_KeyPress = 6, // key pressed Type_KeyRelease = 7, // key released Type_FocusIn = 8, // keyboard focus received Type_FocusOut = 9, // keyboard focus lost Type_Enter = 10, // mouse enters widget Type_Leave = 11, // mouse leaves widget Type_Paint = 12, // paint widget Type_Move = 13, // move widget Type_Resize = 14, // resize widget Type_Create = 15, // after object creation Type_Destroy = 16, // during object destruction Type_Show = 17, // widget is shown Type_Hide = 18, // widget is hidden Type_Close = 19, // request to close widget Type_Quit = 20, // request to quit application Type_Reparent = 21, // widget has been reparented Type_ShowMinimized = 22, // widget is shown minimized Type_ShowNormal = 23, // widget is shown normal Type_WindowActivate = 24, // window was activated Type_WindowDeactivate = 25, // window was deactivated Type_ShowToParent = 26, // widget is shown to parent Type_HideToParent = 27, // widget is hidden to parent Type_ShowMaximized = 28, // widget is shown maximized Type_ShowFullScreen = 29, // widget is shown full-screen Type_Accel = 30, // accelerator event Type_Wheel = 31, // wheel event Type_AccelAvailable = 32, // accelerator available event Type_CaptionChange = 33, // caption changed Type_IconChange = 34, // icon changed Type_ParentFontChange = 35, // parent font changed Type_ApplicationFontChange = 36, // application font changed Type_ParentPaletteChange = 37, // parent palette changed Type_ApplicationPaletteChange = 38, // application palette changed Type_PaletteChange = 39, // widget palette changed Type_Clipboard = 40, // internal clipboard event Type_Speech = 42, // reserved for speech input Type_SockAct = 50, // socket activation Type_AccelOverride = 51, // accelerator override event Type_DeferredDelete = 52, // deferred delete event Type_DragEnter = 60, // drag moves into widget Type_DragMove = 61, // drag moves in widget Type_DragLeave = 62, // drag leaves or is cancelled Type_Drop = 63, // actual drop Type_DragResponse = 64, // drag accepted/rejected Type_ChildInserted = 70, // new child widget Type_ChildRemoved = 71, // deleted child widget Type_LayoutHint = 72, // child min/max size changed Type_ShowWindowRequest = 73, // widget's window should be mapped Type_ActivateControl = 80, // ActiveX activation Type_DeactivateControl = 81, // ActiveX deactivation Type_ContextMenu = 82, // context popup menu Type_IMStart = 83, // input method composition start Type_IMCompose = 84, // input method composition Type_IMEnd = 85, // input method composition end Type_Accessibility = 86, // accessibility information is requested Type_TabletMove = 87, // Wacom tablet event Type_LocaleChange = 88, // the system locale changed Type_LanguageChange = 89, // the application language changed Type_LayoutDirectionChange = 90, // the layout direction changed Type_Style = 91, // internal style event Type_TabletPress = 92, // tablet press Type_TabletRelease = 93, // tablet release Type_User = 1000, // first user event id - Type_SpaceNavigatorInput = 1094, // 3D mouse input occurred - Type_SpaceNavigatorKeyDown = 1095, // 3D mouse input occurred - Type_WiiMoteInput = 1096, // WiiMote input occurred - Type_WiiMoteButton = 1097, // WiiMote button pressed Type_MaxUser = 65535 }; //##ButtonState // mouse/keyboard state values // QT combinations if MOUSEBUTTONRelease: left MouseButton + ControlButton: 0x201 enum EButtonStates { BS_NoButton = 0x0000, BS_LeftButton = 0x0001, BS_RightButton = 0x0002, BS_MidButton = 0x0004, BS_MouseButtonMask = 0x0007, BS_ShiftButton = 0x0100, BS_ControlButton = 0x0200, BS_AltButton = 0x0400, BS_MetaButton = 0x0800, BS_KeyButtonMask = 0x0f00, BS_Keypad = 0x4000 }; //##Key enum EKeys { Key_Escape = 0x1000, // misc keys Key_Tab = 0x1001, Key_Backtab = 0x1002, Key_BackTab = 0x1002, //= Key_Backtab Key_Backspace = 0x1003, Key_BackSpace = 0x1003, //= Key_Backspace Key_Return = 0x1004, Key_Enter = 0x1005, Key_Insert = 0x1006, Key_Delete = 0x1007, Key_Pause = 0x1008, Key_Print = 0x1009, Key_SysReq = 0x100a, Key_Home = 0x1010, // cursor movement Key_End = 0x1011, Key_Left = 0x1012, Key_Up = 0x1013, Key_Right = 0x1014, Key_Down = 0x1015, Key_Prior = 0x1016, Key_PageUp = 0x1016, //=Key_Prior Key_Next = 0x1017, Key_PageDown = 0x1017, //=Key_Next Key_Shift = 0x1020, // modifiers Key_Control = 0x1021, Key_Meta = 0x1022, Key_Alt = 0x1023, Key_CapsLock = 0x1024, Key_NumLock = 0x1025, Key_ScrollLock = 0x1026, Key_F1 = 0x1030, // function keys Key_F2 = 0x1031, Key_F3 = 0x1032, Key_F4 = 0x1033, Key_F5 = 0x1034, Key_F6 = 0x1035, Key_F7 = 0x1036, Key_F8 = 0x1037, Key_F9 = 0x1038, Key_F10 = 0x1039, Key_F11 = 0x103a, Key_F12 = 0x103b, Key_F13 = 0x103c, Key_F14 = 0x103d, Key_F15 = 0x103e, Key_F16 = 0x103f, Key_F17 = 0x1040, Key_F18 = 0x1041, Key_F19 = 0x1042, Key_F20 = 0x1043, Key_F21 = 0x1044, Key_F22 = 0x1045, Key_F23 = 0x1046, Key_F24 = 0x1047, Key_F25 = 0x1048, // F25 .. F35 only on X11 Key_F26 = 0x1049, Key_F27 = 0x104a, Key_F28 = 0x104b, Key_F29 = 0x104c, Key_F30 = 0x104d, Key_F31 = 0x104e, Key_F32 = 0x104f, Key_F33 = 0x1050, Key_F34 = 0x1051, Key_F35 = 0x1052, Key_Super_L = 0x1053, // extra keys Key_Super_R = 0x1054, Key_Menu = 0x1055, Key_Hyper_L = 0x1056, Key_Hyper_R = 0x1057, Key_Help = 0x1058, // International input method support (X keycode - = 0xEE00) // Only interesting if you are writing your own input method Key_Muhenkan = 0x1122, // Cancel Conversion Key_Henkan = 0x1123, // Start/Stop Conversion Key_Hiragana_Katakana = 0x1127, // Hiragana/Katakana toggle Key_Zenkaku_Hankaku = 0x112A, // Zenkaku/Hankaku toggle Key_Space = 0x20, // 7 bit printable ASCII Key_Any = 0x20, //= Key_Space Key_Exclam = 0x21, Key_QuoteDbl = 0x22, Key_NumberSign = 0x23, Key_Dollar = 0x24, Key_Percent = 0x25, Key_Ampersand = 0x26, Key_Apostrophe = 0x27, Key_ParenLeft = 0x28, Key_ParenRight = 0x29, Key_Asterisk = 0x2a, Key_Plus = 0x2b, Key_Comma = 0x2c, Key_Minus = 0x2d, Key_Period = 0x2e, Key_Slash = 0x2f, Key_0 = 0x30, Key_1 = 0x31, Key_2 = 0x32, Key_3 = 0x33, Key_4 = 0x34, Key_5 = 0x35, Key_6 = 0x36, Key_7 = 0x37, Key_8 = 0x38, Key_9 = 0x39, Key_Colon = 0x3a, Key_Semicolon = 0x3b, Key_Less = 0x3c, Key_Equal = 0x3d, Key_Greater = 0x3e, Key_Question = 0x3f, Key_At = 0x40, Key_A = 0x41, Key_B = 0x42, Key_C = 0x43, Key_D = 0x44, Key_E = 0x45, Key_F = 0x46, Key_G = 0x47, Key_H = 0x48, Key_I = 0x49, Key_J = 0x4a, Key_K = 0x4b, Key_L = 0x4c, Key_M = 0x4d, Key_N = 0x4e, Key_O = 0x4f, Key_P = 0x50, Key_Q = 0x51, Key_R = 0x52, Key_S = 0x53, Key_T = 0x54, Key_U = 0x55, Key_V = 0x56, Key_W = 0x57, Key_X = 0x58, Key_Y = 0x59, Key_Z = 0x5a, Key_BracketLeft = 0x5b, Key_Backslash = 0x5c, Key_BracketRight = 0x5d, Key_AsciiCircum = 0x5e, Key_Underscore = 0x5f, Key_QuoteLeft = 0x60, Key_BraceLeft = 0x7b, Key_Bar = 0x7c, Key_BraceRight = 0x7d, Key_AsciiTilde = 0x7e, Key_nobreakspace = 0x0a0, Key_exclamdown = 0x0a1, Key_cent = 0x0a2, Key_sterling = 0x0a3, Key_currency = 0x0a4, Key_yen = 0x0a5, Key_brokenbar = 0x0a6, Key_section = 0x0a7, Key_diaeresis = 0x0a8, Key_copyright = 0x0a9, Key_ordfeminine = 0x0aa, Key_guillemotleft = 0x0ab, // left angle quotation mark Key_notsign = 0x0ac, Key_hyphen = 0x0ad, Key_registered = 0x0ae, Key_macron = 0x0af, Key_degree = 0x0b0, Key_plusminus = 0x0b1, Key_twosuperior = 0x0b2, Key_threesuperior = 0x0b3, Key_acute = 0x0b4, Key_mu = 0x0b5, Key_paragraph = 0x0b6, Key_periodcentered = 0x0b7, Key_cedilla = 0x0b8, Key_onesuperior = 0x0b9, Key_masculine = 0x0ba, Key_guillemotright = 0x0bb, // right angle quotation mark Key_onequarter = 0x0bc, Key_onehalf = 0x0bd, Key_threequarters = 0x0be, Key_questiondown = 0x0bf, Key_Agrave = 0x0c0, Key_Aacute = 0x0c1, Key_Acircumflex = 0x0c2, Key_Atilde = 0x0c3, Key_Adiaeresis = 0x0c4, Key_Aring = 0x0c5, Key_AE = 0x0c6, Key_Ccedilla = 0x0c7, Key_Egrave = 0x0c8, Key_Eacute = 0x0c9, Key_Ecircumflex = 0x0ca, Key_Ediaeresis = 0x0cb, Key_Igrave = 0x0cc, Key_Iacute = 0x0cd, Key_Icircumflex = 0x0ce, Key_Idiaeresis = 0x0cf, Key_ETH = 0x0d0, Key_Ntilde = 0x0d1, Key_Ograve = 0x0d2, Key_Oacute = 0x0d3, Key_Ocircumflex = 0x0d4, Key_Otilde = 0x0d5, Key_Odiaeresis = 0x0d6, Key_multiply = 0x0d7, Key_Ooblique = 0x0d8, Key_Ugrave = 0x0d9, Key_Uacute = 0x0da, Key_Ucircumflex = 0x0db, Key_Udiaeresis = 0x0dc, Key_Yacute = 0x0dd, Key_THORN = 0x0de, Key_ssharp = 0x0df, Key_agrave = 0x0e0, Key_aacute = 0x0e1, Key_acircumflex = 0x0e2, Key_atilde = 0x0e3, Key_adiaeresis = 0x0e4, Key_aring = 0x0e5, Key_ae = 0x0e6, Key_ccedilla = 0x0e7, Key_egrave = 0x0e8, Key_eacute = 0x0e9, Key_ecircumflex = 0x0ea, Key_ediaeresis = 0x0eb, Key_igrave = 0x0ec, Key_iacute = 0x0ed, Key_icircumflex = 0x0ee, Key_idiaeresis = 0x0ef, Key_eth = 0x0f0, Key_ntilde = 0x0f1, Key_ograve = 0x0f2, Key_oacute = 0x0f3, Key_ocircumflex = 0x0f4, Key_otilde = 0x0f5, Key_odiaeresis = 0x0f6, Key_division = 0x0f7, Key_oslash = 0x0f8, Key_ugrave = 0x0f9, Key_uacute = 0x0fa, Key_ucircumflex = 0x0fb, Key_udiaeresis = 0x0fc, Key_yacute = 0x0fd, Key_thorn = 0x0fe, Key_ydiaeresis = 0x0ff, Key_unknown = 0xffff, Key_none = 0xffff //= Key_unknown }; } // namespace mitk #endif diff --git a/Modules/Core/src/Rendering/mitkPointSetVtkMapper3D.cpp b/Modules/Core/src/Rendering/mitkPointSetVtkMapper3D.cpp index 8c30df1c50..beafa5cc99 100644 --- a/Modules/Core/src/Rendering/mitkPointSetVtkMapper3D.cpp +++ b/Modules/Core/src/Rendering/mitkPointSetVtkMapper3D.cpp @@ -1,614 +1,594 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkPointSetVtkMapper3D.h" #include "mitkColorProperty.h" #include "mitkDataNode.h" #include "mitkPointSet.h" #include "mitkProperties.h" #include "mitkVtkPropRenderer.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include const mitk::PointSet *mitk::PointSetVtkMapper3D::GetInput() { return static_cast(GetDataNode()->GetData()); } mitk::PointSetVtkMapper3D::PointSetVtkMapper3D() : m_vtkSelectedPointList(nullptr), m_vtkUnselectedPointList(nullptr), m_VtkSelectedPolyDataMapper(nullptr), m_VtkUnselectedPolyDataMapper(nullptr), m_vtkTextList(nullptr), m_NumberOfSelectedAdded(0), m_NumberOfUnselectedAdded(0), m_PointSize(1.0), m_ContourRadius(0.5) { // propassembly m_PointsAssembly = vtkSmartPointer::New(); // creating actors to be able to set transform m_SelectedActor = vtkSmartPointer::New(); m_UnselectedActor = vtkSmartPointer::New(); m_ContourActor = vtkSmartPointer::New(); } mitk::PointSetVtkMapper3D::~PointSetVtkMapper3D() { } void mitk::PointSetVtkMapper3D::ReleaseGraphicsResources(vtkWindow *renWin) { m_PointsAssembly->ReleaseGraphicsResources(renWin); m_SelectedActor->ReleaseGraphicsResources(renWin); m_UnselectedActor->ReleaseGraphicsResources(renWin); m_ContourActor->ReleaseGraphicsResources(renWin); } void mitk::PointSetVtkMapper3D::ReleaseGraphicsResources(mitk::BaseRenderer *renderer) { m_PointsAssembly->ReleaseGraphicsResources(renderer->GetRenderWindow()); m_SelectedActor->ReleaseGraphicsResources(renderer->GetRenderWindow()); m_UnselectedActor->ReleaseGraphicsResources(renderer->GetRenderWindow()); m_ContourActor->ReleaseGraphicsResources(renderer->GetRenderWindow()); } void mitk::PointSetVtkMapper3D::CreateVTKRenderObjects() { m_vtkSelectedPointList = vtkSmartPointer::New(); m_vtkUnselectedPointList = vtkSmartPointer::New(); m_PointsAssembly->VisibilityOn(); if (m_PointsAssembly->GetParts()->IsItemPresent(m_SelectedActor)) m_PointsAssembly->RemovePart(m_SelectedActor); if (m_PointsAssembly->GetParts()->IsItemPresent(m_UnselectedActor)) m_PointsAssembly->RemovePart(m_UnselectedActor); if (m_PointsAssembly->GetParts()->IsItemPresent(m_ContourActor)) m_PointsAssembly->RemovePart(m_ContourActor); - // exceptional displaying for PositionTracker -> MouseOrientationTool - int mapperID; - bool isInputDevice = false; - if (this->GetDataNode()->GetBoolProperty("inputdevice", isInputDevice) && isInputDevice) - { - if (this->GetDataNode()->GetIntProperty("BaseRendererMapperID", mapperID) && mapperID == BaseRenderer::Standard3D) - return; // The event for the PositionTracker came from the 3d widget and not needs to be displayed - } - // get and update the PointSet mitk::PointSet::Pointer input = const_cast(this->GetInput()); /* only update the input data, if the property tells us to */ bool update = true; this->GetDataNode()->GetBoolProperty("updateDataOnRender", update); if (update == true) input->Update(); int timestep = this->GetTimestep(); mitk::PointSet::DataType::Pointer itkPointSet = input->GetPointSet(timestep); if (itkPointSet.GetPointer() == nullptr) { m_PointsAssembly->VisibilityOff(); return; } // now fill selected and unselected pointList // get size of Points in Property m_PointSize = 2; mitk::FloatProperty::Pointer pointSizeProp = dynamic_cast(this->GetDataNode()->GetProperty("pointsize")); if (pointSizeProp.IsNotNull()) m_PointSize = pointSizeProp->GetValue(); // get the property for creating a label onto every point only once bool showLabel = true; this->GetDataNode()->GetBoolProperty("show label", showLabel); const char *pointLabel = nullptr; if (showLabel) { if (dynamic_cast(this->GetDataNode()->GetPropertyList()->GetProperty("label")) != nullptr) pointLabel = dynamic_cast(this->GetDataNode()->GetPropertyList()->GetProperty("label"))->GetValue(); else showLabel = false; } // whether or not to creat a "contour" - connecting lines between all the points int nbPoints = itkPointSet->GetPointData()->Size(); bool makeContour = false; this->GetDataNode()->GetBoolProperty("show contour", makeContour); bool closeContour = false; this->GetDataNode()->GetBoolProperty("close contour", closeContour); int contourPointLimit = 0; // NO contour if (makeContour) { if (closeContour) contourPointLimit = nbPoints; else contourPointLimit = nbPoints - 1; } // build list of all positions for later transform in one go mitk::PointSet::PointsContainer::Iterator pointsIter; int ptIdx; m_NumberOfSelectedAdded = 0; m_NumberOfUnselectedAdded = 0; vtkSmartPointer localPoints = vtkSmartPointer::New(); m_WorldPositions = vtkSmartPointer::New(); m_PointConnections = vtkSmartPointer::New(); // m_PointConnections between points for (ptIdx = 0, pointsIter = itkPointSet->GetPoints()->Begin(); pointsIter != itkPointSet->GetPoints()->End(); pointsIter++, ptIdx++) { itk::Point currentPoint = pointsIter->Value(); localPoints->InsertPoint(ptIdx, currentPoint[0], currentPoint[1], currentPoint[2]); if (makeContour && ptIdx < contourPointLimit) { vtkIdType cell[2] = {(ptIdx + 1) % nbPoints, ptIdx}; m_PointConnections->InsertNextCell(2, cell); } } vtkSmartPointer vtktransform = this->GetDataNode()->GetVtkTransform(this->GetTimestep()); vtktransform->TransformPoints(localPoints, m_WorldPositions); // create contour if (makeContour) { this->CreateContour(m_WorldPositions, m_PointConnections); } // check if the list for the PointDataContainer is the same size as the PointsContainer. Is not, then the points were // inserted manually and can not be visualized according to the PointData (selected/unselected) bool pointDataBroken = (itkPointSet->GetPointData()->Size() != itkPointSet->GetPoints()->Size()); // now add an object for each point in data mitk::PointSet::PointDataContainer::Iterator pointDataIter = itkPointSet->GetPointData()->Begin(); for (ptIdx = 0; ptIdx < nbPoints; ++ptIdx) // pointDataIter moved at end of loop { double currentPoint[3]; m_WorldPositions->GetPoint(ptIdx, currentPoint); vtkSmartPointer source; // check for the pointtype in data and decide which geom-object to take and then add to the selected or unselected // list int pointType; if (itkPointSet->GetPointData()->size() == 0 || pointDataBroken) pointType = mitk::PTUNDEFINED; else pointType = pointDataIter.Value().pointSpec; switch (pointType) { case mitk::PTUNDEFINED: { vtkSmartPointer sphere = vtkSmartPointer::New(); sphere->SetRadius(m_PointSize / 2.0f); sphere->SetCenter(currentPoint); - // sphere->SetCenter(pointsIter.Value()[0],pointsIter.Value()[1],pointsIter.Value()[2]); - - // MouseOrientation Tool (PositionTracker) - if (isInputDevice) - { - sphere->SetThetaResolution(10); - sphere->SetPhiResolution(10); - } - else - { - sphere->SetThetaResolution(20); - sphere->SetPhiResolution(20); - } + sphere->SetThetaResolution(20); + sphere->SetPhiResolution(20); source = sphere; } break; case mitk::PTSTART: { vtkSmartPointer cube = vtkSmartPointer::New(); cube->SetXLength(m_PointSize / 2); cube->SetYLength(m_PointSize / 2); cube->SetZLength(m_PointSize / 2); cube->SetCenter(currentPoint); source = cube; } break; case mitk::PTCORNER: { vtkSmartPointer cone = vtkSmartPointer::New(); cone->SetRadius(m_PointSize / 2.0f); cone->SetCenter(currentPoint); cone->SetResolution(20); source = cone; } break; case mitk::PTEDGE: { vtkSmartPointer cylinder = vtkSmartPointer::New(); cylinder->SetRadius(m_PointSize / 2.0f); cylinder->SetCenter(currentPoint); cylinder->SetResolution(20); source = cylinder; } break; case mitk::PTEND: { vtkSmartPointer sphere = vtkSmartPointer::New(); sphere->SetRadius(m_PointSize / 2.0f); // no SetCenter?? this functionality should be explained! // otherwise: join with default block! sphere->SetThetaResolution(20); sphere->SetPhiResolution(20); source = sphere; } break; default: { vtkSmartPointer sphere = vtkSmartPointer::New(); sphere->SetRadius(m_PointSize / 2.0f); sphere->SetCenter(currentPoint); sphere->SetThetaResolution(20); sphere->SetPhiResolution(20); source = sphere; } break; } if (pointDataIter.Value().selected && !pointDataBroken) { m_vtkSelectedPointList->AddInputConnection(source->GetOutputPort()); ++m_NumberOfSelectedAdded; } else { m_vtkUnselectedPointList->AddInputConnection(source->GetOutputPort()); ++m_NumberOfUnselectedAdded; } if (showLabel) { char buffer[20]; std::string l = pointLabel; if (input->GetSize() > 1) { sprintf(buffer, "%d", ptIdx + 1); l.append(buffer); } // Define the text for the label vtkSmartPointer label = vtkSmartPointer::New(); label->SetText(l.c_str()); //# Set up a transform to move the label to a new position. vtkSmartPointer aLabelTransform = vtkSmartPointer::New(); aLabelTransform->Identity(); aLabelTransform->Translate(currentPoint[0] + 2, currentPoint[1] + 2, currentPoint[2]); aLabelTransform->Scale(5.7, 5.7, 5.7); //# Move the label to a new position. vtkSmartPointer labelTransform = vtkSmartPointer::New(); labelTransform->SetTransform(aLabelTransform); labelTransform->SetInputConnection(label->GetOutputPort()); // add it to the wright PointList if (pointType) { m_vtkSelectedPointList->AddInputConnection(labelTransform->GetOutputPort()); ++m_NumberOfSelectedAdded; } else { m_vtkUnselectedPointList->AddInputConnection(labelTransform->GetOutputPort()); ++m_NumberOfUnselectedAdded; } } if (pointDataIter != itkPointSet->GetPointData()->End()) pointDataIter++; } // end FOR // now according to number of elements added to selected or unselected, build up the rendering pipeline if (m_NumberOfSelectedAdded > 0) { m_VtkSelectedPolyDataMapper = vtkSmartPointer::New(); m_VtkSelectedPolyDataMapper->SetInputConnection(m_vtkSelectedPointList->GetOutputPort()); // create a new instance of the actor m_SelectedActor = vtkSmartPointer::New(); m_SelectedActor->SetMapper(m_VtkSelectedPolyDataMapper); m_PointsAssembly->AddPart(m_SelectedActor); } if (m_NumberOfUnselectedAdded > 0) { m_VtkUnselectedPolyDataMapper = vtkSmartPointer::New(); m_VtkUnselectedPolyDataMapper->SetInputConnection(m_vtkUnselectedPointList->GetOutputPort()); // create a new instance of the actor m_UnselectedActor = vtkSmartPointer::New(); m_UnselectedActor->SetMapper(m_VtkUnselectedPolyDataMapper); m_PointsAssembly->AddPart(m_UnselectedActor); } } void mitk::PointSetVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer *renderer) { bool visible = true; GetDataNode()->GetVisibility(visible, renderer, "visible"); if (!visible) { m_UnselectedActor->VisibilityOff(); m_SelectedActor->VisibilityOff(); m_ContourActor->VisibilityOff(); return; } // create new vtk render objects (e.g. sphere for a point) BaseLocalStorage *ls = m_LSH.GetLocalStorage(renderer); bool needGenerateData = ls->IsGenerateDataRequired(renderer, this, GetDataNode()); if (!needGenerateData) { if (this->GetDataNode()->GetPropertyList()->GetMTime() > ls->GetLastGenerateDataTime() || this->GetDataNode()->GetPropertyList(renderer)->GetMTime() > ls->GetLastGenerateDataTime()) { needGenerateData = true; } } if (needGenerateData) { this->CreateVTKRenderObjects(); ls->UpdateGenerateDataTime(); } this->ApplyAllProperties(renderer, m_ContourActor); bool showPoints = true; this->GetDataNode()->GetBoolProperty("show points", showPoints); m_UnselectedActor->SetVisibility(showPoints); m_SelectedActor->SetVisibility(showPoints); if (false && dynamic_cast(this->GetDataNode()->GetProperty("opacity")) != nullptr) { mitk::FloatProperty::Pointer pointOpacity = dynamic_cast(this->GetDataNode()->GetProperty("opacity")); float opacity = pointOpacity->GetValue(); m_ContourActor->GetProperty()->SetOpacity(opacity); m_UnselectedActor->GetProperty()->SetOpacity(opacity); m_SelectedActor->GetProperty()->SetOpacity(opacity); } bool showContour = false; this->GetDataNode()->GetBoolProperty("show contour", showContour); m_ContourActor->SetVisibility(showContour); } void mitk::PointSetVtkMapper3D::ResetMapper(BaseRenderer * /*renderer*/) { m_PointsAssembly->VisibilityOff(); } vtkProp *mitk::PointSetVtkMapper3D::GetVtkProp(mitk::BaseRenderer * /*renderer*/) { return m_PointsAssembly; } void mitk::PointSetVtkMapper3D::UpdateVtkTransform(mitk::BaseRenderer * /*renderer*/) { } void mitk::PointSetVtkMapper3D::ApplyAllProperties(mitk::BaseRenderer *renderer, vtkActor *actor) { Superclass::ApplyColorAndOpacityProperties(renderer, actor); // check for color props and use it for rendering of selected/unselected points and contour // due to different params in VTK (double/float) we have to convert! // vars to convert to double unselectedColor[4] = {1.0f, 1.0f, 0.0f, 1.0f}; // yellow double selectedColor[4] = {1.0f, 0.0f, 0.0f, 1.0f}; // red double contourColor[4] = {1.0f, 0.0f, 0.0f, 1.0f}; // red // different types for color!!! mitk::Color tmpColor; double opacity = 1.0; // check if there is an unselected property if (dynamic_cast( this->GetDataNode()->GetPropertyList(renderer)->GetProperty("unselectedcolor")) != nullptr) { tmpColor = dynamic_cast( this->GetDataNode()->GetPropertyList(renderer)->GetProperty("unselectedcolor")) ->GetValue(); unselectedColor[0] = tmpColor[0]; unselectedColor[1] = tmpColor[1]; unselectedColor[2] = tmpColor[2]; unselectedColor[3] = 1.0f; //!!define a new ColorProp to be able to pass alpha value } else if (dynamic_cast( this->GetDataNode()->GetPropertyList(nullptr)->GetProperty("unselectedcolor")) != nullptr) { tmpColor = dynamic_cast(this->GetDataNode()->GetPropertyList(nullptr)->GetProperty("unselectedcolor")) ->GetValue(); unselectedColor[0] = tmpColor[0]; unselectedColor[1] = tmpColor[1]; unselectedColor[2] = tmpColor[2]; unselectedColor[3] = 1.0f; //!!define a new ColorProp to be able to pass alpha value } else { // check if the node has a color float unselectedColorTMP[4] = {1.0f, 1.0f, 0.0f, 1.0f}; // yellow m_DataNode->GetColor(unselectedColorTMP, nullptr); unselectedColor[0] = unselectedColorTMP[0]; unselectedColor[1] = unselectedColorTMP[1]; unselectedColor[2] = unselectedColorTMP[2]; // unselectedColor[3] stays 1.0f } // get selected property if (dynamic_cast( this->GetDataNode()->GetPropertyList(renderer)->GetProperty("selectedcolor")) != nullptr) { tmpColor = dynamic_cast(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("selectedcolor")) ->GetValue(); selectedColor[0] = tmpColor[0]; selectedColor[1] = tmpColor[1]; selectedColor[2] = tmpColor[2]; selectedColor[3] = 1.0f; } else if (dynamic_cast( this->GetDataNode()->GetPropertyList(nullptr)->GetProperty("selectedcolor")) != nullptr) { tmpColor = dynamic_cast(this->GetDataNode()->GetPropertyList(nullptr)->GetProperty("selectedcolor")) ->GetValue(); selectedColor[0] = tmpColor[0]; selectedColor[1] = tmpColor[1]; selectedColor[2] = tmpColor[2]; selectedColor[3] = 1.0f; } // get contour property if (dynamic_cast( this->GetDataNode()->GetPropertyList(renderer)->GetProperty("contourcolor")) != nullptr) { tmpColor = dynamic_cast(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("contourcolor")) ->GetValue(); contourColor[0] = tmpColor[0]; contourColor[1] = tmpColor[1]; contourColor[2] = tmpColor[2]; contourColor[3] = 1.0f; } else if (dynamic_cast( this->GetDataNode()->GetPropertyList(nullptr)->GetProperty("contourcolor")) != nullptr) { tmpColor = dynamic_cast(this->GetDataNode()->GetPropertyList(nullptr)->GetProperty("contourcolor")) ->GetValue(); contourColor[0] = tmpColor[0]; contourColor[1] = tmpColor[1]; contourColor[2] = tmpColor[2]; contourColor[3] = 1.0f; } if (dynamic_cast(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("opacity")) != nullptr) { mitk::FloatProperty::Pointer pointOpacity = dynamic_cast(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("opacity")); opacity = pointOpacity->GetValue(); } else if (dynamic_cast(this->GetDataNode()->GetPropertyList(nullptr)->GetProperty("opacity")) != nullptr) { mitk::FloatProperty::Pointer pointOpacity = dynamic_cast(this->GetDataNode()->GetPropertyList(nullptr)->GetProperty("opacity")); opacity = pointOpacity->GetValue(); } // finished color / opacity fishing! // check if a contour shall be drawn bool showContour = false; this->GetDataNode()->GetBoolProperty("show contour", showContour, renderer); if (showContour && (m_ContourActor != nullptr)) { this->CreateContour(m_WorldPositions, m_PointConnections); m_ContourActor->GetProperty()->SetColor(contourColor); m_ContourActor->GetProperty()->SetOpacity(opacity); } m_SelectedActor->GetProperty()->SetColor(selectedColor); m_SelectedActor->GetProperty()->SetOpacity(opacity); m_UnselectedActor->GetProperty()->SetColor(unselectedColor); m_UnselectedActor->GetProperty()->SetOpacity(opacity); } void mitk::PointSetVtkMapper3D::CreateContour(vtkPoints *points, vtkCellArray *m_PointConnections) { vtkSmartPointer vtkContourPolyData = vtkSmartPointer::New(); vtkSmartPointer vtkContourPolyDataMapper = vtkSmartPointer::New(); vtkSmartPointer contour = vtkSmartPointer::New(); contour->SetPoints(points); contour->SetLines(m_PointConnections); vtkSmartPointer tubeFilter = vtkSmartPointer::New(); tubeFilter->SetNumberOfSides(12); tubeFilter->SetInputData(contour); // check for property contoursize. m_ContourRadius = 0.5; mitk::FloatProperty::Pointer contourSizeProp = dynamic_cast(this->GetDataNode()->GetProperty("contoursize")); if (contourSizeProp.IsNotNull()) m_ContourRadius = contourSizeProp->GetValue(); tubeFilter->SetRadius(m_ContourRadius); tubeFilter->Update(); // add to pipeline vtkContourPolyData->AddInputConnection(tubeFilter->GetOutputPort()); vtkContourPolyDataMapper->SetInputConnection(vtkContourPolyData->GetOutputPort()); m_ContourActor->SetMapper(vtkContourPolyDataMapper); m_PointsAssembly->AddPart(m_ContourActor); } void mitk::PointSetVtkMapper3D::SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer, bool overwrite) { node->AddProperty("line width", mitk::IntProperty::New(2), renderer, overwrite); node->AddProperty("pointsize", mitk::FloatProperty::New(1.0), renderer, overwrite); node->AddProperty("selectedcolor", mitk::ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite); // red node->AddProperty("color", mitk::ColorProperty::New(1.0f, 1.0f, 0.0f), renderer, overwrite); // yellow node->AddProperty("opacity", mitk::FloatProperty::New(1.0f), renderer, overwrite); node->AddProperty("show contour", mitk::BoolProperty::New(false), renderer, overwrite); node->AddProperty("close contour", mitk::BoolProperty::New(false), renderer, overwrite); node->AddProperty("contourcolor", mitk::ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite); node->AddProperty("contoursize", mitk::FloatProperty::New(0.5), renderer, overwrite); node->AddProperty("show points", mitk::BoolProperty::New(true), renderer, overwrite); node->AddProperty("updateDataOnRender", mitk::BoolProperty::New(true), renderer, overwrite); Superclass::SetDefaultProperties(node, renderer, overwrite); } diff --git a/Plugins/PluginList.cmake b/Plugins/PluginList.cmake index 8b336a0d7e..abae09f22c 100644 --- a/Plugins/PluginList.cmake +++ b/Plugins/PluginList.cmake @@ -1,89 +1,88 @@ # Plug-ins must be ordered according to their dependencies set(MITK_PLUGINS org.blueberry.core.runtime:ON org.blueberry.core.expressions:OFF org.blueberry.core.commands:OFF org.blueberry.core.jobs:OFF org.blueberry.ui.qt:OFF org.blueberry.ui.qt.help:ON org.blueberry.ui.qt.log:ON org.blueberry.ui.qt.objectinspector:OFF org.mitk.core.services:ON org.mitk.gui.common:ON org.mitk.planarfigure:ON - org.mitk.core.ext:OFF org.mitk.core.jobs:OFF org.mitk.gui.qt.application:ON org.mitk.gui.qt.ext:OFF org.mitk.gui.qt.extapplication:OFF org.mitk.gui.qt.mitkworkbench.intro:OFF org.mitk.gui.qt.common:ON org.mitk.gui.qt.stdmultiwidgeteditor:ON org.mitk.gui.qt.mxnmultiwidgeteditor:OFF org.mitk.gui.qt.cmdlinemodules:OFF org.mitk.gui.qt.chartExample:OFF org.mitk.gui.qt.datamanager:ON org.mitk.gui.qt.datamanagerlight:OFF org.mitk.gui.qt.datastorageviewertest:OFF org.mitk.gui.qt.properties:ON org.mitk.gui.qt.basicimageprocessing:OFF org.mitk.gui.qt.dicombrowser:OFF org.mitk.gui.qt.dicominspector:OFF org.mitk.gui.qt.dosevisualization:OFF org.mitk.gui.qt.geometrytools:OFF org.mitk.gui.qt.igtexamples:OFF org.mitk.gui.qt.igttracking:OFF org.mitk.gui.qt.openigtlink:OFF org.mitk.gui.qt.imagecropper:OFF org.mitk.gui.qt.imagenavigator:ON org.mitk.gui.qt.viewnavigator:OFF org.mitk.gui.qt.materialeditor:OFF org.mitk.gui.qt.measurementtoolbox:OFF org.mitk.gui.qt.moviemaker:OFF org.mitk.gui.qt.pointsetinteraction:OFF org.mitk.gui.qt.pointsetinteractionmultispectrum:OFF org.mitk.gui.qt.python:OFF org.mitk.gui.qt.remeshing:OFF org.mitk.gui.qt.segmentation:OFF org.mitk.gui.qt.deformableclippingplane:OFF org.mitk.gui.qt.aicpregistration:OFF org.mitk.gui.qt.renderwindowmanager:OFF org.mitk.gui.qt.semanticrelations:OFF org.mitk.gui.qt.toftutorial:OFF org.mitk.gui.qt.tofutil:OFF org.mitk.gui.qt.tubegraph:OFF org.mitk.gui.qt.ugvisualization:OFF org.mitk.gui.qt.ultrasound:OFF org.mitk.gui.qt.volumevisualization:OFF org.mitk.gui.qt.eventrecorder:OFF org.mitk.gui.qt.xnat:OFF org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation:OFF org.mitk.gui.qt.classificationsegmentation:OFF org.mitk.gui.qt.overlaymanager:OFF org.mitk.gui.qt.igt.app.hummelprotocolmeasurements:OFF org.mitk.matchpoint.core.helper:OFF org.mitk.gui.qt.matchpoint.algorithm.browser:OFF org.mitk.gui.qt.matchpoint.algorithm.control:OFF org.mitk.gui.qt.matchpoint.mapper:OFF org.mitk.gui.qt.matchpoint.framereg:OFF org.mitk.gui.qt.matchpoint.visualizer:OFF org.mitk.gui.qt.matchpoint.evaluator:OFF org.mitk.gui.qt.matchpoint.manipulator:OFF org.mitk.gui.qt.preprocessing.resampling:OFF org.mitk.gui.qt.radiomics:OFF org.mitk.gui.qt.cest:OFF org.mitk.gui.qt.fit.demo:OFF org.mitk.gui.qt.fit.inspector:OFF org.mitk.gui.qt.fit.genericfitting:OFF org.mitk.gui.qt.pharmacokinetics.mri:OFF org.mitk.gui.qt.pharmacokinetics.pet:OFF org.mitk.gui.qt.pharmacokinetics.simulation:OFF org.mitk.gui.qt.pharmacokinetics.curvedescriptor:OFF org.mitk.gui.qt.pharmacokinetics.concentration.mri:OFF org.mitk.gui.qt.flowapplication:OFF org.mitk.gui.qt.flow.segmentation:OFF org.mitk.gui.qt.pixelvalue:ON ) diff --git a/Plugins/org.mitk.core.ext/CMakeLists.txt b/Plugins/org.mitk.core.ext/CMakeLists.txt deleted file mode 100755 index 1eeffccb13..0000000000 --- a/Plugins/org.mitk.core.ext/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -project(org_mitk_core_ext) - -mitk_create_plugin( - EXPORT_DIRECTIVE MITKCOREEXT_EXPORT - EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDS MitkCore -) - diff --git a/Plugins/org.mitk.core.ext/documentation/doxygen/modules.dox b/Plugins/org.mitk.core.ext/documentation/doxygen/modules.dox deleted file mode 100755 index 746060c9f1..0000000000 --- a/Plugins/org.mitk.core.ext/documentation/doxygen/modules.dox +++ /dev/null @@ -1,19 +0,0 @@ -/** - \defgroup org_mitk_core_ext org.mitk.core.ext - \ingroup MITKPlugins - - \brief This small plug-in is responsible for initializing the MBI CoreExt module. - - It is started with an "eager" Bundle-ActivationPolicy, sucht that the plug-ins - activator is executed before any other (non-eager) plug-ins. - -*/ - -/** - \defgroup org_mitk_core_ext_internal Internal - \ingroup org_mitk_core_ext - - \brief This subcategory includes the internal classes of the org.mitk.core.ext plugin. Other - plugins must not rely on these classes. They contain implementation details and their interface - may change at any time. We mean it. -*/ diff --git a/Plugins/org.mitk.core.ext/files.cmake b/Plugins/org.mitk.core.ext/files.cmake deleted file mode 100755 index d16543df69..0000000000 --- a/Plugins/org.mitk.core.ext/files.cmake +++ /dev/null @@ -1,33 +0,0 @@ - -set(SRC_CPP_FILES - mitkCoreExtConstants.cpp - mitkIInputDeviceDescriptor.h - mitkIInputDeviceRegistry.h - mitkIInputDevice.h -) - -set(INTERNAL_CPP_FILES - mitkCoreExtActivator.cpp - mitkInputDeviceRegistry.cpp - mitkInputDeviceDescriptor.cpp -) - -set(CACHED_RESOURCE_FILES - plugin.xml -) - -set(MOC_H_FILES - src/internal/mitkCoreExtActivator.h - src/internal/mitkInputDeviceRegistry.h -) - -set(CPP_FILES ) - -foreach(file ${SRC_CPP_FILES}) - set(CPP_FILES ${CPP_FILES} src/${file}) -endforeach(file ${SRC_CPP_FILES}) - -foreach(file ${INTERNAL_CPP_FILES}) - set(CPP_FILES ${CPP_FILES} src/internal/${file}) -endforeach(file ${INTERNAL_CPP_FILES}) - diff --git a/Plugins/org.mitk.core.ext/manifest_headers.cmake b/Plugins/org.mitk.core.ext/manifest_headers.cmake deleted file mode 100644 index 32a48a5359..0000000000 --- a/Plugins/org.mitk.core.ext/manifest_headers.cmake +++ /dev/null @@ -1,5 +0,0 @@ -set(Plugin-Name "MITK Extensions") -set(Plugin-Version "0.1") -set(Plugin-Vendor "German Cancer Research Center (DKFZ)") -set(Plugin-ContactAddress "https://www.mitk.org") -set(Require-Plugin org.blueberry.core.runtime) diff --git a/Plugins/org.mitk.core.ext/plugin.xml b/Plugins/org.mitk.core.ext/plugin.xml deleted file mode 100644 index 6b6ceeb06f..0000000000 --- a/Plugins/org.mitk.core.ext/plugin.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/Plugins/org.mitk.core.ext/schema/inputdevice.exsd b/Plugins/org.mitk.core.ext/schema/inputdevice.exsd deleted file mode 100644 index cc2159a250..0000000000 --- a/Plugins/org.mitk.core.ext/schema/inputdevice.exsd +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.cpp b/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.cpp deleted file mode 100644 index 6f00d0b756..0000000000 --- a/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include "mitkCoreExtActivator.h" - -#include "mitkCoreExtConstants.h" -#include "mitkLogMacros.h" - -#include - -#include -#include -#include - -#include - -US_INITIALIZE_MODULE - -namespace mitk -{ - void CoreExtActivator::start(ctkPluginContext* context) - { - Q_UNUSED(context) - - this->StartInputDeviceModules(context); - } - - void CoreExtActivator::stop(ctkPluginContext* context) - { - Q_UNUSED(context) - } - - void CoreExtActivator::StartInputDeviceModules(ctkPluginContext* context) - { - m_InputDeviceRegistry.reset(new InputDeviceRegistry()); - context->registerService(m_InputDeviceRegistry.data()); - - auto* prefService = mitk::CoreServices::GetPreferencesService(); - auto* extPreferencesNode = prefService->GetSystemPreferences()->Node(CoreExtConstants::INPUTDEVICE_PREFERENCES.toStdString()); - - // Initializes the modules - QList descriptors(m_InputDeviceRegistry->GetInputDevices()); - for (QList::const_iterator it = descriptors.begin(); - it != descriptors.end(); ++it) - { - if (extPreferencesNode->GetBool((*it)->GetID().toStdString(), false)) - { - IInputDevice::Pointer temp = (*it)->CreateInputDevice(); - temp->RegisterInputDevice(); - } - } - } - - CoreExtActivator::~CoreExtActivator() - { - } - -} // end namespace mitk diff --git a/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.h b/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.h deleted file mode 100755 index 42a15fea33..0000000000 --- a/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.h +++ /dev/null @@ -1,64 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - - -#ifndef mitkCoreExtActivator_h -#define mitkCoreExtActivator_h - -#include - -#include "mitkInputDeviceRegistry.h" - -namespace mitk -{ - - /** - * @brief The activator class for the org.mitk.core.ext plug-in. - * @ingroup org_mitk_core_ext_internal - * - * When the plug-in is started by the framework, it calls a global function to initialize - * the mitkCoreExt module. - * - */ - class CoreExtActivator : public QObject, public ctkPluginActivator - { - Q_OBJECT - Q_PLUGIN_METADATA(IID "org_mitk_core_ext") - Q_INTERFACES(ctkPluginActivator) - - public: - - ~CoreExtActivator() override; - - /** - * Starts this plug-in and registers object factories. - * - * @param context - * The context for the plug-in. - */ - void start(ctkPluginContext* context) override; - - void stop(ctkPluginContext* context) override; - - private: - - /** - * Activates the input device modules. - */ - void StartInputDeviceModules(ctkPluginContext *context); - - QScopedPointer m_InputDeviceRegistry; - - }; // end class CoreExtActivator -} //end namespace mitk - -#endif diff --git a/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceDescriptor.cpp b/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceDescriptor.cpp deleted file mode 100644 index d4c056a44a..0000000000 --- a/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceDescriptor.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include "mitkInputDeviceDescriptor.h" -#include "mitkCoreExtConstants.h" - - -mitk::InputDeviceDescriptor::InputDeviceDescriptor(berry::IConfigurationElement::Pointer inputDeviceExtensionPoint) -: IInputDeviceDescriptor(), m_InputDeviceExtensionPoint(inputDeviceExtensionPoint) -{ -} - -mitk::InputDeviceDescriptor::~InputDeviceDescriptor() -{ -} - -mitk::IInputDevice::Pointer mitk::InputDeviceDescriptor::CreateInputDevice() -{ - if(this->m_InputDevice == 0) - { - // "class" refers to xml attribute in a xml tag - this->m_InputDevice = this->m_InputDeviceExtensionPoint - ->CreateExecutableExtension(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_CLASS); - if (this->m_InputDevice == 0) - { - // support legacy BlueBerry extensions - this->m_InputDevice = this->m_InputDeviceExtensionPoint - ->CreateExecutableExtension(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_CLASS); - } - } - return this->m_InputDevice; -} - -QString mitk::InputDeviceDescriptor::GetID() const -{ - return this->m_InputDeviceExtensionPoint->GetAttribute(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_ID); -} - -QString mitk::InputDeviceDescriptor::GetDescription() const -{ - QList - descriptions(this->m_InputDeviceExtensionPoint->GetChildren(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_DESCRIPTION)); - - if(!descriptions.empty()) - { - return descriptions[0]->GetValue(); - } - return QString(); -} - -QString mitk::InputDeviceDescriptor::GetName() const -{ - return this->m_InputDeviceExtensionPoint->GetAttribute(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_NAME); -} - -bool mitk::InputDeviceDescriptor::operator==(const Object* object) const -{ - if (const InputDeviceDescriptor* other = dynamic_cast(object)) - { - return this->GetID() == other->GetID(); - } - return false; -} - diff --git a/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceDescriptor.h b/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceDescriptor.h deleted file mode 100644 index d04d51aee0..0000000000 --- a/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceDescriptor.h +++ /dev/null @@ -1,84 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#ifndef mitkInputDeviceDescriptor_h -#define mitkInputDeviceDescriptor_h - -#include - -#include - -#include "mitkIInputDeviceDescriptor.h" -#include "mitkIInputDevice.h" - -namespace mitk -{ - -/** - * Documentation in the interface. - * - * @see mitk::IInputDeviceDescriptor - * @ingroup org_mitk_core_ext - */ -class InputDeviceDescriptor : public IInputDeviceDescriptor -{ - -public: - - /** - * Initialize the Input Device Descriptor with the given extension point. - * - * @param inputDeviceExtensionPoint - * element, that refers to a extension point (type, id, name, class) - */ - InputDeviceDescriptor(berry::IConfigurationElement::Pointer inputDeviceExtensionPoint); - - /** - * Default destructor - */ - ~InputDeviceDescriptor() override; - - /** - * @see mitk::IInputDeviceDescriptor::CreateInputDevice() - */ - mitk::IInputDevice::Pointer CreateInputDevice() override; - - /** - * @see mitk::IInputDeviceDescriptor::GetDescription() - */ - QString GetDescription() const override; - - /** - * @see mitk::IInputDeviceDescriptor::GetID() - */ - QString GetID() const override; - - /** - * @see mitk::IInputDeviceDescriptor::GetName() - */ - QString GetName() const override; - - /** - * @see mitk::IInputDeviceDescriptor::operator==(const Object* object) - */ - bool operator==(const Object* object) const override; - -private: - - // IConfigurationElements are used to access xml files (here: plugin.xml) - berry::IConfigurationElement::Pointer m_InputDeviceExtensionPoint; - mitk::IInputDevice::Pointer m_InputDevice; - -}; // end class -} // end namespace - -#endif diff --git a/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceRegistry.cpp b/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceRegistry.cpp deleted file mode 100644 index c4dd08483d..0000000000 --- a/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceRegistry.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include -#include -#include - -#include - -#include "mitkInputDeviceRegistry.h" -#include "mitkInputDeviceDescriptor.h" - - -mitk::InputDeviceRegistry::InputDeviceRegistry() -{ - //initialize the registry by copying all available extension points into a local variable - berry::IExtensionRegistry* extensionPointService = berry::Platform::GetExtensionRegistry(); - QList allExtensionsInputDevices - = extensionPointService->GetConfigurationElementsFor(mitk::CoreExtConstants::INPUTDEVICE_EXTENSION_NAME); - - for(QList::const_iterator it = allExtensionsInputDevices.begin(); - it != allExtensionsInputDevices.end();++it) - { - InputDeviceDescriptorPtr temp(new mitk::InputDeviceDescriptor(*it)); - - // The equation with the end means, that if there is no such element and - // the pointer will be at end (not the last element, actually after it) - if(this->m_ListRegisteredDevices.find(temp->GetID()) == this->m_ListRegisteredDevices.end()) - { - m_ListRegisteredDevices.insert(temp->GetID(), temp); - } - else - { - throw ctkRuntimeException("The Input Device ID: " + temp->GetID() + " is already registered."); - } - } -} - -mitk::InputDeviceRegistry::~InputDeviceRegistry() -{ -} - -mitk::InputDeviceRegistry::InputDeviceDescriptorPtr mitk::InputDeviceRegistry::Find(const QString &id) const -{ - QHash::ConstIterator result = this->m_ListRegisteredDevices.find(id); - - // first = key, second = element or vice versa, if inserted different in the hash map - if(result != this->m_ListRegisteredDevices.end()) return result.value(); - - return InputDeviceDescriptorPtr(nullptr); -} - -QList mitk::InputDeviceRegistry::GetInputDevices() const -{ - return m_ListRegisteredDevices.values(); -} diff --git a/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceRegistry.h b/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceRegistry.h deleted file mode 100644 index 459c1f5e3a..0000000000 --- a/Plugins/org.mitk.core.ext/src/internal/mitkInputDeviceRegistry.h +++ /dev/null @@ -1,60 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#ifndef mitkInputDeviceRegistry_h -#define mitkInputDeviceRegistry_h - -#include -#include - -#include - -namespace mitk -{ - /** - * Documentation in the interface. - * - * @see mitk::IInputDeviceRegistry - * @ingroup org_mitk_core_ext - */ - class InputDeviceRegistry : public QObject, public IInputDeviceRegistry - { - Q_OBJECT - Q_INTERFACES(mitk::IInputDeviceRegistry) - - public: - - // easier maintenance - typedef IInputDeviceDescriptor::Pointer InputDeviceDescriptorPtr; - - InputDeviceRegistry(); - ~InputDeviceRegistry() override; - - /** - * @see mitk::IInputDeviceRegistry::Find(const std::string& id) - */ - InputDeviceDescriptorPtr Find(const QString& id) const override; - - /** - * @see mitk::IInputDeviceRegistry´::GetInputDevices() - */ - QList GetInputDevices() const override; - - protected: - - private: - QHash m_ListRegisteredDevices; - - }; // end class InputDeviceRegistry -} // end namespace mitk - -#endif diff --git a/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.cpp b/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.cpp deleted file mode 100644 index b88cd9ec1b..0000000000 --- a/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include - -const QString mitk::CoreExtConstants::INPUTDEVICE_SERVICE = "org.mitk.core.ext.services.inputdeviceregistry"; -const QString mitk::CoreExtConstants::INPUTDEVICE_PREFERENCES = "org.mitk.core.ext.preferences.inputdevices"; -const QString mitk::CoreExtConstants::INPUTDEVICE_EXTENSION_NAME = "org.mitk.core.ext.inputdevices"; -const QString mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_CLASS = "class"; -const QString mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_DESCRIPTION = "description"; -const QString mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_NAME = "name"; -const QString mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_ID = "id"; -const QString mitk::CoreExtConstants::WIIMOTE_SURFACEINTERACTION = "Surface Interaction"; -const QString mitk::CoreExtConstants::WIIMOTE_HEADTRACKING = "Headtracking"; -const QString mitk::CoreExtConstants::WIIMOTE_XMLATTRIBUTE_NAME = "org.mitk.inputdevices.wiimote"; diff --git a/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.h b/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.h deleted file mode 100644 index 4971b71e7b..0000000000 --- a/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.h +++ /dev/null @@ -1,49 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#ifndef mitkCoreExtConstants_h -#define mitkCoreExtConstants_h - -#include - -#include - -namespace mitk -{ - /** - * The CoreExt Constants contains a list of unique ids in the following form:
- * "org.mitk.mybundle.mytype.propername"
- * - * This ids have the purpose of connecting the plugin.xml of each bundle to the - * appropriate classes. - * - * Additionally it includes names of tags, which are used in XML files
- * regarding any input device. - * - * @ingroup org_mitk_core_ext - */ - struct MITKCOREEXT_EXPORT CoreExtConstants - { - static const QString INPUTDEVICE_SERVICE; - static const QString INPUTDEVICE_PREFERENCES; - static const QString INPUTDEVICE_EXTENSION_NAME; - static const QString INPUTDEVICE_XMLATTRIBUTE_CLASS; - static const QString INPUTDEVICE_XMLATTRIBUTE_DESCRIPTION; - static const QString INPUTDEVICE_XMLATTRIBUTE_NAME; - static const QString INPUTDEVICE_XMLATTRIBUTE_ID; - static const QString WIIMOTE_SURFACEINTERACTION; - static const QString WIIMOTE_HEADTRACKING; - static const QString WIIMOTE_XMLATTRIBUTE_NAME; - }; -} - -#endif diff --git a/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h b/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h deleted file mode 100644 index ccb40e8385..0000000000 --- a/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h +++ /dev/null @@ -1,52 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#ifndef mitkIInputDevice_h -#define mitkIInputDevice_h - -#include -#include - -#include - -namespace mitk -{ - /** - * An input device provides a method to register and unregister itself. Meaning
- * for example adding listeners and instianciate classes necessary to use the input device. - * - * @note This interface is not intended to be implemented by clients. - * @ingroup org_mitk_core_ext - */ - struct IInputDevice : public berry::Object - { - - berryObjectMacro(mitk::IInputDevice); - - /** - * Register the input device at one or more instances. - */ - virtual bool RegisterInputDevice() = 0; - - /** - * Unregister the input device at one or more instances. - */ - virtual bool UnRegisterInputDevice() = 0; - - ~IInputDevice() override {} - - }; // end struct IInputDevice -} // end namespace mitk - -Q_DECLARE_INTERFACE(mitk::IInputDevice, "org.mitk.IInputDevice") - -#endif diff --git a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceDescriptor.h b/Plugins/org.mitk.core.ext/src/mitkIInputDeviceDescriptor.h deleted file mode 100644 index ab24f45834..0000000000 --- a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceDescriptor.h +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#ifndef mitkIInputDeviceDescriptor_h -#define mitkIInputDeviceDescriptor_h - -#include -#include - -#include "mitkIInputDevice.h" - -namespace mitk -{ - /** - * This is an input device descriptor. It provides a "description" of a given - * input device, so that the input device can later be constructed and registered. - *

- * The input device registry provides facilities to map from an extension - * to a IInputDeviceDescriptor. - *

- *

- * This interface is not intended to be implemented by clients. - *

- * - * @see mitk::IInputDeviceRegistry - * @ingroup org_mitk_core_ext - */ - struct IInputDeviceDescriptor : public berry::Object - { - - berryObjectMacro(mitk::IInputDeviceDescriptor); - - /** - * Creates an instance of an input device defined in the descriptor. - * - * @return the input device - */ - virtual IInputDevice::Pointer CreateInputDevice() = 0; - - /** - * Returns the description of this input device. - * - * @return the description - */ - virtual QString GetDescription() const = 0; - - /** - * Returns the id of this input device. - * - * @return the id - */ - virtual QString GetID() const = 0; - - /** - * Returns the name of this input device. - * - * @return the name - */ - virtual QString GetName() const = 0; - - // /** - // * Returns the descriptor for the icon to show for this view. - // */ - //virtual SmartPointer GetImageDescriptor() const = 0; - - /** - * Equals this class with the given parameter. - * - * @param object the object for the equation - * @return true, if the objects are equal :: false, if they differ in any way - */ - bool operator==(const Object* object) const override = 0; - - }; // end struct IInputDeviceDescriptor -} //end namespace mitk - -#endif diff --git a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h b/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h deleted file mode 100644 index 1d59a8505c..0000000000 --- a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h +++ /dev/null @@ -1,64 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#ifndef mitkIInputDeviceRegistry_h -#define mitkIInputDeviceRegistry_h - -#include - -#include "mitkIInputDeviceDescriptor.h" - -namespace mitk -{ - /** - * - * The input device registry maintains a list of input devices explicitly registered - * against the view extension point. - *

- * The description of a given input device is kept in a IInputDeviceDescriptor. - *

- *

- * This interface is not intended to be implemented by clients. - *

- * - * @see mitk::IInputDeviceDescriptor - * @note This interface is not intended to be implemented by clients. - * @ingroup org_mitk_core_ext - */ - struct IInputDeviceRegistry - { - - /** - * Return an input device descriptor with the given extension id. If no input device exists, - * with the id return null. - * - * @param id - * the id to search for - * @return the descriptor or null - */ - virtual IInputDeviceDescriptor::Pointer Find(const QString& id) const = 0; - - /** - * Return a list of input devices defined in the registry. - * - * @return the input devices. - */ - virtual QList GetInputDevices() const = 0; - - virtual ~IInputDeviceRegistry() {} - - }; // end struct IInputDeviceRegistry -} // end namespace mitk - -Q_DECLARE_INTERFACE(mitk::IInputDeviceRegistry, "org.mitk.service.IInputDeviceRegistry") - -#endif diff --git a/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.h b/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.h deleted file mode 100644 index 25e99a8bbb..0000000000 --- a/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.h +++ /dev/null @@ -1,83 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#ifndef mitkInputDeviceDescriptor_h -#define mitkInputDeviceDescriptor_h - -#include - -#include - -#include "mitkIInputDeviceDescriptor.h" -#include "mitkIInputDevice.h" - -namespace mitk -{ - /** - * Documentation in the interface. - * - * @see mitk::IInputDeviceDescriptor - * @ingroup org_mitk_core_ext - */ - class InputDeviceDescriptor : public IInputDeviceDescriptor - { - - public: - - /** - * Initialize the Input Device Descriptor with the given extension point. - * - * @param inputDeviceExtensionPoint - * element, that refers to a extension point (type, id, name, class) - */ - InputDeviceDescriptor(berry::IConfigurationElement::Pointer inputDeviceExtensionPoint); - - /** - * Default destructor - */ - ~InputDeviceDescriptor(); - - /** - * @see mitk::IInputDeviceDescriptor::CreateInputDevice() - */ - mitk::IInputDevice::Pointer CreateInputDevice(); - - /** - * @see mitk::IInputDeviceDescriptor::GetDescription() - */ - std::string GetDescription() const; - - /** - * @see mitk::IInputDeviceDescriptor::GetID() - */ - std::string GetID() const; - - /** - * @see mitk::IInputDeviceDescriptor::GetName() - */ - std::string GetName() const; - - /** - * @see mitk::IInputDeviceDescriptor::operator==(const Object* object) - */ - bool operator==(const Object* object) const; - - private: - - // IConfigurationElements are used to access xml files (here: plugin.xml) - berry::IConfigurationElement::Pointer m_InputDeviceExtensionPoint; - mitk::IInputDevice::Pointer m_InputDevice; - - }; // end class -} // end namespace - -#endif diff --git a/Plugins/org.mitk.gui.qt.ext/files.cmake b/Plugins/org.mitk.gui.qt.ext/files.cmake index 562bc5d984..d00f357e6c 100644 --- a/Plugins/org.mitk.gui.qt.ext/files.cmake +++ b/Plugins/org.mitk.gui.qt.ext/files.cmake @@ -1,63 +1,61 @@ set(SRC_CPP_FILES QmitkExtActionBarAdvisor.cpp QmitkExtWorkbenchWindowAdvisor.cpp QmitkExtFileSaveProjectAction.cpp QmitkOpenDicomEditorAction.cpp QmitkOpenMxNMultiWidgetEditorAction.cpp QmitkOpenStdMultiWidgetEditorAction.cpp ) set(INTERNAL_CPP_FILES QmitkAboutHandler.cpp QmitkAppInstancesPreferencePage.cpp QmitkExternalProgramsPreferencePage.cpp QmitkCommonExtPlugin.cpp - QmitkInputDevicesPrefPage.cpp QmitkModuleView.cpp ) set(UI_FILES src/internal/QmitkAppInstancesPreferencePage.ui src/internal/QmitkExternalProgramsPreferencePage.ui ) set(MOC_H_FILES src/QmitkExtFileSaveProjectAction.h src/QmitkExtWorkbenchWindowAdvisor.h src/internal/QmitkAboutHandler.h src/internal/QmitkAppInstancesPreferencePage.h src/internal/QmitkExternalProgramsPreferencePage.h src/internal/QmitkCommonExtPlugin.h src/internal/QmitkExtWorkbenchWindowAdvisorHack.h - src/internal/QmitkInputDevicesPrefPage.h src/internal/QmitkModuleView.h src/QmitkOpenDicomEditorAction.h src/QmitkOpenMxNMultiWidgetEditorAction.h src/QmitkOpenStdMultiWidgetEditorAction.h ) set(CACHED_RESOURCE_FILES # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench plugin.xml resources/ModuleView.png ) set(QRC_FILES # uncomment the following line if you want to use Qt resources resources/org_mitk_gui_qt_ext.qrc resources/org_mitk_icons.qrc ) set(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) 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.ext/manifest_headers.cmake b/Plugins/org.mitk.gui.qt.ext/manifest_headers.cmake index 9a31004ed0..52edead2e7 100644 --- a/Plugins/org.mitk.gui.qt.ext/manifest_headers.cmake +++ b/Plugins/org.mitk.gui.qt.ext/manifest_headers.cmake @@ -1,5 +1,5 @@ set(Plugin-Name "Common Qt Ext Plugin") set(Plugin-Version "0.1") set(Plugin-Vendor "German Cancer Research Center (DKFZ)") set(Plugin-ContactAddress "https://www.mitk.org") -set(Require-Plugin org.mitk.core.ext org.mitk.gui.qt.application) +set(Require-Plugin org.mitk.gui.qt.application) diff --git a/Plugins/org.mitk.gui.qt.ext/plugin.xml b/Plugins/org.mitk.gui.qt.ext/plugin.xml index ecba76ad09..a1656fa533 100644 --- a/Plugins/org.mitk.gui.qt.ext/plugin.xml +++ b/Plugins/org.mitk.gui.qt.ext/plugin.xml @@ -1,42 +1,36 @@ - - - - - - diff --git a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkCommonExtPlugin.cpp b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkCommonExtPlugin.cpp index baf901c607..7e85faa6f1 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkCommonExtPlugin.cpp +++ b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkCommonExtPlugin.cpp @@ -1,239 +1,237 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "QmitkCommonExtPlugin.h" #include #include "QmitkAboutHandler.h" #include "QmitkAppInstancesPreferencePage.h" #include "QmitkExternalProgramsPreferencePage.h" -#include "QmitkInputDevicesPrefPage.h" #include "QmitkModuleView.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include US_INITIALIZE_MODULE ctkPluginContext* QmitkCommonExtPlugin::_context = nullptr; void QmitkCommonExtPlugin::start(ctkPluginContext* context) { this->_context = context; QtWidgetsExtRegisterClasses(); BERRY_REGISTER_EXTENSION_CLASS(QmitkAboutHandler, context) BERRY_REGISTER_EXTENSION_CLASS(QmitkAppInstancesPreferencePage, context) BERRY_REGISTER_EXTENSION_CLASS(QmitkExternalProgramsPreferencePage, context) - BERRY_REGISTER_EXTENSION_CLASS(QmitkInputDevicesPrefPage, context) BERRY_REGISTER_EXTENSION_CLASS(QmitkModuleView, context) if (qApp->metaObject()->indexOfSignal("messageReceived(QByteArray)") > -1) { connect(qApp, SIGNAL(messageReceived(QByteArray)), this, SLOT(handleIPCMessage(QByteArray))); } // This is a potentially long running operation. loadDataFromDisk(berry::Platform::GetApplicationArgs(), true); } void QmitkCommonExtPlugin::stop(ctkPluginContext* context) { Q_UNUSED(context) this->_context = nullptr; } ctkPluginContext* QmitkCommonExtPlugin::getContext() { return _context; } void QmitkCommonExtPlugin::loadDataFromDisk(const QStringList &arguments, bool globalReinit) { if (!arguments.empty()) { ctkServiceReference serviceRef = _context->getServiceReference(); if (serviceRef) { mitk::IDataStorageService* dataStorageService = _context->getService(serviceRef); mitk::DataStorage::Pointer dataStorage = dataStorageService->GetDefaultDataStorage()->GetDataStorage(); int argumentsAdded = 0; for (int i = 0; i < arguments.size(); ++i) { if (arguments[i].right(5) == ".mitk") { mitk::SceneIO::Pointer sceneIO = mitk::SceneIO::New(); bool clearDataStorageFirst(false); mitk::ProgressBar::GetInstance()->AddStepsToDo(2); dataStorage = sceneIO->LoadScene( arguments[i].toLocal8Bit().constData(), dataStorage, clearDataStorageFirst ); mitk::ProgressBar::GetInstance()->Progress(2); argumentsAdded++; } else if (arguments[i].right(15) == ".mitksceneindex") { mitk::SceneIO::Pointer sceneIO = mitk::SceneIO::New(); bool clearDataStorageFirst(false); mitk::ProgressBar::GetInstance()->AddStepsToDo(2); dataStorage = sceneIO->LoadSceneUnzipped(arguments[i].toLocal8Bit().constData(), dataStorage, clearDataStorageFirst); mitk::ProgressBar::GetInstance()->Progress(2); argumentsAdded++; } else { try { const std::string path(arguments[i].toStdString()); auto addedNodes = mitk::IOUtil::Load(path, *dataStorage); for (const auto& node : *addedNodes ) { node->SetIntProperty("layer", argumentsAdded); } argumentsAdded++; } catch(...) { MITK_WARN << "Failed to load command line argument: " << arguments[i].toStdString(); } } } // end for each command line argument if (argumentsAdded > 0 && globalReinit) { // calculate bounding geometry mitk::RenderingManager::GetInstance()->InitializeViews(dataStorage->ComputeBoundingGeometry3D()); } } else { MITK_ERROR << "A service reference for mitk::IDataStorageService does not exist"; } } } void QmitkCommonExtPlugin::startNewInstance(const QStringList &args, const QStringList& files) { QStringList newArgs(args); #ifdef Q_OS_UNIX newArgs << QString("--") + mitk::BaseApplication::ARG_NEWINSTANCE; #else newArgs << QString("/") + mitk::BaseApplication::ARG_NEWINSTANCE; #endif newArgs << files; QProcess::startDetached(qApp->applicationFilePath(), newArgs); } void QmitkCommonExtPlugin::handleIPCMessage(const QByteArray& msg) { QDataStream ds(msg); QString msgType; ds >> msgType; // we only handle messages containing command line arguments if (msgType != "$cmdLineArgs") return; // activate the current workbench window berry::IWorkbenchWindow::Pointer window = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow(); QMainWindow* mainWindow = static_cast (window->GetShell()->GetControl()); mainWindow->setWindowState(mainWindow->windowState() & ~Qt::WindowMinimized); mainWindow->raise(); mainWindow->activateWindow(); // Get the preferences for the instantiation behavior auto* prefService = mitk::CoreServices::GetPreferencesService(); auto* prefs = prefService->GetSystemPreferences()->Node("/General"); bool newInstanceAlways = prefs->GetBool("newInstance.always", false); bool newInstanceScene = prefs->GetBool("newInstance.scene", true); QStringList args; ds >> args; QStringList fileArgs; QStringList sceneArgs; foreach (QString arg, args) { if (arg.endsWith(".mitk")) { sceneArgs << arg; } else { fileArgs << arg; } } if (newInstanceAlways) { if (newInstanceScene) { startNewInstance(args, fileArgs); foreach(QString sceneFile, sceneArgs) { startNewInstance(args, QStringList(sceneFile)); } } else { fileArgs.append(sceneArgs); startNewInstance(args, fileArgs); } } else { loadDataFromDisk(fileArgs, false); if (newInstanceScene) { foreach(QString sceneFile, sceneArgs) { startNewInstance(args, QStringList(sceneFile)); } } else { loadDataFromDisk(sceneArgs, false); } } } diff --git a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkInputDevicesPrefPage.cpp b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkInputDevicesPrefPage.cpp deleted file mode 100644 index ad4632cd6a..0000000000 --- a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkInputDevicesPrefPage.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include "QmitkInputDevicesPrefPage.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "QmitkCommonExtPlugin.h" - -namespace -{ - mitk::IPreferences* GetPreferences() - { - auto* preferencesService = mitk::CoreServices::GetPreferencesService(); - return preferencesService->GetSystemPreferences()->Node(mitk::CoreExtConstants::INPUTDEVICE_PREFERENCES.toStdString()); - } -} - -QmitkInputDevicesPrefPage::QmitkInputDevicesPrefPage() -: m_MainControl(nullptr) -{ -} - -void QmitkInputDevicesPrefPage::Init(berry::IWorkbench::Pointer ) -{ -} - -void QmitkInputDevicesPrefPage::CreateQtControl(QWidget* parent) -{ - m_MainControl = new QWidget(parent); - auto layout = new QVBoxLayout; - - QList temp(GetInputDeviceRegistry()->GetInputDevices()); - - for(QList::const_iterator it = temp.begin(); it != temp.end();++it) - { - QString inputDeviceName((*it)->GetName()); - auto checkBox = new QCheckBox((inputDeviceName),m_MainControl); - layout->addWidget(checkBox); - m_InputDevices.insert(checkBox,(*it)->GetID()); - - if(inputDeviceName == "WiiMote") - { - m_WiiMoteModes = new QGroupBox("WiiMote Modus"); - - m_WiiMoteHeadTracking = new QRadioButton(mitk::CoreExtConstants::WIIMOTE_HEADTRACKING); - m_WiiMoteSurfaceInteraction = new QRadioButton(mitk::CoreExtConstants::WIIMOTE_SURFACEINTERACTION); - m_WiiMoteHeadTracking->setChecked(true); - - auto vBoxLayout = new QVBoxLayout; - - vBoxLayout->addWidget(m_WiiMoteHeadTracking); - vBoxLayout->addWidget(m_WiiMoteSurfaceInteraction); - - m_WiiMoteModes->setLayout(vBoxLayout); - - layout->addWidget(m_WiiMoteModes); - } - - } - - layout->addStretch(); - m_MainControl->setLayout(layout); - this->Update(); -} - -QWidget* QmitkInputDevicesPrefPage::GetQtControl() const -{ - return m_MainControl; -} - -bool QmitkInputDevicesPrefPage::PerformOk() -{ - auto* prefs = GetPreferences(); - bool result = true; - - mitk::IInputDeviceRegistry* inputDeviceRegistry = GetInputDeviceRegistry(); - - QHashIterator it(m_InputDevices); - while (it.hasNext()) - { - it.next(); - mitk::IInputDeviceDescriptor::Pointer inputdevice(inputDeviceRegistry->Find(it.value())); - - if(it.value() == mitk::CoreExtConstants::WIIMOTE_XMLATTRIBUTE_NAME) - { - const auto headTracking(m_WiiMoteHeadTracking->text().toStdString()); - const auto surfaceInteraction(m_WiiMoteSurfaceInteraction->text().toStdString()); - - prefs->PutBool(headTracking, m_WiiMoteHeadTracking->isChecked()); - prefs->PutBool(surfaceInteraction, m_WiiMoteSurfaceInteraction->isChecked()); - - // forced flush of the preferences is needed - // because otherwise the mitk::WiiMoteActivator class - // cannot distinguish the two different modes without - // changing the interface for all input devices - prefs->Flush(); - } - - if(it.key()->isChecked()) - { - result &= inputdevice->CreateInputDevice()->RegisterInputDevice(); - } - else - { - result &= inputdevice->CreateInputDevice()->UnRegisterInputDevice(); - - // temporary fix, unclean solution: - // e.g. user activates SpaceNavigator and leaves the - // the wiimote deactivated, the user will get the warning - // despite the fact that it has never been activated - if(it.value() == mitk::CoreExtConstants::WIIMOTE_XMLATTRIBUTE_NAME) - { - // until now 2010-09-06 there were some unfixed problems - // with reconnecting the wiimote after disconnecting it. - // It was suggested that it might have something to do - // with the type of stack, that is used for the pairing. - // MS-Stack for example does not work properly. - QMessageBox::information(nullptr,"WiiMote supportproblem", - "A reconnect of the WiiMote is not yet supported! " - "Please restart the application, if you want to " - "activate the Wii remote/s again."); - } - } - - if(result) - { - prefs->PutBool(it.value().toStdString(), it.key()->isChecked()); - } - } - return result; -} - -void QmitkInputDevicesPrefPage::PerformCancel() -{ - -} - -void QmitkInputDevicesPrefPage::Update() -{ - auto* prefs = GetPreferences(); - QHashIterator it(m_InputDevices); - - while (it.hasNext()) - { - it.next(); - it.key()->setChecked(prefs->GetBool(it.value().toStdString(), false)); - if(it.value() == mitk::CoreExtConstants::WIIMOTE_XMLATTRIBUTE_NAME) - { - m_WiiMoteHeadTracking->setChecked( - prefs->GetBool(mitk::CoreExtConstants::WIIMOTE_HEADTRACKING.toStdString(), false)); - m_WiiMoteSurfaceInteraction->setChecked - (prefs->GetBool(mitk::CoreExtConstants::WIIMOTE_SURFACEINTERACTION.toStdString(), false)); - } - } -} - -mitk::IInputDeviceRegistry *QmitkInputDevicesPrefPage::GetInputDeviceRegistry() const -{ - ctkServiceReference serviceRef = QmitkCommonExtPlugin::getContext()->getServiceReference(); - if (!serviceRef) return nullptr; - - return QmitkCommonExtPlugin::getContext()->getService(serviceRef); -} diff --git a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkInputDevicesPrefPage.h b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkInputDevicesPrefPage.h deleted file mode 100644 index 0f1b91d115..0000000000 --- a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkInputDevicesPrefPage.h +++ /dev/null @@ -1,87 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - - -#ifndef QmitkInputDevicesPrefPage_h -#define QmitkInputDevicesPrefPage_h - -#include "berryIQtPreferencePage.h" - -#include -#include -#include - -class QWidget; -class QCheckBox; - -namespace mitk { -struct IInputDeviceRegistry; -} - -class QmitkInputDevicesPrefPage : public QObject, public berry::IQtPreferencePage -{ - Q_OBJECT - Q_INTERFACES(berry::IPreferencePage) - -public: - - /** - * Default constructor - */ - QmitkInputDevicesPrefPage(); - - /** - * @see berry::IPreferencePage::Init(berry::IWorkbench::Pointer workbench) - */ - void Init(berry::IWorkbench::Pointer workbench) override; - - /** - * @see berry::IPreferencePage::CreateQtControl(void* parent) - */ - void CreateQtControl(QWidget* widget) override; - - /** - * @see berry::IPreferencePage::CreateQtControl() - */ - QWidget* GetQtControl() const override; - - /** - * @see berry::IPreferencePage::PerformOk() - */ - bool PerformOk() override; - - /** - * @see berry::IPreferencePage::PerformCancel() - */ - void PerformCancel() override; - - /** - * @see berry::IPreferencePage::Update() - */ - void Update() override; - -protected: - - QWidget* m_MainControl; - - QHash m_InputDevices; - - // specific for Wiimote - QGroupBox* m_WiiMoteModes; - QRadioButton* m_WiiMoteHeadTracking; - QRadioButton* m_WiiMoteSurfaceInteraction; - - mitk::IInputDeviceRegistry* GetInputDeviceRegistry() const; - -}; - -#endif