diff --git a/Examples/Plugins/PluginList.cmake b/Examples/Plugins/PluginList.cmake
index a5d1494e10..5cc18b92e2 100644
--- a/Examples/Plugins/PluginList.cmake
+++ b/Examples/Plugins/PluginList.cmake
@@ -1,26 +1,26 @@
# Plug-ins must be ordered according to their dependencies
set(MITK_EXAMPLE_PLUGINS
org.mitk.example.gui.minimalapplication:ON
org.mitk.example.gui.customviewer:ON
org.mitk.example.gui.customviewer.views:ON
org.mitk.example.gui.multipleperspectives:ON
org.mitk.example.gui.selectionserviceqt:ON
org.mitk.example.gui.selectionservicemitk:ON
org.mitk.example.gui.selectionservicemitk.views:ON
org.mitk.example.gui.extensionpointdefinition:ON
org.mitk.example.gui.extensionpointcontribution:ON
org.mitk.example.gui.regiongrowing:ON
org.mitk.example.gui.qmlapplication:ON
-
+ org.mitk.example.gui.pcaexample:ON
org.mitk.example.gui.imaging:ON
)
if(MITK_USE_OpenCV)
list(APPEND MITK_EXAMPLE_PLUGINS
org.mitk.example.gui.opencv:ON)
else()
list(APPEND MITK_EXAMPLE_PLUGINS
org.mitk.example.gui.opencv:OFF)
endif()
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/CMakeLists.txt b/Examples/Plugins/org.mitk.example.gui.pcaexample/CMakeLists.txt
new file mode 100644
index 0000000000..413b21feed
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/CMakeLists.txt
@@ -0,0 +1,7 @@
+project(org_mitk_example_gui_pcaexample)
+
+mitk_create_plugin(
+ EXPORT_DIRECTIVE PCAEXAMPLE_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDS MitkQtWidgetsExt
+)
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/Manual.dox b/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/Manual.dox
new file mode 100644
index 0000000000..e754d42a76
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/Manual.dox
@@ -0,0 +1,17 @@
+/**
+\page org_mitk_example_gui_pcaexample The Pcaexample
+
+\imageMacro{icon.png,"Icon of Pcaexample",2.00}
+
+\tableofcontents
+
+\section org_mitk_example_gui_pcaexampleOverview Overview
+Describe the features of your awesome plugin here
+
+- Increases productivity
+
- Creates beautiful images
+
- Generates PhD thesis
+
- Brings world peace
+
+
+*/
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/icon.xpm b/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/icon.xpm
new file mode 100644
index 0000000000..9057c20bc6
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/icon.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static const char * icon_xpm[] = {
+"16 16 2 1",
+" c #FF0000",
+". c #000000",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/doxygen/modules.dox b/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..244d3df107
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_mitk_example_gui_pcaexample org.mitk.example.gui.pcaexample
+ \ingroup MITKPlugins
+
+ \brief Describe your plugin here.
+
+*/
+
+/**
+ \defgroup org_mitk_example_gui_pcaexample_internal Internal
+ \ingroup org_mitk_example_gui_pcaexample
+
+ \brief This subcategory includes the internal classes of the org.mitk.example.gui.pcaexample 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/Examples/Plugins/org.mitk.example.gui.pcaexample/files.cmake b/Examples/Plugins/org.mitk.example.gui.pcaexample/files.cmake
new file mode 100644
index 0000000000..3a72da1a47
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/files.cmake
@@ -0,0 +1,42 @@
+set(SRC_CPP_FILES
+
+)
+
+set(INTERNAL_CPP_FILES
+ org_mitk_example_gui_pcaexample_Activator.cpp
+ PCAExample.cpp
+)
+
+set(UI_FILES
+ src/internal/PCAExampleControls.ui
+)
+
+set(MOC_H_FILES
+ src/internal/org_mitk_example_gui_pcaexample_Activator.h
+ src/internal/PCAExample.h
+)
+
+# 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
+set(CACHED_RESOURCE_FILES
+ resources/icon.xpm
+ plugin.xml
+)
+
+# list of Qt .qrc files which contain additional resources
+# specific to this plugin
+set(QRC_FILES
+
+)
+
+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/Examples/Plugins/org.mitk.example.gui.pcaexample/manifest_headers.cmake b/Examples/Plugins/org.mitk.example.gui.pcaexample/manifest_headers.cmake
new file mode 100644
index 0000000000..f37383eaa4
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "Pcaexample")
+set(Plugin-Version "0.1")
+set(Plugin-Vendor "DKFZ")
+set(Plugin-ContactAddress "")
+set(Require-Plugin org.mitk.gui.qt.common)
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/plugin.xml b/Examples/Plugins/org.mitk.example.gui.pcaexample/plugin.xml
new file mode 100644
index 0000000000..8a6998e8a6
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/plugin.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/resources/icon.xpm b/Examples/Plugins/org.mitk.example.gui.pcaexample/resources/icon.xpm
new file mode 100644
index 0000000000..04cb367f0b
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/resources/icon.xpm
@@ -0,0 +1,69 @@
+/* XPM */
+static char * icon_xpm[] = {
+"64 64 2 1",
+" c None",
+". c #000000",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" .... ",
+" ............. .......... ...... ",
+" .............. ............ ...... ",
+" ............... .............. ...... ",
+" ................ ...... ....... ........ ",
+" ..... ..... ...... ...... ........ ",
+" ..... ...... ..... ..... ........ ",
+" ..... ..... ..... ..... ......... ",
+" ..... ..... ..... ..... .......... ",
+" ..... ..... ..... .... ..... ",
+" ..... ..... ..... .... .... ",
+" ..... ...... ..... ..... .... ",
+" ..... ..... ..... ..... ..... ",
+" ................ ..... .... ..... ",
+" ............... ..... .... .... ",
+" .............. ..... ..... .... ",
+" ............. ..... ..... ..... ",
+" .......... ..... .............. ",
+" ..... ..... .............. ",
+" ..... ..... ..... ................ ",
+" ..... ..... ..... ................ ",
+" ..... ..... ..... ..... ..... ",
+" ..... ...... ...... ..... ..... ",
+" ..... .............. ..... ..... ",
+" ..... .............. ..... ..... ",
+" ..... ............ ..... ..... ",
+" ..... ........ ..... ..... ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" .. .. ",
+" . . ",
+" .. .. ... .... ",
+" .. .. .... ..... ",
+" .. .. .. . .. .. ",
+" .. .. ..... .. .. ",
+" .. .. .. .. .. ",
+" .. .. .. . . ..... . ",
+" . . .... .. ..... .. ",
+" .. .. . ",
+" .... ",
+" .. ",
+" ",
+" ",
+" ",
+" "};
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/PCAExample.cpp b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/PCAExample.cpp
new file mode 100644
index 0000000000..a4a939d8dc
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/PCAExample.cpp
@@ -0,0 +1,167 @@
+/*===================================================================
+
+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.
+
+===================================================================*/
+
+
+// Blueberry
+#include
+#include
+
+// Qmitk
+#include "PCAExample.h"
+
+// Qt
+#include
+
+// mitk image
+#include
+
+const std::string PCAExample::VIEW_ID = "org.mitk.views.pcaexample";
+
+void PCAExample::SetFocus()
+{
+ m_Controls.buttonPerformImageProcessing->setFocus();
+}
+
+void PCAExample::CreateQtPartControl(QWidget *parent)
+{
+ // create GUI widgets from the Qt Designer's .ui file
+ m_Controls.setupUi(parent);
+ connect(m_Controls.buttonPerformImageProcessing, SIGNAL(clicked()), this, SLOT(BtnPerfomPCAClicked()));
+
+ //initialize point set widget and point set node
+ mitk::DataNode::Pointer PointSetNode = mitk::DataNode::New();
+ PointSetNode->SetName("PCA Example Pointset");
+ mitk::PointSet::Pointer newPtSet = mitk::PointSet::New();
+ PointSetNode->SetData(newPtSet);
+ m_Controls.m_pointSetWidget->SetPointSetNode(PointSetNode);
+ this->GetDataStorage()->Add(PointSetNode);
+}
+
+PCAExample::PCAExample()
+{
+
+}
+
+PCAExample::~PCAExample()
+{
+ //clean up
+ mitk::DataNode::Pointer ptSetNode = m_Controls.m_pointSetWidget->GetPointSetNode();
+ m_Controls.m_pointSetWidget->SetPointSetNode(NULL);
+ this->GetDataStorage()->Remove(ptSetNode);
+ this->GetDataStorage()->Remove(m_Axis1Node);
+ this->GetDataStorage()->Remove(m_Axis2Node);
+ this->GetDataStorage()->Remove(m_Axis3Node);
+}
+
+void PCAExample::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*source*/,
+ const QList &nodes)
+{
+ // iterate all selected objects, adjust warning visibility
+ foreach (mitk::DataNode::Pointer node, nodes)
+ {
+ if (node.IsNotNull() && dynamic_cast(node->GetData()))
+ {
+ m_Controls.buttonPerformImageProcessing->setEnabled(true);
+ return;
+ }
+ }
+
+}
+
+void PCAExample::BtnPerfomPCAClicked()
+{
+ std::vector eigenVectors;
+ std::vector eigenValues;
+ mitk::Vector3D mean;
+ bool success = comutePCA(m_Controls.m_pointSetWidget->GetPointSet(), eigenVectors, eigenValues, mean);
+ this->showEigenvectors(eigenVectors, eigenValues, mean);
+ MITK_INFO << "PCA: " << success;
+}
+
+bool PCAExample::comutePCA(mitk::PointSet::Pointer input, std::vector &eigenVectors, std::vector &eigenValues, mitk::Vector3D &pointsMean)
+{
+//Step 1: Construct data matrix
+vnl_matrix dataMatrix(3, input->GetSize(), 0.0);
+int size = input->GetSize();
+for (int i=0; iGetPoint(i)[0];
+ dataMatrix[1][i] = input->GetPoint(i)[1];
+ dataMatrix[2][i] = input->GetPoint(i)[2];
+}
+
+//Step 2: Remove average for each row (Mittelwertbefreiung)
+mitk::Vector3D mean;
+for (int i = 0; i < size; i++) { mean += mitk::Vector3D(dataMatrix.get_column(i)); }
+mean /= size;
+for (int i = 0; i covMatrix = (1.0 / (size - 1.0)) * dataMatrix * dataMatrix.transpose();
+
+//Step 4: Singular value composition
+vnl_svd svd(covMatrix);
+
+//Store results and print them to the console
+MITK_INFO << "DataMatrix: " << "\n" << dataMatrix;
+MITK_INFO << "CovMatrix: " << "\n" << covMatrix;
+for (int i = 0; i < 3; i++)
+{
+ eigenVectors.push_back(svd.U().get_column(i));
+ eigenValues.push_back(sqrt(svd.W(i)));
+ MITK_INFO << "Eigenvector " << i << ": " << eigenVectors.at(i);
+ MITK_INFO << "Eigenvalue " << i << ": " << eigenValues.at(i);
+}
+
+//Compute center of points
+for (int i = 0; i < size; i++) { pointsMean += input->GetPoint(i).GetVectorFromOrigin(); }
+pointsMean /= size;
+
+return true;
+}
+
+void PCAExample::showEigenvectors(std::vector eigenVectors, std::vector eigenValues, mitk::Vector3D center)
+{
+ m_Axis1Node = mitk::DataNode::New();
+ m_Axis1Node->SetName("Eigenvector 1");
+ mitk::PointSet::Pointer axis1 = mitk::PointSet::New();
+ axis1->InsertPoint(0, center);
+ axis1->InsertPoint(1, (center + eigenVectors.at(0)*eigenValues.at(0)));
+ m_Axis1Node->SetData(axis1);
+ m_Axis1Node->SetBoolProperty("show contour", true);
+ m_Axis1Node->SetColor(1, 0, 0);
+ this->GetDataStorage()->Add(m_Axis1Node);
+
+ m_Axis2Node = mitk::DataNode::New();
+ m_Axis2Node->SetName("Eigenvector 2");
+ mitk::PointSet::Pointer axis2 = mitk::PointSet::New();
+ axis2->InsertPoint(0, center);
+ axis2->InsertPoint(1, (center + eigenVectors.at(1)*eigenValues.at(1)));
+ m_Axis2Node->SetData(axis2);
+ m_Axis2Node->SetBoolProperty("show contour", true);
+ m_Axis2Node->SetColor(1, 0, 0);
+ this->GetDataStorage()->Add(m_Axis2Node);
+
+ m_Axis3Node = mitk::DataNode::New();
+ m_Axis3Node->SetName("Eigenvector 3");
+ mitk::PointSet::Pointer axis3 = mitk::PointSet::New();
+ axis3->InsertPoint(0, center);
+ axis3->InsertPoint(1, (center + eigenVectors.at(2)*eigenValues.at(2)));
+ m_Axis3Node->SetData(axis3);
+ m_Axis3Node->SetBoolProperty("show contour", true);
+ m_Axis3Node->SetColor(1, 0, 0);
+ this->GetDataStorage()->Add(m_Axis3Node);
+}
\ No newline at end of file
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/PCAExample.h b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/PCAExample.h
new file mode 100644
index 0000000000..0f43ea36e6
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/PCAExample.h
@@ -0,0 +1,84 @@
+/*===================================================================
+
+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 PCAExample_h
+#define PCAExample_h
+
+#include
+
+#include
+
+#include "ui_PCAExampleControls.h"
+
+/**
+ \brief PCAExample
+
+ \warning This class is not yet documented. Use "git blame" and ask the author to provide basic documentation.
+
+ \sa QmitkAbstractView
+ \ingroup ${plugin_target}_internal
+*/
+class PCAExample : public QmitkAbstractView
+{
+ // this is needed for all Qt objects that should have a Qt meta-object
+ // (everything that derives from QObject and wants to have signal/slots)
+ Q_OBJECT
+
+public:
+ static const std::string VIEW_ID;
+
+ PCAExample();
+
+ virtual ~PCAExample();
+
+protected slots:
+
+ /// \brief Called when the user clicks the GUI button
+ void BtnPerfomPCAClicked();
+
+protected:
+ virtual void CreateQtPartControl(QWidget *parent) override;
+
+ virtual void SetFocus() override;
+
+ /// \brief called by QmitkFunctionality when DataManager's selection has changed
+ virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer source,
+ const QList &nodes) override;
+
+ /** Performs a PCA on a (3D) point set.
+ * @param input Point set to work on.
+ * @param[out] eigenVectors Eigenvectors as computed by the PCA. Returns an empty vector
+ * if PCA failed or did not run before.
+ * @param[out] eigenValues Eigenvalues as computed by the PCA. Returns an empty vector
+ * if PCA failed or did not run before. The ID inside the vector
+ * corresponds to the ID inside the eigenvector vector. For a 3D
+ * pointset 3 eigenvalues and -vectors will be computed.
+ * @param[out] pointsMean Returns the mean/center of the pointset
+ */
+ bool comutePCA(mitk::PointSet::Pointer input, std::vector &eigenVectors, std::vector &eigenValues, mitk::Vector3D &pointsMean);
+
+ /** Adds mitk data nodes for all eigenvectors to visualize them in the multi widget. */
+ void showEigenvectors(std::vector eigenVectors, std::vector eigenValues, mitk::Vector3D center);
+
+ mitk::DataNode::Pointer m_Axis1Node;
+ mitk::DataNode::Pointer m_Axis2Node;
+ mitk::DataNode::Pointer m_Axis3Node;
+
+ Ui::PCAExampleControls m_Controls;
+};
+
+#endif // PCAExample_h
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/PCAExampleControls.ui b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/PCAExampleControls.ui
new file mode 100644
index 0000000000..a9daab997d
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/PCAExampleControls.ui
@@ -0,0 +1,72 @@
+
+
+ PCAExampleControls
+
+
+
+ 0
+ 0
+ 222
+ 688
+
+
+
+
+ 0
+ 0
+
+
+
+ QmitkTemplate
+
+
+ -
+
+
+
+ 0
+ 250
+
+
+
+
+ -
+
+
+ Do image processing
+
+
+ Perform PCA
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Expanding
+
+
+
+ 20
+ 220
+
+
+
+
+
+
+
+
+
+ QmitkPointListWidget
+ QWidget
+
+ 1
+
+
+
+
+
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/org_mitk_example_gui_pcaexample_Activator.cpp b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/org_mitk_example_gui_pcaexample_Activator.cpp
new file mode 100644
index 0000000000..76e75338e1
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/org_mitk_example_gui_pcaexample_Activator.cpp
@@ -0,0 +1,29 @@
+/*===================================================================
+
+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 "org_mitk_example_gui_pcaexample_Activator.h"
+#include "PCAExample.h"
+
+namespace mitk
+{
+ void org_mitk_example_gui_pcaexample_Activator::start(ctkPluginContext *context)
+ {
+ BERRY_REGISTER_EXTENSION_CLASS(PCAExample, context)
+ }
+
+ void org_mitk_example_gui_pcaexample_Activator::stop(ctkPluginContext *context) { Q_UNUSED(context) }
+}
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/org_mitk_example_gui_pcaexample_Activator.h b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/org_mitk_example_gui_pcaexample_Activator.h
new file mode 100644
index 0000000000..d80ec16e35
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.pcaexample/src/internal/org_mitk_example_gui_pcaexample_Activator.h
@@ -0,0 +1,38 @@
+/*===================================================================
+
+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 org_mitk_example_gui_pcaexample_Activator_h
+#define org_mitk_example_gui_pcaexample_Activator_h
+
+#include
+
+namespace mitk
+{
+ class org_mitk_example_gui_pcaexample_Activator : public QObject, public ctkPluginActivator
+ {
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org_mitk_example_gui_pcaexample")
+ Q_INTERFACES(ctkPluginActivator)
+
+ public:
+ void start(ctkPluginContext *context);
+ void stop(ctkPluginContext *context);
+
+ }; // org_mitk_example_gui_pcaexample_Activator
+}
+
+#endif // org_mitk_example_gui_pcaexample_Activator_h