diff --git a/Plugins/PluginList.cmake b/Plugins/PluginList.cmake index 1cf526d180..632a7638bd 100644 --- a/Plugins/PluginList.cmake +++ b/Plugins/PluginList.cmake @@ -1,43 +1,44 @@ # Plug-ins must be ordered according to their dependencies set(MITK_EXT_PLUGINS 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.diffusionimaging:OFF org.mitk.gui.qt.application:ON org.mitk.gui.qt.coreapplication:OFF org.mitk.gui.qt.ext:OFF org.mitk.gui.qt.extapplication:OFF org.mitk.gui.qt.common:ON org.mitk.gui.qt.stdmultiwidgeteditor:ON org.mitk.gui.qt.common.legacy:OFF org.mitk.gui.qt.diffusionimagingapp:OFF org.mitk.gui.qt.datamanager:ON org.mitk.gui.qt.basicimageprocessing:OFF org.mitk.gui.qt.dicom:OFF org.mitk.gui.qt.diffusionimaging:OFF org.mitk.gui.qt.dtiatlasapp:OFF org.mitk.gui.qt.examples:OFF org.mitk.gui.qt.examplesopencv:OFF org.mitk.gui.qt.igtexamples:OFF org.mitk.gui.qt.igttracking:OFF org.mitk.gui.qt.imagecropper:OFF org.mitk.gui.qt.imagenavigator:ON org.mitk.gui.qt.materialeditor:OFF org.mitk.gui.qt.measurementtoolbox:OFF org.mitk.gui.qt.meshdecimation:OFF org.mitk.gui.qt.moviemaker:OFF org.mitk.gui.qt.pointsetinteraction:OFF + org.mitk.gui.qt.python:OFF org.mitk.gui.qt.python.console:OFF org.mitk.gui.qt.registration:OFF org.mitk.gui.qt.segmentation:OFF org.mitk.gui.qt.toftutorial:OFF org.mitk.gui.qt.tofutil:OFF org.mitk.gui.qt.ugvisualization:OFF org.mitk.gui.qt.ultrasound:OFF org.mitk.gui.qt.volumevisualization:OFF ) diff --git a/Plugins/org.mitk.gui.qt.python/CMakeLists.txt b/Plugins/org.mitk.gui.qt.python/CMakeLists.txt new file mode 100644 index 0000000000..1790b048bf --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/CMakeLists.txt @@ -0,0 +1,6 @@ +project(org_mitk_gui_qt_python) + +MACRO_CREATE_MITK_CTK_PLUGIN( + EXPORT_DIRECTIVE org_mitk_gui_qt_python_EXPORT + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDENCIES QmitkExt CTK) diff --git a/Plugins/org.mitk.gui.qt.python/documentation/UserManual/QmitkDatamanagerLight.dox b/Plugins/org.mitk.gui.qt.python/documentation/UserManual/QmitkDatamanagerLight.dox new file mode 100644 index 0000000000..8d95aeb632 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/documentation/UserManual/QmitkDatamanagerLight.dox @@ -0,0 +1,108 @@ +/** + +\page org_mitk_views_datamanager The DataManager + +\image html DataManager_48.png "Icon of the Module" + +\section QmitkDataManagerIntroduction Introduction + +The Datamanager is the central componenent to manage medical data like images, surfaces, etc.. +After loading one or more data into the Datamanager the data are shown in the four-view window, the so called Standard View. +The user can now start working on the data by just clicking into the standard view or by using the MITK-modules such as "Segmentation" or "Basic Image Processing". + +Available sections: + - \ref QmitkDataManagerIntroduction + - \ref QmitkDataManagerLoading + - \ref QmitkDataManagerSaving + - \ref QmitkDataManagerProperties + - \ref QmitkDataManagerPropertiesList + - \ref QmitkDataManagerPropertiesVisibility + - \ref QmitkDataManagerPropertiesRepresentation + - \ref QmitkDataManagerPropertiesPreferences + - \ref QmitkDataManagerPropertyList + + +\image html Overview.png "How MITK looks when starting" + + +\section QmitkDataManagerLoading Loading Data + +There are three ways of loading data into the Datamanager as so called Data-Elements. + +The user can just drag and drop data into the Datamanager or directly into one of the four parts of the Standard View. +He can as well use the Open-Button in the right upper corner. Or he can use the standard "File->Open"-Dialog on the top. + +A lot of file-formats can be loaded into MITK, for example + + + +The user can also load a series of 2D images (e.g. image001.png, image002.png ...) to a MITK 3D volume. +To do this, just drag and drop one of those 2D data files into the Datamanager by holding the ALT key. + +After loading one or more data into the Datamanager they appear as Data-Elements in a sorted list inside the Datamanager. +Data-Elements can also be sorted hierarchically as a parent-child-relation. +For example after using the Segmentation-Module on Data-Element1 the result is created as Data-Element2, which is a child of Data-Element1 (see Screenshot1). +The order can be changed by drag and drop. + +\image html Parent-Child.png "Screenshot1" + +The listed Data-Elements are shown in the standard view. +Here the user can scale or rotate the medical objects or he can change the cutting planes of the object by just using the mouse inside this view. + +\section QmitkDataManagerSaving Saving Data + +There are two ways of saving data from the Datamanger. The user can either save the whole project with all Data-Elements by clicking on "File"->"Save Project" +or he can save single Data-Elements by right-clicking->"Save", directly on a Data-Element. +When saving the whole project, the sorting of Data-Elements is saved as well. By contrast the sorting is lost, when saving a single Data-Element. + +\section QmitkDataManagerProperties Working with the Datamanager + +\subsection QmitkDataManagerPropertiesList List of Data-Elements + +The Data-Elements are listed in the Datamanager. +As described above the elements can be sorted hierarchically as a parent-child-relation. +For example after using the Segmentation-Module on Data-Element1 the result is created as Data-Element2, which is a child of Data-Element1 (see Screenshot1). +By drag and drop the sorting of Data-Elements and their hierarchical relation can be changed. + +\subsection QmitkDataManagerPropertiesVisibility Visibility of Data-Elements + +By default all loaded Data-Elements are visible in the standard view. +The visibility can be changed by right-clicking on the Data-Element and then choosing "Toogle visibility". +The box in front of the Data-Element in the Datamanager shows the visibility. +A green-filled box means a visible Data-Element, an empty box means an invisible Data-Element (see Screenshot1). + +\subsection QmitkDataManagerPropertiesRepresentation Representation of Data-Elements + +There are different types of representations how to show the Data-Element inside the standard view. By right-clicking on the Data-Element all options are listed (see Screenshot2 and Screenshot 3). + + + +\image html Image_properties.png "Screenshot2: Properties for images" +\image html Surface_Properties.png "Screenshot3: Properties for surfaces" + + +\subsection QmitkDataManagerPropertiesPreferences Preferences + +For the datamanager there are already some default hotkeys like the del-key for deleting a Data-Element. The whole list is seen in Screenshot4. +From here the Hotkeys can also be changed. The preference page is found in "Window"->"Preferences". + +\image html Preferences.png "Screenshot4" + +\section QmitkDataManagerPropertyList Property List + +The Property List displays all the properties the currently selected Data-Element has. Which properties these are depends on the Data-Element. Examples are opacity, shader, visibility. These properties can be changed by clicking on the appropriate field in the "value" column. + +\image html PropertyList.png "Screenshot5: Property List" + +*/ diff --git a/Plugins/org.mitk.gui.qt.python/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.python/documentation/doxygen/modules.dox new file mode 100755 index 0000000000..135235454d --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/documentation/doxygen/modules.dox @@ -0,0 +1,16 @@ +/** + \defgroup org_mitk_gui_qt_python org.mitk.gui.qt.python + \ingroup MITKPlugins + + \brief This is the python plugin. It provides means to query mitk::DataStorage objects and to change properties of the contained nodes. + +*/ + +/** + \defgroup org_mitk_gui_qt_python_internal Internal + \ingroup org_mitk_gui_qt_python + + \brief This subcategory includes the internal classes of the org.mitk.gui.qt.python 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.gui.qt.python/files.cmake b/Plugins/org.mitk.gui.qt.python/files.cmake new file mode 100644 index 0000000000..eb74829c26 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/files.cmake @@ -0,0 +1,33 @@ +set(SRC_CPP_FILES +) + +set(INTERNAL_CPP_FILES + mitkPluginActivator.cpp + QmitkPythonView.cpp + QmitkCtkPythonShell.cpp +) + +set(MOC_H_FILES + src/internal/QmitkPythonView.h + src/internal/QmitkCtkPythonShell.h + src/internal/mitkPluginActivator.h +) + +set(CPP_FILES ) + +set(CACHED_RESOURCE_FILES + plugin.xml + resources/Python.png +) + +set(QRC_FILES + resources/Python.qrc +) + +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.python/manifest_headers.cmake b/Plugins/org.mitk.gui.qt.python/manifest_headers.cmake new file mode 100644 index 0000000000..a083a5b4a6 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/manifest_headers.cmake @@ -0,0 +1,5 @@ +set(Plugin-Name "MITK Python") +set(Plugin-Version "1.0.0") +set(Plugin-Vendor "DKFZ, Medical and Biological Informatics") +set(Plugin-ContactAddress "http://www.mitk.org") +set(Require-Plugin org.mitk.gui.qt.common) diff --git a/Plugins/org.mitk.gui.qt.python/plugin.xml b/Plugins/org.mitk.gui.qt.python/plugin.xml new file mode 100644 index 0000000000..c69d1a6080 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/plugin.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/Plugins/org.mitk.gui.qt.python/resources/Python.png b/Plugins/org.mitk.gui.qt.python/resources/Python.png new file mode 100644 index 0000000000..93e4a02c3d Binary files /dev/null and b/Plugins/org.mitk.gui.qt.python/resources/Python.png differ diff --git a/Plugins/org.mitk.gui.qt.python/resources/Python.qrc b/Plugins/org.mitk.gui.qt.python/resources/Python.qrc new file mode 100644 index 0000000000..5b36d01dbf --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/resources/Python.qrc @@ -0,0 +1,5 @@ + + + Python.png + + diff --git a/Plugins/org.mitk.gui.qt.python/src/internal/QmitkCtkPythonShell.cpp b/Plugins/org.mitk.gui.qt.python/src/internal/QmitkCtkPythonShell.cpp new file mode 100644 index 0000000000..7d280792db --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/src/internal/QmitkCtkPythonShell.cpp @@ -0,0 +1,69 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#include "QmitkCtkPythonShell.h" + +#include +#include +#include +#include +#include + +struct QmitkCtkPythonShellData +{ + ctkAbstractPythonManager *m_PythonManager; +}; + +QmitkCtkPythonShell::QmitkCtkPythonShell(QWidget* parent) + : ctkPythonConsole(parent), d( new QmitkCtkPythonShellData ) +{ + d->m_PythonManager = 0; +} + +QmitkCtkPythonShell::~QmitkCtkPythonShell() +{ + delete d; +} + +void QmitkCtkPythonShell::SetPythonManager(ctkAbstractPythonManager *_PythonManager) +{ + d->m_PythonManager = _PythonManager; + this->initialize( _PythonManager ); +} + +void QmitkCtkPythonShell::dragEnterEvent(QDragEnterEvent *event) +{ + event->accept(); +} +void QmitkCtkPythonShell::dropEvent(QDropEvent *event) +{ + QList urls = event->mimeData()->urls(); + for(int i = 0; i < urls.size(); i++) + { + d->m_PythonManager->executeString(urls[i].toString()); + } +} + +bool QmitkCtkPythonShell::canInsertFromMimeData( const QMimeData *source ) const +{ + return true; +} + +void QmitkCtkPythonShell::executeCommand(const QString& command) +{ + emit executeCommandSignal(command); + ctkPythonConsole::executeCommand(command); +} diff --git a/Plugins/org.mitk.gui.qt.python/src/internal/QmitkCtkPythonShell.h b/Plugins/org.mitk.gui.qt.python/src/internal/QmitkCtkPythonShell.h new file mode 100644 index 0000000000..8333b5ea0f --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/src/internal/QmitkCtkPythonShell.h @@ -0,0 +1,62 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#ifndef QmitkCtkPythonShell_h +#define QmitkCtkPythonShell_h + +#include +#include + +/// +/// forward declarations +/// +struct QmitkCtkPythonShellData; +class ctkAbstractPythonManager; +class QDragEnterEvent; +class QDropEvent; +class QMimeData; + +/// +/// Reimplements the ctkPythonConsole with drag and drop functionality for text +/// +class QmitkCtkPythonShell : public ctkPythonConsole +{ + Q_OBJECT + +public: + QmitkCtkPythonShell(QWidget* parent = 0); + ~QmitkCtkPythonShell(); + + void SetPythonManager( ctkAbstractPythonManager* _PythonManager ); + +protected: + void dragEnterEvent(QDragEnterEvent *event); + void dropEvent(QDropEvent *event); + bool canInsertFromMimeData( const QMimeData *source ) const; + void executeCommand(const QString& command); + +signals: + void executeCommandSignal(const QString&); + +private: + QmitkCtkPythonShellData* d; +}; + + + + +#endif // QmitkCtkPythonShell_h + diff --git a/Plugins/org.mitk.gui.qt.python/src/internal/QmitkPythonView.cpp b/Plugins/org.mitk.gui.qt.python/src/internal/QmitkPythonView.cpp new file mode 100644 index 0000000000..c2df3a7d65 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/src/internal/QmitkPythonView.cpp @@ -0,0 +1,54 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#include "QmitkPythonView.h" +#include +#include "QmitkCtkPythonShell.h" +#include "mitkPluginActivator.h" + +const std::string QmitkPythonView::VIEW_ID = "org.mitk.views.python"; + +struct QmitkPythonViewData +{ + // widget + QmitkCtkPythonShell* m_PythonShell; +}; + +QmitkPythonView::QmitkPythonView() + : d( new QmitkPythonViewData ) +{ + d->m_PythonShell = 0; +} + +QmitkPythonView::~QmitkPythonView() +{ + delete d; +} + +void QmitkPythonView::CreateQtPartControl(QWidget* parent) +{ + d->m_PythonShell = new QmitkCtkPythonShell; + d->m_PythonShell->SetPythonManager( mitk::PluginActivator::GetPythonManager() ); + + QGridLayout* layout = new QGridLayout; + layout->addWidget( d->m_PythonShell, 0, 0 ); + parent->setLayout(layout); +} + +void QmitkPythonView::SetFocus() +{ + d->m_PythonShell->setFocus(); +} diff --git a/Plugins/org.mitk.gui.qt.python/src/internal/QmitkPythonView.h b/Plugins/org.mitk.gui.qt.python/src/internal/QmitkPythonView.h new file mode 100644 index 0000000000..41b4bee47a --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/src/internal/QmitkPythonView.h @@ -0,0 +1,64 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#ifndef QmitkPythonView_H_ +#define QmitkPythonView_H_ + +/// Qmitk +#include + +/// +/// d pointer forward declaration +/// +struct QmitkPythonViewData; + +/// +/// \brief New python view (CONSOLE) +/// +class QmitkPythonView : public QmitkAbstractView +{ + Q_OBJECT + +public: + + static const std::string VIEW_ID; // = "org.mitk.extapp.defaultperspective" + /// + /// \brief Standard ctor. + /// + QmitkPythonView(); + + /// + /// \brief Standard dtor. + /// + virtual ~QmitkPythonView(); + +protected: + + /// + /// \brief Create the view here. + /// + virtual void CreateQtPartControl(QWidget* parent); + + /// + /// focus on load image + /// + void SetFocus(); + +private: + QmitkPythonViewData* d; +}; + +#endif /*QmitkPythonView_H_*/ diff --git a/Plugins/org.mitk.gui.qt.python/src/internal/mitkPluginActivator.cpp b/Plugins/org.mitk.gui.qt.python/src/internal/mitkPluginActivator.cpp new file mode 100644 index 0000000000..0453f271cf --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/src/internal/mitkPluginActivator.cpp @@ -0,0 +1,42 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ +#include "mitkPluginActivator.h" +#include +#include "QmitkPythonView.h" +#include + +namespace mitk +{ + +void PluginActivator::start(ctkPluginContext* context) +{ + BERRY_REGISTER_EXTENSION_CLASS(QmitkPythonView, context) +} + +void PluginActivator::stop(ctkPluginContext* context) +{ + Q_UNUSED(context) +} + +ctkAbstractPythonManager *PluginActivator::GetPythonManager() +{ + static ctkAbstractPythonManager PythonManager; + return &PythonManager; +} + +} + +Q_EXPORT_PLUGIN2(org_mitk_gui_qt_python, mitk::PluginActivator) diff --git a/Plugins/org.mitk.gui.qt.python/src/internal/mitkPluginActivator.h b/Plugins/org.mitk.gui.qt.python/src/internal/mitkPluginActivator.h new file mode 100644 index 0000000000..e9fa608c85 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.python/src/internal/mitkPluginActivator.h @@ -0,0 +1,41 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ +#ifndef MITKPLUGINACTIVATOR_H +#define MITKPLUGINACTIVATOR_H + +#include +#include +class ctkAbstractPythonManager; + +namespace mitk { + +class MITK_LOCAL PluginActivator : + public QObject, public ctkPluginActivator +{ + Q_OBJECT + Q_INTERFACES(ctkPluginActivator) + +public: + static ctkAbstractPythonManager* GetPythonManager(); + + void start(ctkPluginContext* context); + void stop(ctkPluginContext* context); + +}; // PluginActivator + +} + +#endif // MITKPLUGINACTIVATOR_H