Page MenuHomePhabricator

No OneTemporary

This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
diff --git a/CMakeExternals/CTK.cmake b/CMakeExternals/CTK.cmake
index 859431b560..a17e3e7d05 100644
--- a/CMakeExternals/CTK.cmake
+++ b/CMakeExternals/CTK.cmake
@@ -1,79 +1,81 @@
#-----------------------------------------------------------------------------
# CTK
#-----------------------------------------------------------------------------
if(MITK_USE_CTK)
# Sanity checks
if(DEFINED CTK_DIR AND NOT EXISTS ${CTK_DIR})
message(FATAL_ERROR "CTK_DIR variable is defined but corresponds to non-existing directory")
endif()
set(proj CTK)
set(proj_DEPENDENCIES )
set(CTK_DEPENDS ${proj})
if(NOT DEFINED CTK_DIR)
- set(revision_tag 96bb84d8)
- #IF(${proj}_REVISION_TAG)
- # SET(revision_tag ${${proj}_REVISION_TAG})
- #ENDIF()
+ SET(revision_tag 31d144ecab0c7a8bdc5d8e2ec8b33972ce8e490d)
+ IF(${proj}_REVISION_TAG)
+ SET(revision_tag ${${proj}_REVISION_TAG})
+ ENDIF()
set(ctk_optional_cache_args )
if(MITK_USE_Python)
list(APPEND ctk_optional_cache_args
-DCTK_LIB_Scripting/Python/Widgets:BOOL=ON
)
endif()
if(MITK_USE_DCMTK)
list(APPEND ctk_optional_cache_args
-DDCMTK_DIR:PATH=${DCMTK_DIR}
)
list(APPEND proj_DEPENDENCIES DCMTK)
else()
list(APPEND ctk_optional_cache_args
-DDCMTK_URL:STRING=${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/CTK_DCMTK_085525e6.tar.gz
)
endif()
FOREACH(type RUNTIME ARCHIVE LIBRARY)
IF(DEFINED CTK_PLUGIN_${type}_OUTPUT_DIRECTORY)
LIST(APPEND mitk_optional_cache_args -DCTK_PLUGIN_${type}_OUTPUT_DIRECTORY:PATH=${CTK_PLUGIN_${type}_OUTPUT_DIRECTORY})
ENDIF()
ENDFOREACH()
ExternalProject_Add(${proj}
+ GIT_REPOSITORY http://github.com/Miluba154/CTK.git
+ GIT_TAG ${revision_tag}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}-src
BINARY_DIR ${proj}-build
PREFIX ${proj}-cmake
URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/CTK_${revision_tag}.tar.gz
URL_MD5 e214b632dc876592923d5d8ca77296d5
UPDATE_COMMAND ""
INSTALL_COMMAND ""
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
${ep_common_args}
${ctk_optional_cache_args}
-DDESIRED_QT_VERSION:STRING=4
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
-DGit_EXECUTABLE:FILEPATH=${GIT_EXECUTABLE}
-DGIT_EXECUTABLE:FILEPATH=${GIT_EXECUTABLE}
-DCTK_LIB_PluginFramework:BOOL=ON
-DCTK_LIB_DICOM/Widgets:BOOL=ON
-DCTK_PLUGIN_org.commontk.eventadmin:BOOL=ON
-DCTK_PLUGIN_org.commontk.configadmin:BOOL=ON
-DCTK_USE_GIT_PROTOCOL:BOOL=OFF
-DDCMTK_URL:STRING=${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/CTK_DCMTK_085525e6.tar.gz
DEPENDS ${proj_DEPENDENCIES}
)
set(CTK_DIR ${CMAKE_CURRENT_BINARY_DIR}/${proj}-build)
else()
mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
endif()
endif()
diff --git a/Modules/CMakeLists.txt b/Modules/CMakeLists.txt
index c823f5d4c2..2d8d433859 100644
--- a/Modules/CMakeLists.txt
+++ b/Modules/CMakeLists.txt
@@ -1,54 +1,55 @@
set(LIBPOSTFIX "Ext")
# Modules must be listed according to their dependencies
set(module_dirs
SceneSerializationBase
PlanarFigure
ImageExtraction
ImageStatistics
LegacyAdaptors
IpPicSupport
MitkExt
SceneSerialization
Segmentation
Qmitk
QmitkExt
GraphAlgorithms
DiffusionImaging
GPGPU
IGT
CameraCalibration
IGTUI
RigidRegistration
RigidRegistrationUI
DeformableRegistration
DeformableRegistrationUI
OpenCVVideoSupport
Overlays
InputDevices
ToFHardware
ToFProcessing
ToFUI
+ US
ClippingTools
- US
+ DicomUI
)
set(MITK_DEFAULT_SUBPROJECTS MITK-Modules)
foreach(module_dir ${module_dirs})
add_subdirectory(${module_dir})
endforeach()
if(MITK_PRIVATE_MODULES)
file(GLOB all_subdirs RELATIVE ${MITK_PRIVATE_MODULES} ${MITK_PRIVATE_MODULES}/*)
foreach(subdir ${all_subdirs})
string(FIND ${subdir} "." _result)
if(_result EQUAL -1)
if(EXISTS ${MITK_PRIVATE_MODULES}/${subdir}/CMakeLists.txt)
message(STATUS "Found private module ${subdir}")
add_subdirectory(${MITK_PRIVATE_MODULES}/${subdir} private_modules/${subdir})
endif()
endif()
endforeach()
endif(MITK_PRIVATE_MODULES)
diff --git a/Modules/DicomUI/CMakeLists.txt b/Modules/DicomUI/CMakeLists.txt
new file mode 100644
index 0000000000..c98226da76
--- /dev/null
+++ b/Modules/DicomUI/CMakeLists.txt
@@ -0,0 +1,10 @@
+include_directories(${CTK_INCLUDE_DIRS})
+
+MITK_CREATE_MODULE(mitkDicomUI
+ DEPENDS QmitkExt
+ PACKAGE_DEPENDS CTK
+ QT_MODULE
+ EXPORT_DEFINE MITK_DICOMUI_EXPORT
+ )
+
+# Mitk MitkExt to make linux happy
diff --git a/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.cpp b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.cpp
new file mode 100644
index 0000000000..44e5a1ac28
--- /dev/null
+++ b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.cpp
@@ -0,0 +1,223 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include <mitkStatusBar.h>
+
+// Qmitk
+#include "QmitkDicomExternalDataWidget.h"
+#include <mitklogmacros.h>
+
+// Qt
+#include <QCheckBox>
+#include <QMessageBox>
+#include <QMap>
+#include <QVariant>
+
+// CTK
+#include <ctkDICOMDataset.h>
+
+
+
+const std::string QmitkDicomExternalDataWidget::Widget_ID = "org.mitk.Widgets.QmitkDicomExternalDataWidget";
+
+QmitkDicomExternalDataWidget::QmitkDicomExternalDataWidget(QWidget *parent)
+: m_Controls( 0 )
+, m_DirectoryName(new QString())
+{
+ Initialize();
+ CreateQtPartControl(this);
+}
+
+QmitkDicomExternalDataWidget::~QmitkDicomExternalDataWidget()
+{
+ delete m_ImportDialog;
+ delete m_ExternalDatabase;
+ delete m_ExternalModel;
+ delete m_ExternalIndexer;
+ delete m_Controls;
+ delete m_DirectoryName;
+}
+
+
+void QmitkDicomExternalDataWidget::CreateQtPartControl( QWidget *parent )
+{
+
+ // build up qt Widget, unless already done
+ if ( !m_Controls )
+ {
+ // create GUI widgets from the Qt Designer's .ui file
+ m_Controls = new Ui::QmitkDicomExternalDataWidgetControls;
+ m_Controls->setupUi( parent );
+
+ //
+ m_Controls->ExternalDataTreeView->setSortingEnabled(true);
+ m_Controls->ExternalDataTreeView->setSelectionBehavior(QAbstractItemView::SelectRows);
+ m_Controls->ExternalDataTreeView->setModel(m_ExternalModel);
+
+ //Initialize import widget
+ m_ImportDialog = new ctkFileDialog();
+ QCheckBox* importCheckbox = new QCheckBox("Copy on import", m_ImportDialog);
+ m_ImportDialog->setBottomWidget(importCheckbox);
+ m_ImportDialog->setFileMode(QFileDialog::Directory);
+ m_ImportDialog->setLabelText(QFileDialog::Accept,"Import");
+ m_ImportDialog->setWindowTitle("Import DICOM files from directory ...");
+ m_ImportDialog->setWindowModality(Qt::ApplicationModal);
+ connect(m_ImportDialog, SIGNAL(fileSelected(QString)),this,SLOT(OnFileSelectedAddExternalData(QString)));
+
+ //connect Buttons
+ connect(m_Controls->downloadButton, SIGNAL(clicked()),this,SLOT(OnDownloadButtonClicked()));
+ connect(m_Controls->viewExternalDataButton, SIGNAL(clicked()),this,SLOT(OnViewButtonClicked()));
+ connect(m_Controls->cancelButton, SIGNAL(clicked()),this,SLOT(OnDownloadButtonClicked()));
+
+ connect(m_Controls->SearchOption_2, SIGNAL(parameterChanged()), this, SLOT(OnSearchParameterChanged()));
+ }
+}
+
+void QmitkDicomExternalDataWidget::Initialize()
+{
+ m_ExternalDatabase = new ctkDICOMDatabase();
+ //m_ExternalDatabase->initializeDatabase();
+ try{
+ m_ExternalDatabase->openDatabase(QString(":memory:"),QString( "EXTERNAL-DB"));
+ }catch(std::exception e){
+ MITK_ERROR <<"Database error: "<< m_ExternalDatabase->lastError().toStdString();
+ m_ExternalDatabase->closeDatabase();
+ return;
+ }
+
+ m_ExternalModel = new ctkDICOMModel();
+ m_ExternalModel->setDatabase(m_ExternalDatabase->database());
+ m_ExternalModel->setEndLevel(ctkDICOMModel::SeriesType);
+
+ m_ExternalIndexer = new ctkDICOMIndexer();
+}
+
+void QmitkDicomExternalDataWidget::OnFolderCDImport()
+{
+ m_ImportDialog->show();
+ m_ImportDialog->raise();
+}
+
+void QmitkDicomExternalDataWidget::OnFileSelectedAddExternalData(QString directory)
+{
+ if (QDir(directory).exists())
+ {
+ m_DirectoryName = new QString(directory);
+ QCheckBox* copyOnImport = qobject_cast<QCheckBox*>(m_ImportDialog->bottomWidget());
+
+ if (copyOnImport->isChecked())
+ {
+ //targetDirectory = d->DICOMDatabase->databaseDirectory();
+ MBI_DEBUG<<directory.toStdString();
+ emit SignalAddDicomData(directory);
+ }else{
+ if (m_Watcher.isRunning())
+ {
+ m_Watcher.waitForFinished();
+ }
+ m_Future = QtConcurrent::run(this,(void (QmitkDicomExternalDataWidget::*)(QString)) &QmitkDicomExternalDataWidget::AddDicomTemporary,directory);
+ m_Watcher.setFuture(m_Future);
+
+ emit SignalChangePage(1);
+ }
+ }
+}
+
+void QmitkDicomExternalDataWidget::OnDownloadButtonClicked()
+{
+ QStringList* filePaths= new QStringList();
+ GetFileNamesFromIndex(*filePaths);
+ emit SignalAddDicomData(*filePaths);
+}
+
+void QmitkDicomExternalDataWidget::OnViewButtonClicked()
+{
+ QModelIndex currentIndex = m_Controls->ExternalDataTreeView->currentIndex();
+ if(m_ExternalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast<int>(ctkDICOMModel::SeriesType))
+ {
+ QString seriesUID = m_ExternalModel->data(currentIndex,ctkDICOMModel::UIDRole).toString();
+ QString seriesName = m_ExternalModel->data(currentIndex).toString();
+
+ QModelIndex studyIndex = m_ExternalModel->parent(currentIndex);
+ QString studyUID = m_ExternalModel->data(studyIndex,ctkDICOMModel::UIDRole).toString();
+ QString studyName = m_ExternalModel->data(studyIndex).toString();
+
+ QModelIndex patientIndex = m_ExternalModel->parent(studyIndex);
+ QString patientName = m_ExternalModel->data(patientIndex).toString();
+
+ QStringList eventProperties;
+ eventProperties << patientName << studyUID << studyName << seriesUID << seriesName << *m_DirectoryName;
+ MITK_INFO << m_DirectoryName->toStdString();
+
+ emit SignalDicomToDataManager(eventProperties);
+ }
+}
+
+void QmitkDicomExternalDataWidget::OnCancelButtonClicked()
+{
+ m_Watcher.cancel();
+ m_Watcher.waitForFinished();
+}
+
+void QmitkDicomExternalDataWidget::GetFileNamesFromIndex(QStringList& filePaths)
+{
+ QModelIndex currentIndex = m_Controls->ExternalDataTreeView->currentIndex();
+ QString currentUID = m_ExternalModel->data(currentIndex,ctkDICOMModel::UIDRole).toString();
+
+ if(m_ExternalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast<int>(ctkDICOMModel::SeriesType))
+ {
+ filePaths.append(m_ExternalDatabase->filesForSeries(currentUID));
+ }
+ else if(m_ExternalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast<int>(ctkDICOMModel::StudyType))
+ {
+ QStringList seriesList;
+ seriesList.append( m_ExternalDatabase->seriesForStudy(currentUID) );
+
+ QStringList::Iterator serieIt;
+ for(serieIt=seriesList.begin();serieIt!=seriesList.end();++serieIt)
+ {
+ filePaths.append(m_ExternalDatabase->filesForSeries(*serieIt));
+ }
+ }
+ else if(m_ExternalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast<int>(ctkDICOMModel::PatientType))
+ {
+ QStringList studiesList,seriesList;
+ studiesList.append( m_ExternalDatabase->studiesForPatient(currentUID) );
+
+ QStringList::Iterator studyIt,serieIt;
+ for(studyIt=studiesList.begin();studyIt!=studiesList.end();++studyIt)
+ {
+ seriesList.append( m_ExternalDatabase->seriesForStudy(*studyIt) );
+
+ for(serieIt=seriesList.begin();serieIt!=seriesList.end();++serieIt)
+ {
+ filePaths.append(m_ExternalDatabase->filesForSeries(*serieIt));
+ }
+ }
+ }
+}
+
+void QmitkDicomExternalDataWidget::AddDicomTemporary(QString directory)
+{
+ m_ExternalIndexer->addDirectory(*m_ExternalDatabase,directory);
+ m_ExternalModel->reset();
+}
+
+void QmitkDicomExternalDataWidget::OnSearchParameterChanged()
+{
+ m_ExternalModel->setDatabase(m_ExternalDatabase->database(),m_Controls->SearchOption_2->parameters());
+}
\ No newline at end of file
diff --git a/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.h b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.h
new file mode 100644
index 0000000000..cb71e277a4
--- /dev/null
+++ b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.h
@@ -0,0 +1,123 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef QmitkDicomExternalDataWidget_h
+#define QmitkDicomExternalDataWidget_h
+
+// #include <QmitkFunctionality.h>
+#include "ui_QmitkDicomExternalDataWidgetControls.h"
+#include "mitkDicomUIExports.h"
+
+// include ctk
+#include <ctkDICOMDatabase.h>
+#include <ctkDICOMModel.h>
+#include <ctkDICOMIndexer.h>
+#include <ctkFileDialog.h>
+
+//include QT
+#include <QWidget>
+#include <QString>
+#include <QStringList>
+#include <QModelIndex>
+//For running dicom import in background
+#include <QtConcurrentRun>
+#include <QFuture>
+#include <QFutureWatcher>
+#include <QTimer>
+
+/*!
+\brief QmitkDicomExternalDataWidget
+
+\warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation.
+
+\sa QmitkFunctionality
+\ingroup Functionalities
+*/
+class MITK_DICOMUI_EXPORT QmitkDicomExternalDataWidget : public QWidget
+{
+ // 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 Widget_ID;
+
+ QmitkDicomExternalDataWidget(QWidget *parent);
+ virtual ~QmitkDicomExternalDataWidget();
+
+ virtual void CreateQtPartControl(QWidget *parent);
+
+ /* @brief Initializes the widget. This method has to be called before widget can start.
+ * @param dataStorage The data storage the widget should work with.
+ * @param multiWidget The corresponding multiwidget were the ct Image is displayed and the user should define his path.
+ * @param imageNode The image node which will be the base of mitral processing
+ */
+ void Initialize();
+
+signals:
+ void SignalChangePage(int);
+ void SignalAddDicomData(const QString&);
+ void SignalAddDicomData(const QStringList&);
+ void SignalDicomToDataManager(const QStringList&);
+
+ public slots:
+
+ /// @brief Called when import CD or import Folder was clicked.
+ void OnFolderCDImport();
+
+ /// @brief Called when import directory was selected.
+ void OnFileSelectedAddExternalData(QString);
+
+ /// @brief Called when download button was clicked.
+ void OnDownloadButtonClicked();
+
+ /// @brief Called when view button was clicked.
+ void OnViewButtonClicked();
+
+ /// @brief Called when cancel button was clicked.
+ void OnCancelButtonClicked();
+
+ /// @brief Called when search parameters change.
+ void OnSearchParameterChanged();
+
+protected:
+
+ /// \brief Get the list of filepath from current selected index in TreeView. All file paths referring to the index will be returned.
+ void GetFileNamesFromIndex(QStringList& filePaths);
+
+ void AddDicomTemporary(QString directory);
+
+ ctkDICOMDatabase* m_ExternalDatabase;
+ ctkDICOMModel* m_ExternalModel;
+ ctkDICOMIndexer* m_ExternalIndexer;
+
+ ctkFileDialog* m_ImportDialog;
+
+ Ui::QmitkDicomExternalDataWidgetControls* m_Controls;
+
+ QFuture<void> m_Future;
+ QFutureWatcher<void> m_Watcher;
+ QTimer* m_Timer;
+ QString* m_DirectoryName;
+
+};
+
+
+
+#endif // _QmitkDicomExternalDataWidget_H_INCLUDED
+
diff --git a/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidgetControls.ui b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidgetControls.ui
new file mode 100644
index 0000000000..b73bcf466d
--- /dev/null
+++ b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidgetControls.ui
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QmitkDicomExternalDataWidgetControls</class>
+ <widget class="QWidget" name="QmitkDicomExternalDataWidgetControls">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>754</width>
+ <height>633</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="externalFilesGroupBox">
+ <property name="title">
+ <string>External Dicom Data</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_10">
+ <item>
+ <widget class="QFrame" name="itemOperationsFrame">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QPushButton" name="viewExternalDataButton">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>View</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="downloadButton">
+ <property name="text">
+ <string>Download</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="QueryLayout_2" stretch="1,0">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>12</number>
+ </property>
+ <property name="rightMargin">
+ <number>12</number>
+ </property>
+ <item>
+ <widget class="QTreeView" name="ExternalDataTreeView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="searchOptionLayout_2">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QDockWidget" name="ExternalSearchDockWidget">
+ <property name="floating">
+ <bool>false</bool>
+ </property>
+ <property name="features">
+ <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
+ </property>
+ <property name="windowTitle">
+ <string/>
+ </property>
+ <widget class="QWidget" name="dockWidgetContents_2">
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <widget class="ctkDICOMQueryWidget" name="SearchOption_2" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <spacer name="VerticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ctkDICOMQueryWidget</class>
+ <extends>QWidget</extends>
+ <header>ctkDICOMQueryWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.cpp b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.cpp
new file mode 100644
index 0000000000..1afdce9051
--- /dev/null
+++ b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.cpp
@@ -0,0 +1,187 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+// Qmitk
+#include "QmitkDicomLocalStorageWidget.h"
+#include <mitklogmacros.h>
+//#include <mitkProgressBar.h>
+// Qt
+#include <QMessageBox>
+#include <QModelIndex>
+#include <QMap>
+#include <QVariant>
+//#include "QmitkDicomDataEventPublisher.h"
+
+
+
+const std::string QmitkDicomLocalStorageWidget::Widget_ID = "org.mitk.Widgets.QmitkDicomLocalStorageWidget";
+
+QmitkDicomLocalStorageWidget::QmitkDicomLocalStorageWidget(QWidget *parent)
+: m_Controls( 0 )
+,m_LocalIndexer(new ctkDICOMIndexer())
+,m_LocalModel(new ctkDICOMModel())
+{
+ CreateQtPartControl(this);
+}
+
+QmitkDicomLocalStorageWidget::~QmitkDicomLocalStorageWidget()
+{
+ m_LocalDatabase->closeDatabase();
+ delete m_LocalDatabase;
+ delete m_LocalIndexer;
+ delete m_LocalModel;
+ delete m_Controls;
+}
+
+void QmitkDicomLocalStorageWidget::CreateQtPartControl( QWidget *parent )
+{
+ if ( !m_Controls )
+ {
+ m_Controls = new Ui::QmitkDicomLocalStorageWidgetControls;
+ m_Controls->setupUi( parent );
+ m_Controls->groupBox->setVisible(false);
+ m_Controls->InternalDataTreeView->setSortingEnabled(true);
+ m_Controls->InternalDataTreeView->setSelectionBehavior(QAbstractItemView::SelectRows);
+ m_Controls->InternalDataTreeView->setModel(m_LocalModel);
+ connect(m_Controls->deleteButton,SIGNAL(clicked()),this,SLOT(OnDeleteButtonClicked()));
+ connect(m_Controls->CancelButton, SIGNAL(clicked()), this , SLOT(OnCancelButtonClicked()));
+ connect(m_Controls->viewInternalDataButton, SIGNAL(clicked()), this , SLOT(OnViewButtonClicked()));
+ connect(m_Controls->SearchOption, SIGNAL(parameterChanged()), this, SLOT(OnSearchParameterChanged()));
+ }
+}
+
+void QmitkDicomLocalStorageWidget::StartDicomImport(const QString& dicomData)
+{
+ if (m_Watcher.isRunning()){
+ m_Watcher.waitForFinished();
+ }
+ m_Future = QtConcurrent::run(this,(void (QmitkDicomLocalStorageWidget::*)(const QString&)) &QmitkDicomLocalStorageWidget::AddDICOMData,dicomData);
+ m_Watcher.setFuture(m_Future);
+}
+
+void QmitkDicomLocalStorageWidget::StartDicomImport(const QStringList& dicomData)
+{
+ if (m_Watcher.isRunning())
+ {
+ m_Watcher.waitForFinished();
+ }
+ m_Future = QtConcurrent::run(this,(void (QmitkDicomLocalStorageWidget::*)(const QStringList&)) &QmitkDicomLocalStorageWidget::AddDICOMData,dicomData);
+ m_Watcher.setFuture(m_Future);
+}
+
+void QmitkDicomLocalStorageWidget::AddDICOMData(const QString& directory)
+{
+ if(m_LocalDatabase->isOpen())
+ {
+ m_LocalIndexer->addDirectory(*m_LocalDatabase,directory,m_LocalDatabase->databaseDirectory());
+ }
+ m_LocalModel->setDatabase(m_LocalDatabase->database());
+ emit FinishedImport(directory);
+}
+
+void QmitkDicomLocalStorageWidget::AddDICOMData(const QStringList& patientFiles)
+{
+ if(m_LocalDatabase->isOpen())
+ {
+ QStringListIterator fileIterator(patientFiles);
+ while(fileIterator.hasNext())
+ {
+ m_LocalIndexer->addFile(*m_LocalDatabase,fileIterator.next(),m_LocalDatabase->databaseDirectory());
+ }
+ }
+ m_LocalModel->setDatabase(m_LocalDatabase->database());
+ emit FinishedImport(patientFiles);
+}
+
+void QmitkDicomLocalStorageWidget::OnDeleteButtonClicked()
+{
+ QModelIndex currentIndex = m_Controls->InternalDataTreeView->currentIndex();
+ QString currentUID = m_LocalModel->data(currentIndex,ctkDICOMModel::UIDRole).toString();
+ if(m_LocalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast<int>(ctkDICOMModel::SeriesType))
+ {
+ m_LocalDatabase->removeSeries(currentUID);
+ }
+ else if(m_LocalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast<int>(ctkDICOMModel::StudyType))
+ {
+ m_LocalDatabase->removeStudy(currentUID);
+ }
+ else if(m_LocalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast<int>(ctkDICOMModel::PatientType))
+ {
+ m_LocalDatabase->removePatient(currentUID);
+ }
+ m_LocalModel->reset();
+}
+
+void QmitkDicomLocalStorageWidget::OnCancelButtonClicked()
+{
+ m_Watcher.cancel();
+ m_Watcher.waitForFinished();
+ m_LocalDatabase->closeDatabase();
+}
+
+void QmitkDicomLocalStorageWidget::OnViewButtonClicked()
+{
+ QModelIndex currentIndex = m_Controls->InternalDataTreeView->currentIndex();
+ if(m_LocalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast<int>(ctkDICOMModel::SeriesType))
+ {
+ QString seriesUID = m_LocalModel->data(currentIndex,ctkDICOMModel::UIDRole).toString();
+ QString seriesName = m_LocalModel->data(currentIndex).toString();
+
+ QModelIndex studyIndex = m_LocalModel->parent(currentIndex);
+ QString studyUID = m_LocalModel->data(studyIndex,ctkDICOMModel::UIDRole).toString();
+ QString studyName = m_LocalModel->data(studyIndex).toString();
+
+ QModelIndex patientIndex = m_LocalModel->parent(studyIndex);
+ QString patientName = m_LocalModel->data(patientIndex).toString();
+
+ QString filePath;
+ filePath.append(m_LocalDatabase->databaseDirectory());
+ filePath.append("/dicom/");
+ filePath.append(studyUID);
+ filePath.append("/");
+ filePath.append(seriesUID);
+ filePath.append("/");
+
+ QStringList eventProperties;
+ eventProperties << patientName << studyUID <<studyName << seriesUID << seriesName << filePath;
+ MITK_INFO << filePath.toStdString();
+ emit SignalDicomToDataManager(eventProperties);
+ }
+}
+
+void QmitkDicomLocalStorageWidget::OnSearchParameterChanged()
+{
+ m_LocalModel->setDatabase(m_LocalDatabase->database(),m_Controls->SearchOption->parameters());
+}
+
+void QmitkDicomLocalStorageWidget::SetDatabaseDirectory(QString newDatatbaseDirectory)
+{
+ QDir databaseDirecory = QDir(newDatatbaseDirectory);
+ if(!databaseDirecory.exists())
+ {
+ databaseDirecory.mkpath(databaseDirecory.absolutePath());
+ }
+ QString newDatatbaseFile = databaseDirecory.absolutePath() + QString("/ctkDICOM.sql");
+ this->SetDatabase(newDatatbaseFile);
+}
+
+void QmitkDicomLocalStorageWidget::SetDatabase(QString databaseFile)
+{
+ m_LocalDatabase = new ctkDICOMDatabase(databaseFile);
+ m_LocalModel->setEndLevel(ctkDICOMModel::SeriesType);
+ m_LocalModel->setDatabase(m_LocalDatabase->database());
+}
\ No newline at end of file
diff --git a/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.h b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.h
new file mode 100644
index 0000000000..6beadeb46e
--- /dev/null
+++ b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.h
@@ -0,0 +1,116 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef QmitkDicomLocalStorageWidget_h
+#define QmitkDicomLocalStorageWidget_h
+
+// #include <QmitkFunctionality.h>
+#include "ui_QmitkDicomLocalStorageWidgetControls.h"
+#include "mitkDicomUIExports.h"
+
+// include ctk
+#include <ctkDICOMDatabase.h>
+#include <ctkDICOMModel.h>
+#include <ctkDICOMIndexer.h>
+#include <ctkFileDialog.h>
+
+//include QT
+#include <QWidget>
+#include <QString>
+#include <QStringList>
+//For running dicom import in background
+#include <QtConcurrentRun>
+#include <QFuture>
+#include <QFutureWatcher>
+#include <QTimer>
+
+#include <mitkStatusBar.h>
+#include <mitkProgressBar.h>
+/*!
+\brief QmitkDicomLocalStorageWidget
+
+\warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation.
+
+\sa QmitkFunctionality
+\ingroup Functionalities
+*/
+class MITK_DICOMUI_EXPORT QmitkDicomLocalStorageWidget : public QWidget
+{
+ // 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 Widget_ID;
+
+ QmitkDicomLocalStorageWidget(QWidget *parent);
+ virtual ~QmitkDicomLocalStorageWidget();
+
+ virtual void CreateQtPartControl(QWidget *parent);
+
+ void SetDatabaseDirectory(QString newDatabaseDirectory);
+
+signals:
+ void FinishedImport(const QString&);
+ void FinishedImport(const QStringList&);
+ void SignalDicomToDataManager(const QStringList&);
+
+ public slots:
+
+ /// @brief Called when cancel button was clicked.
+ void OnViewButtonClicked();
+
+ /// @brief Called when cancel button was clicked.
+ void OnCancelButtonClicked();
+
+ /// @brief Called delete button was clicked.
+ void OnDeleteButtonClicked();
+
+ /// @brief Called when adding a dicom directory. Starts a thread adding the directory.
+ void StartDicomImport(const QString& dicomData);
+
+ /// @brief Called when adding a list of dicom files. Starts a thread adding the dicom files.
+ void StartDicomImport(const QStringList& dicomData);
+
+ /// @brief Called when search parameters change.
+ void OnSearchParameterChanged();
+
+
+protected:
+
+ // adds dicom files from a directory containing dicom files to the local storage.
+ void AddDICOMData(const QString& dicomDirectory);
+
+ // adds dicom files from a string list containing the filepath to the local storage.
+ void AddDICOMData(const QStringList& dicomFiles);
+
+ void SetDatabase(QString databaseFile);
+
+ ctkDICOMDatabase* m_LocalDatabase;
+ ctkDICOMModel* m_LocalModel;
+ ctkDICOMIndexer* m_LocalIndexer;
+ Ui::QmitkDicomLocalStorageWidgetControls* m_Controls;
+
+ QFuture<void> m_Future;
+ QFutureWatcher<void> m_Watcher;
+};
+
+
+
+#endif // _QmitkDicomLocalStorageWidget_H_INCLUDED
+
diff --git a/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidgetControls.ui b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidgetControls.ui
new file mode 100644
index 0000000000..5807cf9ce1
--- /dev/null
+++ b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidgetControls.ui
@@ -0,0 +1,304 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QmitkDicomLocalStorageWidgetControls</class>
+ <widget class="QWidget" name="QmitkDicomLocalStorageWidgetControls">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>754</width>
+ <height>633</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QFrame" name="internalDataFrame">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,3">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Sorting Tags</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QListView" name="listView"/>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="addSortingTagButton">
+ <property name="maximumSize">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>new</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="deleteSortingTagButton">
+ <property name="maximumSize">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>delete</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="localFilesGroupBox">
+ <property name="title">
+ <string>Local Dicom Storage</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_11">
+ <item>
+ <widget class="QFrame" name="frame_2">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QPushButton" name="viewInternalDataButton">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>View</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="deleteButton">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="CancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="QueryLayout" stretch="1,0">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>12</number>
+ </property>
+ <property name="rightMargin">
+ <number>12</number>
+ </property>
+ <item>
+ <widget class="QTreeView" name="InternalDataTreeView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="searchOptionLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QDockWidget" name="InternalSearchDockWidget">
+ <property name="floating">
+ <bool>false</bool>
+ </property>
+ <property name="features">
+ <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
+ </property>
+ <property name="windowTitle">
+ <string/>
+ </property>
+ <widget class="QWidget" name="dockWidgetContents">
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="ctkDICOMQueryWidget" name="SearchOption" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <spacer name="VerticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <property name="leftMargin">
+ <number>18</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="addSortingTagButton_2">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="deleteSortingTagButton_2">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>delete</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ctkDICOMQueryWidget</class>
+ <extends>QWidget</extends>
+ <header>ctkDICOMQueryWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Modules/DicomUI/files.cmake b/Modules/DicomUI/files.cmake
new file mode 100644
index 0000000000..17d06312b7
--- /dev/null
+++ b/Modules/DicomUI/files.cmake
@@ -0,0 +1,17 @@
+
+SET(CPP_FILES ${CPP_FILES}
+ Qmitk/QmitkDicomLocalStorageWidget.cpp
+ Qmitk/QmitkDicomExternalDataWidget.cpp
+)
+
+SET(UI_FILES ${UI_FILES}
+ Qmitk/QmitkDicomLocalStorageWidgetControls.ui
+ Qmitk/QmitkDicomExternalDataWidgetControls.ui
+)
+
+SET(MOC_H_FILES ${MOC_H_FILES}
+ Qmitk/QmitkDicomLocalStorageWidget.h
+ Qmitk/QmitkDicomExternalDataWidget.h
+
+)
+
diff --git a/Modules/Qmitk/QmitkDataStorageTreeModel.cpp b/Modules/Qmitk/QmitkDataStorageTreeModel.cpp
index ba1ea24216..06fc6c42dc 100644
--- a/Modules/Qmitk/QmitkDataStorageTreeModel.cpp
+++ b/Modules/Qmitk/QmitkDataStorageTreeModel.cpp
@@ -1,861 +1,902 @@
/*===================================================================
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 <mitkStringProperty.h>
#include <mitkNodePredicateFirstLevel.h>
#include <mitkNodePredicateAnd.h>
#include <mitkNodePredicateData.h>
#include <mitkNodePredicateNot.h>
#include <mitkNodePredicateOr.h>
#include <mitkNodePredicateProperty.h>
#include <mitkProperties.h>
#include <mitkRenderingManager.h>
#include "QmitkDataStorageTreeModel.h"
#include "QmitkNodeDescriptorManager.h"
#include <QmitkEnums.h>
#include <QmitkCustomVariants.h>
#include <QIcon>
#include <QMimeData>
#include <QTextStream>
#include <map>
QmitkDataStorageTreeModel::QmitkDataStorageTreeModel( mitk::DataStorage* _DataStorage
, bool _PlaceNewNodesOnTop
, bool _ShowHelperObjects
, bool _ShowNodesContainingNoData
, QObject* parent )
: QAbstractItemModel(parent)
, m_DataStorage(0)
, m_PlaceNewNodesOnTop(_PlaceNewNodesOnTop)
, m_ShowHelperObjects(_ShowHelperObjects)
, m_ShowNodesContainingNoData(_ShowNodesContainingNoData)
, m_Root(0)
{
this->UpdateNodeVisibility();
this->SetDataStorage(_DataStorage);
}
QmitkDataStorageTreeModel::~QmitkDataStorageTreeModel()
{
// set data storage to 0 = remove all listeners
this->SetDataStorage(0);
m_Root->Delete(); m_Root = 0;
//Removing all observers
for ( NodeTagMapType::iterator dataIter = m_HelperObjectObserverTags.begin(); dataIter != m_HelperObjectObserverTags.end(); ++dataIter )
{
(*dataIter).first->GetProperty("helper object")->RemoveObserver( (*dataIter).second );
}
m_HelperObjectObserverTags.clear();
}
mitk::DataNode::Pointer QmitkDataStorageTreeModel::GetNode( const QModelIndex &index ) const
{
return this->TreeItemFromIndex(index)->GetDataNode();
}
const mitk::DataStorage::Pointer QmitkDataStorageTreeModel::GetDataStorage() const
{
return m_DataStorage.GetPointer();
}
QModelIndex QmitkDataStorageTreeModel::index( int row, int column, const QModelIndex & parent ) const
{
TreeItem* parentItem;
if (!parent.isValid())
parentItem = m_Root;
else
parentItem = static_cast<TreeItem*>(parent.internalPointer());
TreeItem *childItem = parentItem->GetChild(row);
if (childItem)
return createIndex(row, column, childItem);
else
return QModelIndex();
}
int QmitkDataStorageTreeModel::rowCount(const QModelIndex &parent) const
{
TreeItem *parentTreeItem = this->TreeItemFromIndex(parent);
return parentTreeItem->GetChildCount();
}
Qt::ItemFlags QmitkDataStorageTreeModel::flags( const QModelIndex& index ) const
{
+ mitk::DataNode* dataNode = this->TreeItemFromIndex(index)->GetDataNode();
if (index.isValid())
+ {
+ if(DicomPropertiesExists(*dataNode))
+ {
+ return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
+ }
return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable
- | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
- else
+ | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
+ }else{
return Qt::ItemIsDropEnabled;
+ }
}
int QmitkDataStorageTreeModel::columnCount( const QModelIndex& /* parent = QModelIndex() */ ) const
{
return 1;
}
QModelIndex QmitkDataStorageTreeModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
TreeItem *childItem = this->TreeItemFromIndex(index);
TreeItem *parentItem = childItem->GetParent();
if (parentItem == m_Root)
return QModelIndex();
return this->createIndex(parentItem->GetIndex(), 0, parentItem);
}
QmitkDataStorageTreeModel::TreeItem* QmitkDataStorageTreeModel::TreeItemFromIndex( const QModelIndex &index ) const
{
if (index.isValid())
return static_cast<TreeItem *>(index.internalPointer());
else
return m_Root;
}
Qt::DropActions QmitkDataStorageTreeModel::supportedDropActions() const
{
return Qt::CopyAction | Qt::MoveAction;
}
Qt::DropActions QmitkDataStorageTreeModel::supportedDragActions() const
{
return Qt::CopyAction | Qt::MoveAction;
}
bool QmitkDataStorageTreeModel::dropMimeData(const QMimeData *data,
Qt::DropAction action, int /*row*/, int /*column*/, const QModelIndex &parent)
{
// Early exit, returning true, but not actually doing anything (ignoring data).
if (action == Qt::IgnoreAction)
{
return true;
}
// Note, we are returning true if we handled it, and false otherwise
bool returnValue = false;
if(data->hasFormat("application/x-qabstractitemmodeldatalist"))
{
returnValue = true;
// First we extract a Qlist of TreeItem* pointers.
QString arg = QString(data->data("application/x-qabstractitemmodeldatalist").data());
QStringList listOfTreeItemAddressPointers = arg.split(",");
QStringList::iterator slIter;
QList<TreeItem*> listOfItemsToDrop;
for(slIter = listOfTreeItemAddressPointers.begin();
slIter != listOfTreeItemAddressPointers.end();
slIter++)
{
long val = (*slIter).toLong();
listOfItemsToDrop << static_cast<TreeItem *>((void*)val);
}
// Retrieve the TreeItem* where we are dropping stuff, and its parent.
TreeItem* dropItem = this->TreeItemFromIndex(parent);
TreeItem* parentItem = dropItem->GetParent();
// If item was dropped onto empty space, we select the root node
if(dropItem == m_Root)
{
parentItem = m_Root;
}
// Dragging and Dropping is only allowed within the same parent, so use the first item in list to validate.
// (otherwise, you could have a derived image such as a segmentation, and assign it to another image).
// NOTE: We are assuming the input list is valid... i.e. when it was dragged, all the items had the same parent.
if(listOfItemsToDrop[0] != dropItem && listOfItemsToDrop[0]->GetParent() == parentItem)
{
// Retrieve the index of where we are dropping stuff.
QModelIndex dropItemModelIndex = this->IndexFromTreeItem(dropItem);
QModelIndex parentModelIndex = this->IndexFromTreeItem(parentItem);
// Iterate through the list of TreeItem (which may be at non-consecutive indexes).
QList<TreeItem*>::iterator diIter;
for (diIter = listOfItemsToDrop.begin();
diIter != listOfItemsToDrop.end();
diIter++)
{
// Here we assume that as you remove items, one at a time, that GetIndex() will be valid.
this->beginRemoveRows(parentModelIndex, (*diIter)->GetIndex(), (*diIter)->GetIndex());
parentItem->RemoveChild(*diIter);
this->endRemoveRows();
}
// Select the target index position, or put it at the end of the list.
int dropIndex = dropItemModelIndex.row();
if (dropIndex == -1)
{
dropIndex = parentItem->GetChildCount();
}
// Now insert items again at the drop item position
this->beginInsertRows(parentModelIndex, dropIndex, dropIndex + listOfItemsToDrop.size() - 1);
for (diIter = listOfItemsToDrop.begin();
diIter != listOfItemsToDrop.end();
diIter++)
{
parentItem->InsertChild( (*diIter), dropIndex );
dropIndex++;
}
this->endInsertRows();
// Change Layers to match.
this->AdjustLayerProperty();
}
}
else if(data->hasFormat("application/x-mitk-datanodes"))
{
returnValue = true;
QString arg = QString(data->data("application/x-mitk-datanodes").data());
QStringList listOfDataNodeAddressPointers = arg.split(",");
int numberOfNodesDropped = 0;
QStringList::iterator slIter;
for (slIter = listOfDataNodeAddressPointers.begin();
slIter != listOfDataNodeAddressPointers.end();
slIter++)
{
long val = (*slIter).toLong();
mitk::DataNode* node = static_cast<mitk::DataNode *>((void*)val);
if(node && m_DataStorage.IsNotNull() && !m_DataStorage->Exists(node))
{
m_DataStorage->Add( node );
mitk::BaseData::Pointer basedata = node->GetData();
if (basedata.IsNotNull())
{
mitk::RenderingManager::GetInstance()->InitializeViews(
basedata->GetTimeSlicedGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true );
numberOfNodesDropped++;
}
}
}
// Only do a rendering update, if we actually dropped anything.
if (numberOfNodesDropped > 0)
{
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
return returnValue;
}
QStringList QmitkDataStorageTreeModel::mimeTypes() const
{
QStringList types = QAbstractItemModel::mimeTypes();
types << "application/x-qabstractitemmodeldatalist";
types << "application/x-mitk-datanodes";
return types;
}
QMimeData * QmitkDataStorageTreeModel::mimeData(const QModelIndexList & indexes) const{
QMimeData * ret = new QMimeData;
QString treeItemAddresses("");
QString dataNodeAddresses("");
for (int i = 0; i < indexes.size(); i++)
{
TreeItem* treeItem = static_cast<TreeItem*>(indexes.at(i).internalPointer());
long treeItemAddress = reinterpret_cast<long>(treeItem);
long dataNodeAddress = reinterpret_cast<long>(treeItem->GetDataNode().GetPointer());
QTextStream(&treeItemAddresses) << treeItemAddress;
QTextStream(&dataNodeAddresses) << dataNodeAddress;
if (i != indexes.size() - 1)
{
QTextStream(&treeItemAddresses) << ",";
QTextStream(&dataNodeAddresses) << ",";
}
}
ret->setData("application/x-qabstractitemmodeldatalist", QByteArray(treeItemAddresses.toAscii()));
ret->setData("application/x-mitk-datanodes", QByteArray(dataNodeAddresses.toAscii()));
return ret;
}
QVariant QmitkDataStorageTreeModel::data( const QModelIndex & index, int role ) const
{
mitk::DataNode* dataNode = this->TreeItemFromIndex(index)->GetDataNode();
// get name of treeItem (may also be edited)
- QString nodeName = QString::fromStdString(dataNode->GetName());
+ QString nodeName;
+ if(DicomPropertiesExists(*dataNode))
+ {
+ mitk::BaseProperty* seriesDescription = (dataNode->GetProperty("dicom.series.SeriesDescription"));
+ mitk::BaseProperty* studyDescription = (dataNode->GetProperty("dicom.study.StudyDescription"));
+ mitk::BaseProperty* patientsName = (dataNode->GetProperty("dicom.patient.PatientsName"));
+
+ nodeName.append(patientsName->GetValueAsString().c_str()).append("\n");
+ nodeName.append(studyDescription->GetValueAsString().c_str()).append("\n");
+ nodeName.append(seriesDescription->GetValueAsString().c_str());
+ }else{
+ nodeName = QString::fromStdString(dataNode->GetName());
+ }
if(nodeName.isEmpty())
+ {
nodeName = "unnamed";
+ }
if (role == Qt::DisplayRole)
return nodeName;
else if(role == Qt::ToolTipRole)
return nodeName;
else if(role == Qt::DecorationRole)
{
QmitkNodeDescriptor* nodeDescriptor
= QmitkNodeDescriptorManager::GetInstance()->GetDescriptor(dataNode);
return nodeDescriptor->GetIcon();
}
else if(role == Qt::CheckStateRole)
{
return dataNode->IsVisible(0);
}
else if(role == QmitkDataNodeRole)
{
return QVariant::fromValue<mitk::DataNode::Pointer>(mitk::DataNode::Pointer(dataNode));
}
return QVariant();
}
+bool QmitkDataStorageTreeModel::DicomPropertiesExists(const mitk::DataNode& node) const
+{
+ bool propertiesExists = false;
+ mitk::BaseProperty* seriesDescription = (node.GetProperty("dicom.series.SeriesDescription"));
+ mitk::BaseProperty* studyDescription = (node.GetProperty("dicom.study.StudyDescription"));
+ mitk::BaseProperty* patientsName = (node.GetProperty("dicom.patient.PatientsName"));
+
+ if(patientsName!=NULL && studyDescription!=NULL && seriesDescription!=NULL)
+ {
+ if((!patientsName->GetValueAsString().empty())&&
+ (!studyDescription->GetValueAsString().empty())&&
+ (!seriesDescription->GetValueAsString().empty()))
+ {
+ propertiesExists = true;
+ }
+ }
+ return propertiesExists;
+}
+
+
QVariant QmitkDataStorageTreeModel::headerData(int /*section*/,
Qt::Orientation orientation,
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole && m_Root)
return QString::fromStdString(m_Root->GetDataNode()->GetName());
return QVariant();
}
void QmitkDataStorageTreeModel::SetDataStorage( mitk::DataStorage* _DataStorage )
{
if(m_DataStorage != _DataStorage) // dont take the same again
{
if(m_DataStorage.IsNotNull())
{
// remove Listener for the data storage itself
m_DataStorage.ObjectDelete.RemoveListener( mitk::MessageDelegate1<QmitkDataStorageTreeModel
, const itk::Object*>( this, &QmitkDataStorageTreeModel::SetDataStorageDeleted ) );
// remove listeners for the nodes
m_DataStorage->AddNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkDataStorageTreeModel
, const mitk::DataNode*>( this, &QmitkDataStorageTreeModel::AddNode ) );
m_DataStorage->ChangedNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkDataStorageTreeModel
, const mitk::DataNode*>( this, &QmitkDataStorageTreeModel::SetNodeModified ) );
m_DataStorage->RemoveNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkDataStorageTreeModel
, const mitk::DataNode*>( this, &QmitkDataStorageTreeModel::RemoveNode ) );
}
// take over the new data storage
m_DataStorage = _DataStorage;
// delete the old root (if necessary, create new)
if(m_Root)
m_Root->Delete();
mitk::DataNode::Pointer rootDataNode = mitk::DataNode::New();
rootDataNode->SetName("Data Manager");
m_Root = new TreeItem(rootDataNode, 0);
this->reset();
if(m_DataStorage.IsNotNull())
{
// add Listener for the data storage itself
m_DataStorage.ObjectDelete.AddListener( mitk::MessageDelegate1<QmitkDataStorageTreeModel
, const itk::Object*>( this, &QmitkDataStorageTreeModel::SetDataStorageDeleted ) );
// add listeners for the nodes
m_DataStorage->AddNodeEvent.AddListener( mitk::MessageDelegate1<QmitkDataStorageTreeModel
, const mitk::DataNode*>( this, &QmitkDataStorageTreeModel::AddNode ) );
m_DataStorage->ChangedNodeEvent.AddListener( mitk::MessageDelegate1<QmitkDataStorageTreeModel
, const mitk::DataNode*>( this, &QmitkDataStorageTreeModel::SetNodeModified ) );
m_DataStorage->RemoveNodeEvent.AddListener( mitk::MessageDelegate1<QmitkDataStorageTreeModel
, const mitk::DataNode*>( this, &QmitkDataStorageTreeModel::RemoveNode ) );
mitk::DataStorage::SetOfObjects::ConstPointer _NodeSet = m_DataStorage->GetSubset(m_Predicate);
// finally add all nodes to the model
this->Update();
}
}
}
void QmitkDataStorageTreeModel::SetDataStorageDeleted( const itk::Object* /*_DataStorage*/ )
{
this->SetDataStorage(0);
}
void QmitkDataStorageTreeModel::AddNodeInternal(const mitk::DataNode *node)
{
if(node == 0
|| m_DataStorage.IsNull()
|| !m_DataStorage->Exists(node)
|| !m_Predicate->CheckNode(node)
|| m_Root->Find(node) != 0)
return;
// find out if we have a root node
TreeItem* parentTreeItem = m_Root;
QModelIndex index;
mitk::DataNode* parentDataNode = this->GetParentNode(node);
if(parentDataNode) // no top level data node
{
parentTreeItem = m_Root->Find(parentDataNode); // find the corresponding tree item
if(!parentTreeItem)
{
this->AddNode(parentDataNode);
parentTreeItem = m_Root->Find(parentDataNode);
if(!parentTreeItem)
return;
}
// get the index of this parent with the help of the grand parent
index = this->createIndex(parentTreeItem->GetIndex(), 0, parentTreeItem);
}
// add node
if(m_PlaceNewNodesOnTop)
{
// emit beginInsertRows event
beginInsertRows(index, 0, 0);
parentTreeItem->InsertChild(new TreeItem(
const_cast<mitk::DataNode*>(node)), 0);
}
else
{
beginInsertRows(index, parentTreeItem->GetChildCount()
, parentTreeItem->GetChildCount());
new TreeItem(const_cast<mitk::DataNode*>(node), parentTreeItem);
}
// emit endInsertRows event
endInsertRows();
this->AdjustLayerProperty();
}
void QmitkDataStorageTreeModel::AddNode( const mitk::DataNode* node )
{
if(node == 0
|| m_DataStorage.IsNull()
|| !m_DataStorage->Exists(node)
|| !m_Predicate->CheckNode(node)
|| m_Root->Find(node) != 0)
return;
bool isHelperObject (false);
NodeTagMapType::iterator searchIter = m_HelperObjectObserverTags.find( const_cast<mitk::DataNode*>(node) );
if (node->GetBoolProperty("helper object", isHelperObject) && searchIter == m_HelperObjectObserverTags.end()) {
itk::SimpleMemberCommand<QmitkDataStorageTreeModel>::Pointer command = itk::SimpleMemberCommand<QmitkDataStorageTreeModel>::New();
command->SetCallbackFunction(this, &QmitkDataStorageTreeModel::UpdateNodeVisibility);
m_HelperObjectObserverTags.insert( std::pair<mitk::DataNode*, unsigned long>( const_cast<mitk::DataNode*>(node), node->GetProperty("helper object")->AddObserver( itk::ModifiedEvent(), command ) ) );
}
this->AddNodeInternal(node);
}
void QmitkDataStorageTreeModel::SetPlaceNewNodesOnTop(bool _PlaceNewNodesOnTop)
{
m_PlaceNewNodesOnTop = _PlaceNewNodesOnTop;
}
void QmitkDataStorageTreeModel::RemoveNodeInternal( const mitk::DataNode* node )
{
if(!m_Root) return;
TreeItem* treeItem = m_Root->Find(node);
if(!treeItem)
return; // return because there is no treeitem containing this node
TreeItem* parentTreeItem = treeItem->GetParent();
QModelIndex parentIndex = this->IndexFromTreeItem(parentTreeItem);
// emit beginRemoveRows event (QModelIndex is empty because we dont have a tree model)
this->beginRemoveRows(parentIndex, treeItem->GetIndex(), treeItem->GetIndex());
// remove node
std::vector<TreeItem*> children = treeItem->GetChildren();
delete treeItem;
// emit endRemoveRows event
endRemoveRows();
// move all children of deleted node into its parent
for ( std::vector<TreeItem*>::iterator it = children.begin()
; it != children.end(); it++)
{
// emit beginInsertRows event
beginInsertRows(parentIndex, parentTreeItem->GetChildCount(), parentTreeItem->GetChildCount());
// add nodes again
parentTreeItem->AddChild(*it);
// emit endInsertRows event
endInsertRows();
}
this->AdjustLayerProperty();
}
void QmitkDataStorageTreeModel::RemoveNode( const mitk::DataNode* node )
{
if (node == 0)
return;
//Removing Observer
bool isHelperObject (false);
NodeTagMapType::iterator searchIter = m_HelperObjectObserverTags.find( const_cast<mitk::DataNode*>(node) );
if (node->GetBoolProperty("helper object", isHelperObject) && searchIter != m_HelperObjectObserverTags.end()) {
(*searchIter).first->GetProperty("helper object")->RemoveObserver( (*searchIter).second );
m_HelperObjectObserverTags.erase(const_cast<mitk::DataNode*>(node));
}
this->RemoveNodeInternal(node);
}
void QmitkDataStorageTreeModel::SetNodeModified( const mitk::DataNode* node )
{
TreeItem* treeItem = m_Root->Find(node);
if(!treeItem)
return;
TreeItem* parentTreeItem = treeItem->GetParent();
// as the root node should not be removed one should always have a parent item
if(!parentTreeItem)
return;
QModelIndex index = this->createIndex(treeItem->GetIndex(), 0, treeItem);
// now emit the dataChanged signal
emit dataChanged(index, index);
}
mitk::DataNode* QmitkDataStorageTreeModel::GetParentNode( const mitk::DataNode* node ) const
{
mitk::DataNode* dataNode = 0;
mitk::DataStorage::SetOfObjects::ConstPointer _Sources = m_DataStorage->GetSources(node);
if(_Sources->Size() > 0)
dataNode = _Sources->front();
return dataNode;
}
bool QmitkDataStorageTreeModel::setData( const QModelIndex &index, const QVariant &value, int role )
{
mitk::DataNode* dataNode = this->TreeItemFromIndex(index)->GetDataNode();
if(!dataNode)
return false;
if(role == Qt::EditRole && !value.toString().isEmpty())
{
dataNode->SetStringProperty("name", value.toString().toStdString().c_str());
}
else if(role == Qt::CheckStateRole)
{
// Please note: value.toInt() returns 2, independentely from the actual checkstate of the index element.
// Therefore the checkstate is being estimated again here.
QVariant qcheckstate = index.data(Qt::CheckStateRole);
int checkstate = qcheckstate.toInt();
bool isVisible = bool(checkstate);
dataNode->SetVisibility(!isVisible);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
// inform listeners about changes
emit dataChanged(index, index);
return true;
}
bool QmitkDataStorageTreeModel::setHeaderData( int /*section*/, Qt::Orientation /*orientation*/, const QVariant& /* value */, int /*role = Qt::EditRole*/ )
{
return false;
}
void QmitkDataStorageTreeModel::AdjustLayerProperty()
{
/// transform the tree into an array and set the layer property descending
std::vector<TreeItem*> vec;
this->TreeToVector(m_Root, vec);
int i = vec.size()-1;
for(std::vector<TreeItem*>::const_iterator it = vec.begin(); it != vec.end(); ++it)
{
(*it)->GetDataNode()->SetIntProperty("layer", i);
--i;
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkDataStorageTreeModel::TreeToVector(TreeItem* parent, std::vector<TreeItem*>& vec) const
{
TreeItem* current;
for(int i = 0; i<parent->GetChildCount(); ++i)
{
current = parent->GetChild(i);
this->TreeToVector(current, vec);
vec.push_back(current);
}
}
QModelIndex QmitkDataStorageTreeModel::IndexFromTreeItem( TreeItem* item ) const
{
if(item == m_Root)
return QModelIndex();
else
return this->createIndex(item->GetIndex(), 0, item);
}
QList<mitk::DataNode::Pointer> QmitkDataStorageTreeModel::GetNodeSet() const
{
QList<mitk::DataNode::Pointer> res;
if(m_Root)
this->TreeToNodeSet(m_Root, res);
return res;
}
void QmitkDataStorageTreeModel::TreeToNodeSet( TreeItem* parent, QList<mitk::DataNode::Pointer>& vec ) const
{
TreeItem* current;
for(int i = 0; i<parent->GetChildCount(); ++i)
{
current = parent->GetChild(i);
vec.push_back(current->GetDataNode());
this->TreeToNodeSet(current, vec);
}
}
QModelIndex QmitkDataStorageTreeModel::GetIndex( const mitk::DataNode* node ) const
{
if(m_Root)
{
TreeItem* item = m_Root->Find(node);
if(item)
return this->IndexFromTreeItem(item);
}
return QModelIndex();
}
QmitkDataStorageTreeModel::TreeItem::TreeItem( mitk::DataNode* _DataNode, TreeItem* _Parent )
: m_Parent(_Parent)
, m_DataNode(_DataNode)
{
if(m_Parent)
m_Parent->AddChild(this);
}
QmitkDataStorageTreeModel::TreeItem::~TreeItem()
{
if(m_Parent)
m_Parent->RemoveChild(this);
}
void QmitkDataStorageTreeModel::TreeItem::Delete()
{
while(m_Children.size() > 0)
delete m_Children.back();
delete this;
}
QmitkDataStorageTreeModel::TreeItem* QmitkDataStorageTreeModel::TreeItem::Find( const mitk::DataNode* _DataNode ) const
{
QmitkDataStorageTreeModel::TreeItem* item = 0;
if(_DataNode)
{
if(m_DataNode == _DataNode)
item = const_cast<TreeItem*>(this);
else
{
for(std::vector<TreeItem*>::const_iterator it = m_Children.begin(); it != m_Children.end(); ++it)
{
if(item)
break;
item = (*it)->Find(_DataNode);
}
}
}
return item;
}
int QmitkDataStorageTreeModel::TreeItem::IndexOfChild( const TreeItem* item ) const
{
std::vector<TreeItem*>::const_iterator it = std::find(m_Children.begin(), m_Children.end(), item);
return it != m_Children.end() ? std::distance(m_Children.begin(), it): -1;
}
QmitkDataStorageTreeModel::TreeItem* QmitkDataStorageTreeModel::TreeItem::GetChild( int index ) const
{
return (m_Children.size() > 0 && index >= 0 && index < (int)m_Children.size())? m_Children.at(index): 0;
}
void QmitkDataStorageTreeModel::TreeItem::AddChild( TreeItem* item )
{
this->InsertChild(item);
}
void QmitkDataStorageTreeModel::TreeItem::RemoveChild( TreeItem* item )
{
std::vector<TreeItem*>::iterator it = std::find(m_Children.begin(), m_Children.end(), item);
if(it != m_Children.end())
{
m_Children.erase(it);
item->SetParent(0);
}
}
int QmitkDataStorageTreeModel::TreeItem::GetChildCount() const
{
return m_Children.size();
}
int QmitkDataStorageTreeModel::TreeItem::GetIndex() const
{
if (m_Parent)
return m_Parent->IndexOfChild(this);
return 0;
}
QmitkDataStorageTreeModel::TreeItem* QmitkDataStorageTreeModel::TreeItem::GetParent() const
{
return m_Parent;
}
mitk::DataNode::Pointer QmitkDataStorageTreeModel::TreeItem::GetDataNode() const
{
return m_DataNode;
}
void QmitkDataStorageTreeModel::TreeItem::InsertChild( TreeItem* item, int index )
{
std::vector<TreeItem*>::iterator it = std::find(m_Children.begin(), m_Children.end(), item);
if(it == m_Children.end())
{
if(m_Children.size() > 0 && index >= 0 && index < (int)m_Children.size())
{
it = m_Children.begin();
std::advance(it, index);
m_Children.insert(it, item);
}
else
m_Children.push_back(item);
// add parent if necessary
if(item->GetParent() != this)
item->SetParent(this);
}
}
std::vector<QmitkDataStorageTreeModel::TreeItem*> QmitkDataStorageTreeModel::TreeItem::GetChildren() const
{
return m_Children;
}
void QmitkDataStorageTreeModel::TreeItem::SetParent( TreeItem* _Parent )
{
m_Parent = _Parent;
if(m_Parent)
m_Parent->AddChild(this);
}
void QmitkDataStorageTreeModel::SetShowHelperObjects(bool _ShowHelperObjects)
{
m_ShowHelperObjects = _ShowHelperObjects;
this->UpdateNodeVisibility();
}
void QmitkDataStorageTreeModel::SetShowNodesContainingNoData(bool _ShowNodesContainingNoData)
{
m_ShowNodesContainingNoData = _ShowNodesContainingNoData;
this->UpdateNodeVisibility();
}
void QmitkDataStorageTreeModel::UpdateNodeVisibility()
{
mitk::NodePredicateData::Pointer dataIsNull = mitk::NodePredicateData::New(0);
mitk::NodePredicateNot::Pointer dataIsNotNull = mitk::NodePredicateNot::New(dataIsNull);// Show only nodes that really contain dat
if (m_ShowHelperObjects)
{
if (m_ShowNodesContainingNoData)
{
// Show every node
m_Predicate = mitk::NodePredicateOr::New(dataIsNull, dataIsNotNull);
}
else
{
// Show helper objects but not nodes containing no data
m_Predicate = dataIsNotNull;
}
}
else
{
mitk::NodePredicateProperty::Pointer isHelperObject = mitk::NodePredicateProperty::New("helper object", mitk::BoolProperty::New(true));
mitk::NodePredicateNot::Pointer isNotHelperObject = mitk::NodePredicateNot::New(isHelperObject);// Show only nodes that are not helper objects
if (m_ShowNodesContainingNoData)
{
// Don't show helper objects but nodes containing no data
m_Predicate = isNotHelperObject;
}
else
{
// Don't show helper objects and nodes containing no data
m_Predicate = mitk::NodePredicateAnd::New(isNotHelperObject, dataIsNotNull);
}
}
this->Update();
}
void QmitkDataStorageTreeModel::Update()
{
if (m_DataStorage.IsNotNull())
{
this->reset();
mitk::DataStorage::SetOfObjects::ConstPointer _NodeSet = m_DataStorage->GetSubset(m_Predicate);
for(mitk::DataStorage::SetOfObjects::const_iterator it=_NodeSet->begin(); it!=_NodeSet->end(); it++)
{
// save node
this->AddNodeInternal(*it);
}
mitk::DataStorage::SetOfObjects::ConstPointer _NotNodeSet = m_DataStorage->GetSubset(mitk::NodePredicateNot::New(m_Predicate));
for(mitk::DataStorage::SetOfObjects::const_iterator it=_NotNodeSet->begin(); it!=_NotNodeSet->end(); it++)
{
// remove node
this->RemoveNodeInternal(*it);
}
}
}
diff --git a/Modules/Qmitk/QmitkDataStorageTreeModel.h b/Modules/Qmitk/QmitkDataStorageTreeModel.h
index 498b1a4c22..f68bac0ead 100644
--- a/Modules/Qmitk/QmitkDataStorageTreeModel.h
+++ b/Modules/Qmitk/QmitkDataStorageTreeModel.h
@@ -1,288 +1,292 @@
/*===================================================================
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 QMITKDATASTORAGETREEMODEL_H_
#define QMITKDATASTORAGETREEMODEL_H_
#include <QmitkExports.h>
#include <mitkDataStorage.h>
#include <mitkNodePredicateBase.h>
#include <mitkWeakPointer.h>
#include <QAbstractListModel>
#include "QmitkEnums.h"
#include "QmitkCustomVariants.h"
#include <vector>
#include <string>
#include <QList>
class QMITK_EXPORT QmitkDataStorageTreeModel : public QAbstractItemModel
{
//# CONSTANTS,TYPEDEFS
public:
static const std::string COLUMN_NAME;
static const std::string COLUMN_TYPE;
static const std::string COLUMN_VISIBILITY;
//# CTORS,DTOR
public:
QmitkDataStorageTreeModel(mitk::DataStorage* _DataStorage
, bool _PlaceNewNodesOnTop=false
, bool _ShowHelperObjects=false
, bool _ShowNodesContainingNoData=false
, QObject* parent = 0);
~QmitkDataStorageTreeModel();
//# GETTER
public:
typedef std::map<mitk::DataNode*, unsigned long> NodeTagMapType;
///
/// Get node at a specific model index.
/// This function is used to get a node from a QModelIndex
///
mitk::DataNode::Pointer GetNode(const QModelIndex &index) const;
///
/// Returns a copy of the node-vector that is shown by this model
///
virtual QList<mitk::DataNode::Pointer> GetNodeSet() const;
///
/// Get the DataStorage.
///
const mitk::DataStorage::Pointer GetDataStorage() const;
///
/// Get the top placement flag
///
bool GetPlaceNewNodesOnTopFlag()
{
return m_PlaceNewNodesOnTop;
}
///
/// Get the helper object visibility flag
///
bool GetShowHelperObjectsFlag()
{
return m_ShowHelperObjects;
}
///
/// Get the visibility flag for showing nodes that contain no data
///
bool GetShowNodesContainingNoDataFlag()
{
return m_ShowNodesContainingNoData;
}
///
/// Set the top placement flag
///
void SetPlaceNewNodesOnTop(bool _PlaceNewNodesOnTop);
//# (Re-)implemented from QAbstractItemModel
//# Read model
Qt::ItemFlags flags(const QModelIndex& index) const;
QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
//# hierarchical model
///
/// called whenever the model or the view needs to create a QModelIndex for a particular
/// child item (or a top-level item if parent is an invalid QModelIndex)
///
QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
QModelIndex parent ( const QModelIndex & index ) const;
//# editable model
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
Qt::DropActions supportedDropActions() const;
Qt::DropActions supportedDragActions() const;
QStringList mimeTypes() const;
QMimeData * mimeData(const QModelIndexList & indexes) const;
//# End of QAbstractItemModel
//# SETTER
public:
///
/// Sets the DataStorage. The whole model will be resetted.
///
void SetDataStorage(mitk::DataStorage* _DataStorage);
///
/// Notify that the DataStorage was deleted. The whole model will be resetted.
///
void SetDataStorageDeleted(const itk::Object* _DataStorage);
///
/// Adds a node to this model.
/// If a predicate is set (not null) the node will be checked against it.The node has to have a data object (no one wants to see empty nodes).
///
virtual void AddNode(const mitk::DataNode* node);
///
/// Removes a node from this model. Also removes any event listener from the node.
///
virtual void RemoveNode(const mitk::DataNode* node);
///
/// Sets a node to modfified. Called by the DataStorage
///
virtual void SetNodeModified(const mitk::DataNode* node);
///
/// \return an index for the given datatreenode in the tree. If the node is not found
///
QModelIndex GetIndex(const mitk::DataNode*) const;
///
/// Show or hide helper objects
///
void SetShowHelperObjects(bool _ShowHelperObjects);
///
/// Show or hide objects that contain no data
///
void SetShowNodesContainingNoData(bool _ShowNodesContainingNoData);
///
/// Update the visibility of data nodes according to the preference settings
///
void UpdateNodeVisibility();
//# MISC
protected:
///
/// Helper class to represent a tree structure of DataNodes
///
class TreeItem
{
public:
///
/// Constructs a new TreeItem with the given DataNode (must not be 0)
///
TreeItem(mitk::DataNode* _DataNode, TreeItem* _Parent=0);
///
/// Removes itself as child from its parent-> Does not delete its children
/// \sa Delete()
///
virtual ~TreeItem();
///
/// Find the index of an item
///
int IndexOfChild(const TreeItem* item) const;
///
/// \child The child at pos index or 0 if it not exists
///
TreeItem* GetChild(int index) const;
///
/// Find the TreeItem containing a special tree node (recursive tree function)
///
TreeItem* Find( const mitk::DataNode* _DataNode) const;
///
/// Get the amount of children
///
int GetChildCount() const;
///
/// \return the index of this node in its parent list
///
int GetIndex() const;
///
/// \return the parent of this tree item
///
TreeItem* GetParent() const;
///
/// Return the DataNode associated with this node
///
mitk::DataNode::Pointer GetDataNode() const;
///
/// Get all children as vector
///
std::vector<TreeItem*> GetChildren() const;
///
/// add another item as a child of this (only if not already in that list)
///
void AddChild( TreeItem* item);
///
/// remove another item as child from this
///
void RemoveChild( TreeItem* item);
///
/// inserts a child at the given position. if pos is not in range
/// the element is added at the end
///
void InsertChild( TreeItem* item, int index=-1 );
/// Sets the parent on the treeitem
void SetParent(TreeItem* _Parent);
///
/// Deletes the whole tree branch
///
void Delete();
protected:
TreeItem* m_Parent;
std::vector<TreeItem*> m_Children;
mitk::DataNode::Pointer m_DataNode;
};
///
/// Adjusts the LayerProperty according to the nodes position
///
void AdjustLayerProperty();
///
/// invoked after m_DataStorage or m_Predicate changed
///
TreeItem* TreeItemFromIndex(const QModelIndex &index) const;
///
/// Gives a ModelIndex for the Tree Item
///
QModelIndex IndexFromTreeItem(TreeItem*) const;
///
/// Returns the first element in the nodes sources list (if available) or 0
///
mitk::DataNode* GetParentNode(const mitk::DataNode* node) const;
///
/// Adds all Childs in parent to vec. Before a child is added the function is called recursively
///
void TreeToVector(TreeItem* parent, std::vector<TreeItem*>& vec) const;
///
/// Adds all Childs in parent to vec. Before a child is added the function is called recursively
///
void TreeToNodeSet(TreeItem* parent, QList<mitk::DataNode::Pointer> &vec) const;
///
/// Update Tree Model according to predicates
///
void Update();
//# ATTRIBUTES
protected:
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
mitk::NodePredicateBase::Pointer m_Predicate;
bool m_PlaceNewNodesOnTop;
bool m_ShowHelperObjects;
bool m_ShowNodesContainingNoData;
TreeItem* m_Root;
NodeTagMapType m_HelperObjectObserverTags;
private:
void AddNodeInternal(const mitk::DataNode*);
void RemoveNodeInternal(const mitk::DataNode*);
+ ///
+ /// Checks if dicom properties patient name, study names and series name exists
+ ///
+ bool DicomPropertiesExists(const mitk::DataNode&) const;
};
#endif /* QMITKDATASTORAGETREEMODEL_H_ */
diff --git a/Plugins/PluginList.cmake b/Plugins/PluginList.cmake
index 67b5e41db5..4913532379 100644
--- a/Plugins/PluginList.cmake
+++ b/Plugins/PluginList.cmake
@@ -1,41 +1,41 @@
# 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.basicimageprocessing:OFF
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:ON
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.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.volumevisualization:OFF
)
diff --git a/Plugins/org.mitk.gui.qt.dicom/CMakeLists.txt b/Plugins/org.mitk.gui.qt.dicom/CMakeLists.txt
new file mode 100644
index 0000000000..1ba54a30f7
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/CMakeLists.txt
@@ -0,0 +1,11 @@
+project(org_mitk_gui_qt_dicom)
+
+include_directories(${CTK_INCLUDE_DIRS})
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE DICOM_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt mitkDicomUI
+)
+
+target_link_libraries(${PLUGIN_TARGET} ${CTK_LIBRARIES})
diff --git a/Plugins/org.mitk.gui.qt.dicom/documentation/Manual/Manual.dox b/Plugins/org.mitk.gui.qt.dicom/documentation/Manual/Manual.dox
new file mode 100644
index 0000000000..73bf53c939
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/documentation/Manual/Manual.dox
@@ -0,0 +1,19 @@
+/**
+\bundlemainpage{org.mitk.gui.qt.dicom} Dicom
+
+\image html icon.png "Icon of Dicom"
+
+Available sections:
+ - \ref org.mitk.gui.qt.dicomOverview
+
+\section org.mitk.gui.qt.dicomOverview
+Describe the features of your awesome plugin here
+<ul>
+<li>Increases productivity
+<li>Creates beautiful images
+<li>Generates PhD thesis
+<li>Brings world peace
+</ul>
+
+*/
+
diff --git a/Plugins/org.mitk.gui.qt.dicom/documentation/Manual/icon.png b/Plugins/org.mitk.gui.qt.dicom/documentation/Manual/icon.png
new file mode 100644
index 0000000000..7a51d8cb11
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/documentation/Manual/icon.png
@@ -0,0 +1,26 @@
+‰PNG
+
+
+•|€©$¦Š@IQIaSR•TRPyUÀ/­dKÁ6ے‘eëe=VÒJûÞyõtߓÝ=ÓÓ;+Ù Nü©ÚšÙîž{ï9÷œÿ9çîÀ¯_¿~½ª_?ûÙÏ^ÑñåW=`î¾jŸèlºæ}~n‹ 7ˆÊZT‡Œh7*í¨"h‘9QpÐs®Øþvç‘gß=:bÓc<òÈ#ìÙ³çÕ©
+#EuÎ}ºà؇þzû±oýöö”Óó=úè£Üy睯8÷ ïíˆqßÂzU>%»DµSQƒÅ€Ò×fXÓe*ݞЩ€Zh™¯*WŠ–ñù™Rˆ0‚5¨¨v:á¿oé]øÒ÷>rý"¯ 0”°/DÜ¿àd-èçP½GròºeБ[‡\npèkT›'‰>‹D˜ó•ç.×xê‚ϱ‰šVj*µPUzrÁC¯˜¿o÷ÐÜS¿ÿŽ'æE>
+À°Ö222òÊ+@î/¢ñŽËýÅë>Šê'èõ`]·£;V¸²}¹KޅPÁ*¨*o_]p
+H®׀çÀ‚¯<9îóø™ªž› d¦’Â5…êßÝÚWü篼ó±'éýêÈ4
+ÀÁƒÙ½{÷¯Puዮ ßWÕ7·­ÏéÎ.9â]‹?4 ±H-¬ÁÈb|hVŽb¢i¨–GN”õ[O/ˆç ËÛkÿõ‘›ÆÿüÎóß²óîé—6¯­€/”àc¸¿ÔŽðª[;r»7zzû #ª &<R£‘MÖÔS×ëÂk›¬ ~¶I=}Oyþ²¯_98+Õ@Y‘¯=óñ­g?½¦à?1::rñ¥*aiÜWÇF¡؉ʏQÝÙ㉾ïOnpðÃxAdv±•Ég>g­d‘ÅÈÕ¬DG„““>ÿòجN­\W¨>óÉÛÎ~fu§ÿؔßvá7ïÚÍ¡C‡ð}Éa–ð±ðV
+¨|«;{Û ¼±M^ÛïPKÚ¬F›¡=õk!Öltßs Ëƒ¾ `¨
+®2¯E°
+A¨¼yk+{s\*¹«÷÷¼eÁw¶#˓qüñ«(à åÄ÷W¢úρmCŽôy±ð*XR“Ó
+—‹p©“e¨…K[G¢„î6xMoMl‹h£¤7CXћ“mëòz¹d:žœè¸£šMª¬IÆ=tèP£”oü€w:;–åÄ5B`#ݦwÅjŒâqҒ$/6YMJ¨¹*œœ†‹ ʗjÑsm `ÛJXÑÙ#’`M7¼0©¦’¥d-iÌ9ÂÖµž;_áç—:¶ýÖºéC+:üÓcccGFFæwíÚÕÂóùT½åyÑë» ~H“é7™=)ßO]³qî^®ÁÃ'áëÏFïO^€gàJ ¦Ë‘<;ß==»F‰BèÕ,®áŠUX՗“ Ë<­ïà…®×;ÂZ`ÅÒ ø±<<P*
+üD6£8×w;ØHOÆ÷ÓæGc‡Zùi+ì°
+¾…U]°®§u¨L¬æâ|sHm…͘¥H«Úpå…éüÏè Â`†ÀÞ½{›¢ÀZ”•
+С‚'´9ˆÆhºÈücM‡×ÐÌÎ.Š ™1Bj„·lŒB\@fRã§'¢ÈÑï3•Í l¬¸Á#hhŜšm[™3Ú£ªûöíË&B:€Ò×ëI¼pi65myuPÊ,¨é+"+ïÂ;n„›VÑJø‰"ì;í~2V¨-\¡Ed
+-t\Œˆ Êø‚7àºE¤ÓÄ5rʤlwG.šÉ&¦¤©Ê+ÅèÔÍ?6E£ÍæŸv‹º+ÅBåspÏXۓ2ÛLÁ$ >|õp#é²)’5Ô¨@ۘ7Læ«_¾Pð 3>2Su»Œh§ªv¨ªl]F5oi3 $šý8Ê&B¦h­0QBê;Mø'H>>»ë%J_6
+¥MìRj\kã I¯%‹Ñ¼‚µÐî(ÕL»@ȋH³¨ª àˆÔ‰ˆ¹4ÃÓ©¶XP, \å¾kà]7GyýRi/DdÈwŽE™¢#`M›ÚEŠÐFyî:Q8,9 '"^B¸ÉEUµ ÐÒDG3¶0ñ¥îÇ߯†ð–õ°y¨µðɵssðÍ£è¹&Us¤ mme¶Nž¦Ö'l¢`¢àSUטh‹
+@k
+|õHôϓ ¥æëJ¯ÛµÀ"(í®EµÎꈪ¦]@Š A%P×jJ“×P6’8}ßƶ—°8¡Â꘻ôíc0UŽwÞ6*Á¦¹¤a‹Ö•YK̅r5ª¹»<Zƒ‘ªŠHCFìŒ*³Åš„4£kS‹K»¶¦Ò÷“d*´ÐíET×RLÕ(Þ{i³×Œk%}„Ôçì¼MkA¨øà×,F` _óCÈꄷI¹
+Ûü¼M‘"M|‚f®i‹’ܶ(Ém\#¤X©Ë3UJå@E`Ûʅ™š•i`(íÝ»w1+<ñG}.”“3AœnjƒŠ¶
+<!$ìb¢$¹–°H* ÚîD­±v'ª Úݨ0rœÆXš¢¿Cm¦Ä[­ES
+ “Ï—&+,”C¹eYÙvæìe«2)"SªZJºÇn—?XûÆLÍÝzz®&7ôåÄÄH¥éŒ, F™L0 F‚'ð¡­ù‘
+°gϞ†8p
+³ Jƒ`lÂKž<“殏f‘VN¶3”¥àj5ˉ³s„Ê]¯™«xŽž΋ÈxŒWï þñ¦S_l3vz¶jå̜¯ ªÚĈÕÅDH؂H¹V3ޑ¥Q½•5´ŠV£¨uîb‘K“U¹y°Â¦þÊ%#zô,p~dd¤’îšìqT€ßÛ|bü֞…ÏZ gg}™)‡1Òj=üeim›ª¼Òi¢®Ñtd1Ël[)¶`„R½ÁJ%àȱiÍç`çêbiyGí pxQU/%ó%=Â&ìÙ³‡ýû÷#ëï±÷¬ºðÍe^õÀ‚rjºŠ¨*B˜tˆS´vØ"¤i)›Ê—T€ÓºšØfоѓˆ6&´Ê“G®Z+¯*Û«.Xå¸*'EäÔèèhñšíñä áGo¸xñ ˦>ßéÚKç檜­Öµ¬hK0²KðtFççáôÌâ¿ssQhiAr.Jp·Â”ˆù9z|š©™
+C…·n˜™î̅Ï[•€"r> öK7GcW›÷„OúñÁ3Åö/ý|ºûS'&+y× k{ÛŪÔOfd‰p‰b©\ƒ|:s™SI-`R¬oúûM,šj(¼X…3gç8{~^syû¦éò¦ÊñrÍ=&"ÏWðƒÔÁþª
+HŽ–m½ã'³Ÿ®æþõ“G6^ÿËùÂRkaÝ@;֦θ]ƒ(‘¸U5]Y|f0Ý6©Z>!ZÉtMº ×hî³ãsœ|qF«È‡·N¿±jád%# ¿‘_ŠÈ€žžž—qJ ùKní?÷W·{ð†ŽÒ÷ §§Êzâr9&&‘·•©fk„ô¹ô)¥D–¥úiWh
diff --git a/Plugins/org.mitk.gui.qt.dicom/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.dicom/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..729ff70cb9
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_mitk_gui_qt_dicom org.mitk.gui.qt.dicom Plugin
+ \ingroup MITKPlugins
+
+ \brief Describe your plugin here.
+
+*/
+
+/**
+ \defgroup org_mitk_gui_qt_dicom_internal Internal
+ \ingroup org_mitk_gui_qt_dicom
+
+ \brief This subcategory includes the internal classes of the org.mitk.gui.qt.dicom 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.dicom/files.cmake b/Plugins/org.mitk.gui.qt.dicom/files.cmake
new file mode 100644
index 0000000000..602026e7de
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/files.cmake
@@ -0,0 +1,55 @@
+set(SRC_CPP_FILES
+
+)
+
+set(INTERNAL_CPP_FILES
+ mitkPluginActivator.cpp
+ QmitkDicomEditor.cpp
+ QmitkDicomDirectoryListener.cpp
+ QmitkStoreSCPLauncher.cpp
+ QmitkStoreSCPLauncherBuilder.cpp
+ QmitkDicomDataEventPublisher.cpp
+ DicomEventHandler.cpp
+ #QmitkDicomPreferencePage.cpp
+)
+
+set(UI_FILES
+ src/internal/QmitkDicomEditorControls.ui
+)
+
+set(MOC_H_FILES
+ src/internal/mitkPluginActivator.h
+ src/internal/QmitkDicomEditor.h
+ src/internal/QmitkDicomDirectoryListener.h
+ src/internal/QmitkStoreSCPLauncher.h
+ src/internal/QmitkStoreSCPLauncherBuilder.h
+ src/internal/QmitkDicomDataEventPublisher.h
+ src/internal/DicomEventHandler.h
+ #src/internal/QmitkDicomPreferencePage.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/Plugins/org.mitk.gui.qt.dicom/manifest_headers.cmake b/Plugins/org.mitk.gui.qt.dicom/manifest_headers.cmake
new file mode 100644
index 0000000000..8e156520f9
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "Dicom")
+set(Plugin-Version "0.1")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "")
+set(Require-Plugin org.mitk.gui.qt.common)
diff --git a/Plugins/org.mitk.gui.qt.dicom/plugin.xml b/Plugins/org.mitk.gui.qt.dicom/plugin.xml
new file mode 100644
index 0000000000..575f5fa784
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/plugin.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin>
+ <extension point="org.blueberry.ui.editors">
+ <editor
+ id="org.mitk.editors.dicomeditor"
+ name="MITK DICOM Editor"
+ class="QmitkDicomEditor"
+ icon="resources/icon.xpm" >
+ </editor>
+ </extension>
+ <!--
+ <extension point="org.blueberry.ui.preferencePages">
+ <page id="org.mitk.gui.qt.application.QmitkDicomPreferencePage" name="Dicom Editor" class="QmitkDicomPreferencePage">
+ <keywordreference id="org.mitk.gui.qt.application.DataManagerPreferencePageKeywords"></keywordreference>
+ </page>
+ </extension>
+ !-->
+</plugin>
diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/icon.xpm b/Plugins/org.mitk.gui.qt.dicom/resources/icon.xpm
new file mode 100644
index 0000000000..9057c20bc6
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/resources/icon.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static const char * icon_xpm[] = {
+"16 16 2 1",
+" c #FF0000",
+". c #000000",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.cpp
new file mode 100644
index 0000000000..ffbd773a62
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.cpp
@@ -0,0 +1,100 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkPluginActivator.h"
+#include "DicomEventHandler.h"
+#include <service/event/ctkEventConstants.h>
+#include <ctkDictionary.h>
+#include <mitklogmacros.h>
+#include <mitkDicomSeriesReader.h>
+#include <mitkDataNode.h>
+#include <QmitkBaseFunctionalityComponent.h>
+#include <mitkIDataStorageService.h>
+#include <service/event/ctkEventAdmin.h>
+#include <ctkServiceReference.h>
+#include <mitkRenderingManager.h>
+
+
+DicomEventHandler::DicomEventHandler()
+{
+}
+
+DicomEventHandler::~DicomEventHandler()
+{
+}
+
+void DicomEventHandler::OnSignalAddSeriesToDataManager(const ctkEvent& ctkEvent)
+{
+ QString patientName = ctkEvent.getProperty("PatientName").toString();
+ QString studyUID = ctkEvent.getProperty("StudyUID").toString();
+ QString studyName = ctkEvent.getProperty("StudyName").toString();
+ QString seriesUID = ctkEvent.getProperty("SeriesUID").toString();
+ QString seriesName = ctkEvent.getProperty("SeriesName").toString();
+ QString path = ctkEvent.getProperty("Path").toString();
+
+ std::list<std::string> qualifiedUIDs;
+ mitk::DicomSeriesReader::StringContainer seriesToLoad;
+ std::size_t found;
+
+ mitk::DicomSeriesReader::UidFileNamesMap dicomSeriesMap = mitk::DicomSeriesReader::GetSeries(path.toStdString());
+ mitk::DicomSeriesReader::UidFileNamesMap::const_iterator qualifiedSeriesInstanceUIDIterator;
+
+ for(qualifiedSeriesInstanceUIDIterator = dicomSeriesMap.begin();
+ qualifiedSeriesInstanceUIDIterator != dicomSeriesMap.end();
+ ++qualifiedSeriesInstanceUIDIterator)
+ {
+ found = qualifiedSeriesInstanceUIDIterator->first.find(seriesUID.toStdString());
+ if(found!= qualifiedSeriesInstanceUIDIterator->first.npos)
+ {
+ qualifiedUIDs.push_back(qualifiedSeriesInstanceUIDIterator->first);
+ seriesToLoad = qualifiedSeriesInstanceUIDIterator->second;
+ }
+ }
+
+ mitk::DataNode::Pointer node = mitk::DicomSeriesReader::LoadDicomSeries(seriesToLoad);
+ if (node.IsNull())
+ {
+ MITK_ERROR << "Could not load series: " << seriesUID.toStdString();
+ }
+ else
+ {
+ ctkServiceReference serviceReference =mitk::PluginActivator::getContext()->getServiceReference<mitk::IDataStorageService>();
+ mitk::IDataStorageService* storageService = mitk::PluginActivator::getContext()->getService<mitk::IDataStorageService>(serviceReference);
+
+ storageService->GetActiveDataStorage().GetPointer()->GetDataStorage()->Add(node);
+ mitk::RenderingManager::GetInstance()->SetDataStorage(storageService->GetActiveDataStorage().GetPointer()->GetDataStorage());
+ mitk::RenderingManager::GetInstance()->RequestUpdateAll();
+ }
+}
+
+void DicomEventHandler::OnSignalRemoveSeriesFromStorage(const ctkEvent& ctkEvent)
+{
+}
+
+void DicomEventHandler::SubscribeSlots()
+{
+ ctkServiceReference ref = mitk::PluginActivator::getContext()->getServiceReference<ctkEventAdmin>();
+ if (ref)
+ {
+ ctkEventAdmin* eventAdmin = mitk::PluginActivator::getContext()->getService<ctkEventAdmin>(ref);
+ ctkDictionary properties;
+ properties[ctkEventConstants::EVENT_TOPIC] = "org/mitk/gui/qt/dicom/ADD";
+ eventAdmin->subscribeSlot(this, SLOT(OnSignalAddSeriesToDataManager(ctkEvent)), properties);
+ properties[ctkEventConstants::EVENT_TOPIC] = "org/mitk/gui/qt/dicom/DELETED";
+ eventAdmin->subscribeSlot(this, SLOT(OnSignalRemoveSeriesFromStorage(ctkEvent)), properties);
+ }
+}
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.h
new file mode 100644
index 0000000000..17127d18cd
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.h
@@ -0,0 +1,42 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef DicomEventHandler_h
+#define DicomEventHandler_h
+
+#include <QObject>
+#include <service/event/ctkEvent.h>
+
+class DicomEventHandler : public QObject
+{
+ Q_OBJECT
+ public:
+
+ DicomEventHandler();
+
+ virtual ~DicomEventHandler();
+
+ void SubscribeSlots();
+
+ public slots:
+
+ void OnSignalAddSeriesToDataManager(const ctkEvent& ctkEvent);
+
+ void OnSignalRemoveSeriesFromStorage(const ctkEvent& ctkEvent);
+};
+#endif // QmitkDicomEventHandlerBuilder_h
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.cpp
new file mode 100644
index 0000000000..434d32dfe8
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.cpp
@@ -0,0 +1,55 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "QmitkDicomDataEventPublisher.h"
+
+#include <ctkServiceReference.h>
+#include <service/event/ctkEventAdmin.h>
+#include <service/event/ctkEvent.h>
+
+QmitkDicomDataEventPublisher::QmitkDicomDataEventPublisher()
+{
+}
+
+QmitkDicomDataEventPublisher::~QmitkDicomDataEventPublisher()
+{
+}
+
+void QmitkDicomDataEventPublisher::AddSeriesToDataManagerEvent(const ctkDictionary& properties)
+{
+ emit SignalAddSeriesToDataManager(properties);
+}
+
+void QmitkDicomDataEventPublisher::RemoveSeriesFromStorageEvent(const ctkDictionary& properties)
+{
+ emit SignalRemoveSeriesFromStorage(properties);
+}
+
+void QmitkDicomDataEventPublisher::PublishSignals(ctkPluginContext* context)
+{
+ ctkServiceReference ref = context->getServiceReference<ctkEventAdmin>();
+ if (ref)
+ {
+ ctkEventAdmin* eventAdmin = context->getService<ctkEventAdmin>(ref);
+ // Using Qt::DirectConnection is equivalent to ctkEventAdmin::sendEvent()
+ eventAdmin->publishSignal(this, SIGNAL(SignalAddSeriesToDataManager(ctkDictionary)),
+ "org/mitk/gui/qt/dicom/ADD");
+
+ eventAdmin->publishSignal(this, SIGNAL(SignalAddSeriesToDataManager(ctkDictionary)),
+ "org/mitk/gui/qt/dicom/DELETED");
+ }
+}
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.h
new file mode 100644
index 0000000000..6ec7d2be10
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.h
@@ -0,0 +1,46 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef QmitkDicomDataEventPublisher_H
+#define QmitkDicomDataEventPublisher_H
+
+#include <ctkPluginContext.h>
+#include <QObject>
+
+class QmitkDicomDataEventPublisher : public QObject
+{
+ Q_OBJECT
+ public:
+
+ QmitkDicomDataEventPublisher();
+
+ virtual ~QmitkDicomDataEventPublisher();
+
+ /// @brief sets the event admin from given plugin context
+ void PublishSignals(ctkPluginContext* context);
+
+ void AddSeriesToDataManagerEvent(const ctkDictionary& properties);
+
+ void RemoveSeriesFromStorageEvent(const ctkDictionary& properties);
+
+ signals:
+ void SignalAddSeriesToDataManager(const ctkDictionary&);
+
+ void SignalRemoveSeriesFromStorage(const ctkDictionary&);
+};
+#endif // QmitkDicomDataEventPublisher_H
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.cpp
new file mode 100644
index 0000000000..85489b35a0
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.cpp
@@ -0,0 +1,126 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "QmitkDicomDirectoryListener.h"
+
+#include <QString>
+#include <QFile>
+
+#include <QFileInfoList>
+
+QmitkDicomDirectoryListener::QmitkDicomDirectoryListener()
+: m_FileSystemWatcher(new QFileSystemWatcher())
+, m_FilesToImport(new QStringList())
+, m_ImportingFiles(new QStringList())
+, m_DicomListenerDirectory(QString())
+{
+ connect(m_FileSystemWatcher,SIGNAL(directoryChanged(const QString&)),this,SLOT(OnDirectoryChanged(const QString&)));
+}
+
+QmitkDicomDirectoryListener::~QmitkDicomDirectoryListener()
+{
+ delete m_FilesToImport;
+ delete m_ImportingFiles;
+ delete m_FileSystemWatcher;
+}
+
+
+void QmitkDicomDirectoryListener::OnDirectoryChanged(const QString&)
+{
+ //m_Mutex.lock();
+ SetFilesToImport();
+ m_ImportingFiles->append(*m_FilesToImport);
+ emit SignalAddDicomData(*m_FilesToImport);
+ //m_Mutex.unlock();
+}
+
+void QmitkDicomDirectoryListener::OnDicomImportFinished(const QStringList& finishedFiles)
+{
+ //m_Mutex.lock();
+ RemoveFilesFromDirectoryAndImportingFilesList(finishedFiles);
+ //m_Mutex.unlock();
+}
+
+void QmitkDicomDirectoryListener::SetFilesToImport()
+{
+ m_FilesToImport->clear();
+ QDir listenerDirectory(m_DicomListenerDirectory);
+ QFileInfoList entries = listenerDirectory.entryInfoList(QDir::Files);
+ if(!entries.isEmpty())
+ {
+ QFileInfoList::const_iterator file;
+ for(file = entries.constBegin(); file != entries.constEnd(); ++file )
+ {
+ if(!m_ImportingFiles->contains((*file).absoluteFilePath()))
+ {
+ m_FilesToImport->append((*file).absoluteFilePath());
+ }
+ }
+ }
+}
+
+void QmitkDicomDirectoryListener::RemoveFilesFromDirectoryAndImportingFilesList(const QStringList& files)
+{
+ QStringListIterator fileToDeleteIterator(files);
+ while(fileToDeleteIterator.hasNext())
+ {
+ QFile file(fileToDeleteIterator.next());
+ if(m_ImportingFiles->contains(file.fileName()))
+ {
+ m_ImportingFiles->removeOne(file.fileName());
+ file.remove();
+ }
+ }
+}
+
+void QmitkDicomDirectoryListener::SetDicomListenerDirectory(const QString& directory)
+{
+ if(isOnlyListenedDirectory(directory))
+ {
+ QDir listenerDirectory = QDir(directory);
+ CreateListenerDirectory(listenerDirectory);
+
+ m_DicomListenerDirectory=listenerDirectory.absolutePath();
+ m_FileSystemWatcher->addPath(m_DicomListenerDirectory);
+ }
+}
+
+const QString& QmitkDicomDirectoryListener::GetDicomListenerDirectory()
+{
+ return m_DicomListenerDirectory;
+}
+
+void QmitkDicomDirectoryListener::CreateListenerDirectory(const QDir& directory)
+{
+ if(!directory.exists())
+ {
+ directory.mkpath(directory.absolutePath());
+ }
+}
+
+bool QmitkDicomDirectoryListener::isOnlyListenedDirectory(const QString& directory)
+{
+ bool isOnlyListenedDirectory = false;
+ if(m_FileSystemWatcher->directories().count()==0||m_FileSystemWatcher->directories().count()==1)
+ {
+ if(!m_FileSystemWatcher->directories().contains(directory))
+ {
+ isOnlyListenedDirectory = true;
+ }
+ }
+ return isOnlyListenedDirectory;
+}
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.h
new file mode 100644
index 0000000000..ceed36f1f0
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.h
@@ -0,0 +1,80 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef QmitkDicomDirectoryListener_h
+#define QmitkDicomDirectoryListener_h
+
+#include<QObject>
+#include<QString>
+#include <QStringList>
+#include <QFileSystemWatcher>
+#include <QDir>
+#include <QMutex>
+
+
+#include<QTimer>
+
+class QmitkDicomDirectoryListener : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ QmitkDicomDirectoryListener();
+
+ virtual ~QmitkDicomDirectoryListener();
+
+ /// @brief sets listened directory, note that only one directory can be set.
+ void SetDicomListenerDirectory(const QString&);
+
+ /// @brief get filepath to the listened directory.
+ const QString& GetDicomListenerDirectory();
+
+signals:
+ /// @brief signal starts the dicom import of the given file (the QStringList will only contain one file here).
+ void SignalAddDicomData(const QStringList&);
+
+public slots:
+ /// \brief called when listener directory changes
+ void OnDirectoryChanged(const QString&);
+
+ /// \brief called when import is finished
+ void OnDicomImportFinished(const QStringList&);
+
+
+
+protected:
+
+ /// \brief creates directory if it's not already existing.
+ void CreateListenerDirectory(const QDir& directory);
+
+ /// \brief checks wheter the given directory is the only directory that is listened.
+ bool isOnlyListenedDirectory(const QString& directory);
+
+ /// \brief Composes the filename and initializes m_LastRetrievedFile with it
+ void SetFilesToImport();
+
+ /// \brief removes files from
+ void RemoveFilesFromDirectoryAndImportingFilesList(const QStringList& files);
+
+ QFileSystemWatcher* m_FileSystemWatcher;
+ QStringList* m_FilesToImport;
+ QStringList* m_ImportingFiles;
+ QString m_DicomListenerDirectory;
+ QMutex m_Mutex;
+};
+
+#endif // QmitkDicomListener_h
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.cpp
new file mode 100644
index 0000000000..00c7a5c4a6
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.cpp
@@ -0,0 +1,253 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+// Blueberry
+#include <berryISelectionService.h>
+#include <berryIWorkbenchWindow.h>
+#include <berryUIException.h>
+#include <berryIWorkbenchPage.h>
+#include <berryIPreferencesService.h>
+#include <berryIPartListener.h>
+#include <mitkGlobalInteraction.h>
+#include <mitkDataStorageEditorInput.h>
+#include "berryFileEditorInput.h"
+
+// Qmitk
+#include "QmitkDicomEditor.h"
+#include "mitkPluginActivator.h"
+#include <mitkDicomSeriesReader.h>
+
+//#include "mitkProgressBar.h"
+
+// Qt
+#include <QCheckBox>
+#include <QMessageBox>
+#include <QWidget>
+
+#include <QtSql>
+#include <QSqlDatabase>
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QGridLayout>
+#include <QtGui/QHeaderView>
+#include <QtGui/QPushButton>
+#include <QtGui/QTextEdit>
+#include <QtGui/QWidget>
+
+//CTK
+#include <ctkDICOMModel.h>
+#include <ctkDICOMAppWidget.h>
+#include <ctkDICOMQueryWidget.h>
+#include <ctkFileDialog.h>
+#include <ctkDICOMQueryRetrieveWidget.h>
+
+
+const std::string QmitkDicomEditor::EDITOR_ID = "org.mitk.editors.dicomeditor";
+
+
+QmitkDicomEditor::QmitkDicomEditor()
+: m_Thread(new QThread())
+, m_DicomDirectoryListener(new QmitkDicomDirectoryListener())
+, m_ListenerDirectory(new QString())
+, m_DatabaseDirectory(new QString())
+, m_PluginDirectory(new QString())
+{
+}
+
+QmitkDicomEditor::~QmitkDicomEditor()
+{
+ m_Thread->terminate();
+ delete m_Handler;
+ delete m_Publisher;
+ delete m_StoreSCPLauncher;
+ delete m_Thread;
+ delete m_DicomDirectoryListener;
+ delete m_ListenerDirectory;
+ delete m_DatabaseDirectory;
+ delete m_PluginDirectory;
+}
+
+void QmitkDicomEditor::CreateQtPartControl(QWidget *parent )
+{
+ m_Controls.setupUi( parent );
+ TestHandler();
+
+ SetPluginDirectory();
+ SetDatabaseDirectory("DatabaseDirectory");
+ SetListenerDirectory("ListenerDirectory");
+ StartDicomDirectoryListener();
+
+ m_Controls.m_ctkDICOMQueryRetrieveWidget->useProgressDialog(false);
+
+ connect(m_Controls.externalDataWidget,SIGNAL(SignalAddDicomData(const QString&)),m_Controls.internalDataWidget,SLOT(StartDicomImport(const QString&)));
+ connect(m_Controls.externalDataWidget,SIGNAL(SignalAddDicomData(const QStringList&)),m_Controls.internalDataWidget,SLOT(StartDicomImport(const QStringList&)));
+ connect(m_Controls.externalDataWidget,SIGNAL(SignalDicomToDataManager(const QStringList&)),this,SLOT(OnViewButtonAddToDataManager(const QStringList&)));
+ connect(m_Controls.externalDataWidget,SIGNAL(SignalChangePage(int)), this, SLOT(OnChangePage(int)));
+
+ connect(m_Controls.internalDataWidget,SIGNAL(FinishedImport(const QString&)),this,SLOT(OnDicomImportFinished(const QString&)));
+ connect(m_Controls.internalDataWidget,SIGNAL(FinishedImport(const QStringList&)),this,SLOT(OnDicomImportFinished(const QStringList&)));
+ connect(m_Controls.internalDataWidget,SIGNAL(SignalDicomToDataManager(const QStringList&)),this,SLOT(OnViewButtonAddToDataManager(const QStringList&)));
+
+ connect(m_Controls.CDButton, SIGNAL(clicked()), m_Controls.externalDataWidget, SLOT(OnFolderCDImport()));
+ connect(m_Controls.FolderButton, SIGNAL(clicked()), m_Controls.externalDataWidget, SLOT(OnFolderCDImport()));
+ connect(m_Controls.QueryRetrieveButton, SIGNAL(clicked()), this, SLOT(OnQueryRetrieve()));
+ connect(m_Controls.LocalStorageButton, SIGNAL(clicked()), this, SLOT(OnLocalStorage()));
+
+ //connect(m_Controls.radioButton,SIGNAL(clicked()),this,SLOT(StartStopStoreSCP()));
+}
+
+void QmitkDicomEditor::Init(berry::IEditorSite::Pointer site, berry::IEditorInput::Pointer input)
+{
+ this->SetSite(site);
+ this->SetInput(input);
+}
+
+void QmitkDicomEditor::SetFocus()
+{
+}
+
+berry::IPartListener::Events::Types QmitkDicomEditor::GetPartEventTypes() const
+{
+ return Events::CLOSED | Events::HIDDEN | Events::VISIBLE;
+}
+
+void QmitkDicomEditor::OnQueryRetrieve()
+{
+ OnChangePage(2);
+ StartStopStoreSCP();
+}
+
+void QmitkDicomEditor::OnLocalStorage()
+{
+ OnChangePage(0);
+}
+
+void QmitkDicomEditor::OnChangePage(int page)
+{
+ try{
+ m_Controls.stackedWidget->setCurrentIndex(page);
+ }catch(std::exception e){
+ MITK_ERROR <<"error: "<< e.what();
+ return;
+ }
+}
+
+void QmitkDicomEditor::OnDicomImportFinished(const QString& path)
+{
+}
+
+void QmitkDicomEditor::OnDicomImportFinished(const QStringList& path)
+{
+}
+
+void QmitkDicomEditor::StartDicomDirectoryListener()
+{
+ if(!m_Thread->isRunning())
+ {
+ m_DicomDirectoryListener->SetDicomListenerDirectory(*m_ListenerDirectory);
+ connect(m_DicomDirectoryListener,SIGNAL(SignalAddDicomData(const QStringList&)),m_Controls.internalDataWidget,SLOT(StartDicomImport(const QStringList&)),Qt::DirectConnection);
+ connect(m_Controls.internalDataWidget,SIGNAL(FinishedImport(const QStringList&)),m_DicomDirectoryListener,SLOT(OnDicomImportFinished(const QStringList&)),Qt::DirectConnection);
+ m_DicomDirectoryListener->moveToThread(m_Thread);
+ m_Thread->start();
+ }
+}
+
+//TODO Remove
+void QmitkDicomEditor::TestHandler()
+{
+ m_Handler = new DicomEventHandler();
+ m_Handler->SubscribeSlots();
+}
+
+void QmitkDicomEditor::OnViewButtonAddToDataManager(const QStringList& eventProperties)
+{
+ ctkDictionary properties;
+ properties["PatientName"] = eventProperties.at(0);
+ properties["StudyUID"] = eventProperties.at(1);
+ properties["StudyName"] = eventProperties.at(2);
+ properties["SeriesUID"] = eventProperties.at(3);
+ properties["SeriesName"] = eventProperties.at(4);
+ properties["Path"] = eventProperties.at(5);
+
+ m_Publisher = new QmitkDicomDataEventPublisher();
+ m_Publisher->PublishSignals(mitk::PluginActivator::getContext());
+
+ m_Publisher->AddSeriesToDataManagerEvent(properties);
+}
+
+
+void QmitkDicomEditor::StartStoreSCP()
+{
+ QString storagePort = m_Controls.m_ctkDICOMQueryRetrieveWidget->getServerParameters()["StoragePort"].toString();
+ QString storageAET = m_Controls.m_ctkDICOMQueryRetrieveWidget->getServerParameters()["StorageAETitle"].toString();
+ builder.AddPort(storagePort)->AddAETitle(storageAET)->AddTransferSyntax()->AddOtherNetworkOptions()->AddMode()->AddOutputDirectory(*m_ListenerDirectory);
+ m_StoreSCPLauncher = new QmitkStoreSCPLauncher(&builder);
+ m_StoreSCPLauncher->StartStoreSCP();
+ m_Controls.radioButton->setChecked(true);
+ m_Controls.radioButton->setText(storageAET+QString(" ")+storagePort);
+
+}
+
+
+void QmitkDicomEditor::StopStoreSCP()
+{
+ delete m_StoreSCPLauncher;
+ m_Controls.radioButton->setChecked(false);
+ m_Controls.radioButton->setText(QString("Storage service provider is not running!"));
+}
+
+void QmitkDicomEditor::StartStopStoreSCP()
+{
+ QString storagePort = m_Controls.m_ctkDICOMQueryRetrieveWidget->getServerParameters()["StoragePort"].toString();
+ QString storageAET = m_Controls.m_ctkDICOMQueryRetrieveWidget->getServerParameters()["StorageAETitle"].toString();
+
+ if(!((builder.GetAETitle()->compare(storageAET,Qt::CaseSensitive)==0)&&
+ (builder.GetPort()->compare(storagePort,Qt::CaseSensitive)==0)))
+ {
+ if(m_Controls.radioButton->isChecked())
+ {
+ StopStoreSCP();
+ StartStoreSCP();
+ }else{
+ StartStoreSCP();
+ }
+ }
+}
+
+void QmitkDicomEditor::SetPluginDirectory()
+{
+ mitk::PluginActivator::getContext()->getDataFile(*m_PluginDirectory);
+ m_PluginDirectory->append("/");
+}
+
+void QmitkDicomEditor::SetDatabaseDirectory(const QString& databaseDirectory)
+{
+ m_DatabaseDirectory->clear();
+ m_DatabaseDirectory->append(m_PluginDirectory);
+ m_DatabaseDirectory->append(databaseDirectory);
+ m_Controls.internalDataWidget->SetDatabaseDirectory(*m_DatabaseDirectory);
+}
+
+void QmitkDicomEditor::SetListenerDirectory(const QString& listenerDirectory)
+{
+ m_ListenerDirectory->clear();
+ m_ListenerDirectory->append(m_PluginDirectory);
+ m_ListenerDirectory->append(listenerDirectory);
+}
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.h
new file mode 100644
index 0000000000..0832f77d14
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.h
@@ -0,0 +1,140 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef QmitkDicomEditor_h
+#define QmitkDicomEditor_h
+
+#include <berryISelectionListener.h>
+#include <berryQtEditorPart.h>
+#include <berryIPartListener.h>
+
+#include "ui_QmitkDicomEditorControls.h"
+#include "QmitkDicomDirectoryListener.h"
+#include "QmitkStoreSCPLauncher.h"
+#include "QmitkStoreSCPLauncherBuilder.h"
+#include "DicomEventHandler.h"
+#include "QmitkDicomDataEventPublisher.h"
+
+#include <QTextEdit>
+#include <QModelIndex>
+#include <QString>
+#include <QMap>
+#include <QVariant>
+#include <QStringList>
+#include <QThread.h>
+#include <QProcess>
+#include <QstringList>
+#include <org_mitk_gui_qt_dicom_Export.h>
+/*!
+\brief QmitkDicomEditor
+
+\warning This class is not yet documented. Use "git blame" and ask the author to provide basic documentation.
+
+\sa QmitkFunctionality
+\ingroup ${plugin_target}_internal
+*/
+class DICOM_EXPORT QmitkDicomEditor : public berry::QtEditorPart, virtual public berry::IPartListener
+{
+ // 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:
+
+ berryObjectMacro(QmitkDicomEditor);
+ static const std::string EDITOR_ID;
+
+ QmitkDicomEditor();
+ QmitkDicomEditor(const QmitkDicomEditor& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+ virtual ~QmitkDicomEditor();
+
+ void Init(berry::IEditorSite::Pointer site, berry::IEditorInput::Pointer input);
+
+ void SetFocus();
+ void DoSave() {}
+ void DoSaveAs() {}
+ bool IsDirty() const { return false; }
+ bool IsSaveAsAllowed() const { return false; }
+
+signals:
+
+
+ protected slots:
+
+ /// \brief Called when StoreSCP shold be started or updated
+ void StartStopStoreSCP();
+
+ /// \brief Called when import is finished
+ void OnDicomImportFinished(const QString& path);
+
+ /// \brief Called when import is finished
+ void OnDicomImportFinished(const QStringList& path);
+
+ /// \brief Called when Query Retrieve or Import Folder was clicked.
+ void OnQueryRetrieve();
+
+ /// \brief Called when LocalStorageButton was clicked.
+ void OnLocalStorage();
+
+ /// \brief Called when view button is clicked. Sends out an event for adding the current selected file to the mitkDataStorage.
+ void OnViewButtonAddToDataManager(const QStringList& eventProperties);
+
+ void StartDicomDirectoryListener();
+
+ void OnChangePage(int);
+
+ void TestHandler();
+
+ void SetDatabaseDirectory(const QString& databaseDirectory);
+
+ void SetListenerDirectory(const QString& listenerDirectory);
+
+protected:
+
+ /// \brief Called when StoreSCP shold start
+ void StartStoreSCP();
+
+ /// \brief Called when StoreSCP should stop
+ void StopStoreSCP();
+
+ void CreateQtPartControl(QWidget *parent);
+
+ void QmitkDicomEditor::SetPluginDirectory();
+
+ Events::Types GetPartEventTypes() const;
+
+ Ui::QmitkDicomEditorControls m_Controls;
+
+ QThread* m_Thread;
+ QmitkDicomDirectoryListener* m_DicomDirectoryListener;
+ QmitkStoreSCPLauncherBuilder builder;
+ QmitkStoreSCPLauncher* m_StoreSCPLauncher;
+ DicomEventHandler* m_Handler;
+ QmitkDicomDataEventPublisher* m_Publisher;
+ QString* m_PluginDirectory;
+ QString* m_ListenerDirectory;
+ QString* m_DatabaseDirectory;
+
+};
+
+#endif // QmitkDicomEditor_h
+
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditorControls.ui b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditorControls.ui
new file mode 100644
index 0000000000..38fe91a59b
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditorControls.ui
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QmitkDicomEditorControls</class>
+ <widget class="QWidget" name="QmitkDicomEditorControls">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>752</width>
+ <height>696</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>QmitkTemplate</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_8">
+ <item>
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QFrame" name="frame_3">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QPushButton" name="LocalStorageButton">
+ <property name="text">
+ <string>Local Storage</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="CDButton">
+ <property name="text">
+ <string>Import CD</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="FolderButton">
+ <property name="text">
+ <string>Import Folder</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="QueryRetrieveButton">
+ <property name="text">
+ <string>Query Retrieve</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QStackedWidget" name="stackedWidget">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="page">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QmitkDicomLocalStorageWidget" name="internalDataWidget" native="true"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="importWidgetPage">
+ <layout class="QVBoxLayout" name="verticalLayout_9">
+ <item>
+ <widget class="QmitkDicomExternalDataWidget" name="externalDataWidget" native="true"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="queryRetrieveWidgetPage">
+ <layout class="QVBoxLayout" name="verticalLayout_12">
+ <item>
+ <widget class="ctkDICOMQueryRetrieveWidget" name="m_ctkDICOMQueryRetrieveWidget" native="true"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioButton">
+ <property name="toolTip">
+ <string>Switch the storage service provider (STORESCP) on or of.</string>
+ </property>
+ <property name="text">
+ <string>Storage provider is not running! </string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>ctkDICOMQueryRetrieveWidget</class>
+ <extends>QWidget</extends>
+ <header>ctkDICOMQueryRetrieveWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>QmitkDicomLocalStorageWidget</class>
+ <extends>QWidget</extends>
+ <header>Qmitk/QmitkDicomLocalStorageWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>QmitkDicomExternalDataWidget</class>
+ <extends>QWidget</extends>
+ <header>Qmitk/QmitkDicomExternalDataWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+ <slots>
+ <slot>OnChangePage(int)</slot>
+ </slots>
+</ui>
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.cpp
new file mode 100644
index 0000000000..db34660ce2
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.cpp
@@ -0,0 +1,101 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "QmitkDicomPreferencePage.h"
+#include "QmitkDicomEditor.h"
+
+#include <berryIPreferencesService.h>
+#include <berryIBerryPreferences.h>
+#include <berryPlatform.h>
+
+QmitkDicomPreferencePage::QmitkDicomPreferencePage()
+: m_MainControl(0)
+{
+
+}
+
+QmitkDicomPreferencePage::~QmitkDicomPreferencePage()
+{
+}
+
+void QmitkDicomPreferencePage::Init(berry::IWorkbench::Pointer )
+{
+
+}
+
+void QmitkDicomPreferencePage::CreateQtControl(QWidget* parent)
+{
+ berry::IPreferencesService::Pointer prefService=
+ berry::Platform::GetServiceRegistry().GetServiceById<berry::IPreferencesService>(berry::IPreferencesService::ID);
+
+ m_DicomPreferencesNode = prefService->GetSystemPreferences()->Node(QmitkDicomEditor::EDITOR_ID).Cast<berry::IBerryPreferences>();;
+ assert( m_DicomPreferencesNode );
+
+ m_MainControl = new QWidget(parent);
+ m_MainControl->setWindowTitle(QApplication::translate("DicomPreferencePage", "Form", 0, QApplication::UnicodeUTF8));
+ formLayout = new QFormLayout(m_MainControl);
+ formLayout->setObjectName(QString::fromUtf8("formLayout"));
+ formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
+ label = new QLabel(m_MainControl);
+ label->setObjectName(QString::fromUtf8("label"));
+ label->setText(QApplication::translate("DicomPreferencePage", "Database directory:", 0, QApplication::UnicodeUTF8));
+
+ formLayout->setWidget(0, QFormLayout::LabelRole, label);
+
+ DatabaseLineEdit = new QLineEdit(m_MainControl);
+ DatabaseLineEdit->setObjectName(QString::fromUtf8("DatabaseLineEdit"));
+
+ formLayout->setWidget(0, QFormLayout::FieldRole, DatabaseLineEdit);
+
+ label_2 = new QLabel(m_MainControl);
+ label_2->setObjectName(QString::fromUtf8("label_2"));
+ label_2->setText(QApplication::translate("DicomPreferencePage", "Dicom listener directory:", 0, QApplication::UnicodeUTF8));
+
+ formLayout->setWidget(1, QFormLayout::LabelRole, label_2);
+
+ ListenerLineEdit = new QLineEdit(m_MainControl);
+ ListenerLineEdit->setObjectName(QString::fromUtf8("ListenerLineEdit"));
+
+ formLayout->setWidget(1, QFormLayout::FieldRole, ListenerLineEdit);
+
+ frame = new QFrame(m_MainControl);
+ frame->setObjectName(QString::fromUtf8("frame"));
+ frame->setFrameShape(QFrame::StyledPanel);
+ frame->setFrameShadow(QFrame::Raised);
+
+ formLayout->setWidget(3, QFormLayout::FieldRole, frame);
+
+
+
+}
+
+QWidget* QmitkDicomPreferencePage::GetQtControl() const
+{
+ return m_MainControl;
+}
+
+void QmitkDicomPreferencePage::PerformCancel()
+{
+}
+
+bool QmitkDicomPreferencePage::PerformOk()
+{
+ return true;
+}
+
+void QmitkDicomPreferencePage::Update()
+{
+}
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.h
new file mode 100644
index 0000000000..5af834be5b
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.h
@@ -0,0 +1,88 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef QmitkDicomPreferencePage_h
+#define QmitkDicomPreferencePage_h
+
+#include <QString>
+#include <QStringList>
+
+#include "ui_DicomPreferencePage.h"
+#include "berryIQtPreferencePage.h"
+#include "berryIQtPreferencePage.h"
+#include <org_mitk_gui_qt_dicom_Export.h>
+#include <berryIPreferences.h>
+
+class QWidget;
+class QCheckBox;
+class QLineEdit;
+
+class DICOM_EXPORT QmitkDicomPreferencePage : public QObject, public berry::IQtPreferencePage
+{
+ Q_OBJECT
+ Q_INTERFACES(berry::IPreferencePage)
+public:
+
+ QmitkDicomPreferencePage();
+ QmitkDicomPreferencePage(const QmitkDicomPreferencePage& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+
+ virtual ~QmitkDicomPreferencePage();
+
+ void Init(berry::IWorkbench::Pointer workbench);
+
+ void CreateQtControl(QWidget* widget);
+
+ QWidget* GetQtControl() const;
+
+ ///
+ /// \see IPreferencePage::PerformOk()
+ ///
+ virtual bool PerformOk();
+
+ ///
+ /// \see IPreferencePage::PerformCancel()
+ ///
+ virtual void PerformCancel();
+
+ ///
+ /// \see IPreferencePage::Update()
+ ///
+ virtual void Update();
+
+protected:
+ QWidget* m_MainControl;
+ Ui::DicomPreferencePage* m_Controls;
+ berry::IPreferences::Pointer m_DicomPreferencesNode;
+
+ QFormLayout *formLayout;
+ QLabel *label;
+ QLineEdit *DatabaseLineEdit;
+ QLabel *label_2;
+ QLineEdit *ListenerLineEdit;
+ QFrame *frame;
+ QHBoxLayout *horizontalLayout;
+ QPushButton *pushButton;
+ QPushButton *pushButton_2;
+
+
+};
+#endif // QmitkQmitkDicomPreferencePage_h
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.cpp
new file mode 100644
index 0000000000..54dea12731
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.cpp
@@ -0,0 +1,119 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "QmitkStoreSCPLauncher.h"
+#include <QDir>
+#include <QMessageBox>
+#include <QProcessEnvironment>
+#include <mitklogmacros.h>
+//#include <QStringListIterator>
+
+QmitkStoreSCPLauncher::QmitkStoreSCPLauncher(QmitkStoreSCPLauncherBuilder* builder)
+: m_StoreSCP(new QProcess())
+{
+ connect( m_StoreSCP, SIGNAL(error(QProcess::ProcessError)),this, SLOT(OnProcessError(QProcess::ProcessError)));
+ connect( m_StoreSCP, SIGNAL(stateChanged(QProcess::ProcessState)),this, SLOT(OnStateChanged(QProcess::ProcessState)));
+ SetArgumentList(builder);
+}
+
+QmitkStoreSCPLauncher::~QmitkStoreSCPLauncher()
+{
+ m_StoreSCP->kill();
+ delete m_StoreSCP;
+}
+
+void QmitkStoreSCPLauncher::StartStoreSCP()
+{
+ QString storeSCP;
+ storeSCP.append(GetPathToExecutable());
+ storeSCP.append(QString("/storescp.exe"));
+ m_StoreSCP->start(storeSCP,m_ArgumentList);
+}
+
+QString QmitkStoreSCPLauncher::GetPathToExecutable()
+{
+ QDir root;
+ QString currentPath = root.currentPath();
+ currentPath = currentPath.split("MITK").at(0);
+ currentPath.append("MITK/CTK-build/CMakeExternals/Install/bin");
+ return currentPath;
+}
+
+void QmitkStoreSCPLauncher::OnProcessError(QProcess::ProcessError err)
+{
+ switch(err)
+ {
+ case QProcess::FailedToStart:
+ QMessageBox::information(0,"FailedToStart",QString("FailedToStart:\n").append(m_StoreSCP->errorString()));
+ break;
+ case QProcess::Crashed:
+ QMessageBox::information(0,"Crashed",QString("Crashed:\n").append(m_StoreSCP->errorString()));
+ break;
+ case QProcess::Timedout:
+ QMessageBox::information(0,"Timedout",QString("Timedout:\n").append(m_StoreSCP->errorString()));
+ break;
+ case QProcess::WriteError:
+ QMessageBox::information(0,"WriteError",QString("WriteError:\n").append(m_StoreSCP->errorString()));
+ break;
+ case QProcess::ReadError:
+ QMessageBox::information(0,"ReadError",QString("ReadError:\n").append(m_StoreSCP->errorString()));
+ break;
+ case QProcess::UnknownError:
+ QMessageBox::information(0,"UnknownError",QString("UnknownError:\n").append(m_StoreSCP->errorString()));
+ break;
+ default:
+ QMessageBox::information(0,"default",QString("default:\n").append(m_StoreSCP->errorString()));
+ break;
+ }
+}
+
+void QmitkStoreSCPLauncher::OnStateChanged(QProcess::ProcessState status)
+{
+ switch(status)
+ {
+ case QProcess::NotRunning:
+ QMessageBox::information(0,"NotRunning",QString("NotRunning:\n").append(m_StoreSCP->errorString()));
+ break;
+ case QProcess::Starting:
+ QMessageBox::information(0,"Starting",QString("Starting"));
+ break;
+ case QProcess::Running:
+ QMessageBox::information(0,"Running",QString("Running"));
+ break;
+ default:
+ QMessageBox::information(0,"default",QString("default:\n").append(m_StoreSCP->errorString()));
+ break;
+ }
+}
+
+void QmitkStoreSCPLauncher::SetArgumentList(QmitkStoreSCPLauncherBuilder* builder)
+{
+ m_ArgumentList << *builder->GetPort() << QString("-aet") <<*builder->GetAETitle() << *builder->GetTransferSyntax()
+ << *builder->GetOtherNetworkOptions() << *builder->GetMode() << QString("-od") << *builder->GetOutputDirectory();
+}
+
+QString QmitkStoreSCPLauncher::ArgumentListToQString()
+{
+ QString argumentString;
+ QStringListIterator argumentIterator(m_ArgumentList);
+ while(argumentIterator.hasNext())
+ {
+ argumentString.append(" ");
+ argumentString.append(argumentIterator.next());
+ }
+ return argumentString;
+}
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.h
new file mode 100644
index 0000000000..816c1a5392
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.h
@@ -0,0 +1,47 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef QmitkStoreSCPLauncher_h
+#define QmitkStoreSCPLauncher_h
+
+#include <QProcess>
+#include <QString>
+#include "QmitkStoreSCPLauncherBuilder.h"
+
+class QmitkStoreSCPLauncher : public QObject
+{
+ Q_OBJECT
+
+public:
+ QmitkStoreSCPLauncher(QmitkStoreSCPLauncherBuilder* builder);
+ virtual ~QmitkStoreSCPLauncher();
+
+ public slots:
+ void StartStoreSCP();
+ void OnProcessError(QProcess::ProcessError error);
+ void OnStateChanged(QProcess::ProcessState status);
+
+
+private:
+ QString GetPathToExecutable();
+ void SetArgumentList(QmitkStoreSCPLauncherBuilder* builder);
+ QString ArgumentListToQString();
+
+ QProcess* m_StoreSCP;
+ QStringList m_ArgumentList;
+};
+#endif //QmitkStoreSCPLauncher_h
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.cpp
new file mode 100644
index 0000000000..56a310cede
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.cpp
@@ -0,0 +1,109 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "QmitkStoreSCPLauncherBuilder.h"
+
+QmitkStoreSCPLauncherBuilder::QmitkStoreSCPLauncherBuilder()
+: m_Port(new QString())
+, m_AETitle(new QString())
+, m_TransferSyntax(new QString())
+, m_OtherNetworkOptions(new QString())
+, m_Mode(new QString())
+, m_OutputDirectory(new QString())
+{
+}
+
+QmitkStoreSCPLauncherBuilder::~QmitkStoreSCPLauncherBuilder()
+{
+ delete m_Port;
+ delete m_AETitle;
+ delete m_TransferSyntax;
+ delete m_OtherNetworkOptions;
+ delete m_Mode;
+ delete m_OutputDirectory;
+}
+
+QmitkStoreSCPLauncherBuilder* QmitkStoreSCPLauncherBuilder::AddPort(const QString& port)
+{
+ m_Port->clear();
+ m_Port->append(port);
+ return this;
+}
+
+QmitkStoreSCPLauncherBuilder* QmitkStoreSCPLauncherBuilder::AddAETitle(const QString& aeTitle)
+{
+ m_AETitle->clear();
+ m_AETitle->append(aeTitle);
+ return this;
+}
+
+QmitkStoreSCPLauncherBuilder* QmitkStoreSCPLauncherBuilder::AddTransferSyntax(const QString& transferSyntax)
+{
+ m_TransferSyntax->clear();
+ m_TransferSyntax->append(transferSyntax);
+ return this;
+}
+
+QmitkStoreSCPLauncherBuilder* QmitkStoreSCPLauncherBuilder::AddOtherNetworkOptions(const QString& otherNetworkOptions)
+{
+ m_OtherNetworkOptions->clear();
+ m_OtherNetworkOptions->append(otherNetworkOptions);
+ return this;
+}
+
+QmitkStoreSCPLauncherBuilder* QmitkStoreSCPLauncherBuilder::AddMode(const QString& mode)
+{
+ m_Mode->clear();
+ m_Mode->append(mode);
+ return this;
+}
+
+QmitkStoreSCPLauncherBuilder* QmitkStoreSCPLauncherBuilder::AddOutputDirectory(const QString& outputDirectory)
+{
+ m_OutputDirectory->clear();
+ m_OutputDirectory->append(outputDirectory);
+ return this;
+}
+
+QString* QmitkStoreSCPLauncherBuilder::GetPort()
+{
+ return m_Port;
+}
+
+QString* QmitkStoreSCPLauncherBuilder::GetAETitle()
+{
+ return m_AETitle;
+}
+
+QString* QmitkStoreSCPLauncherBuilder::GetTransferSyntax()
+{
+ return m_TransferSyntax;
+}
+
+QString* QmitkStoreSCPLauncherBuilder::GetOtherNetworkOptions()
+{
+ return m_OtherNetworkOptions;
+}
+
+QString* QmitkStoreSCPLauncherBuilder::GetMode()
+{
+ return m_Mode;
+}
+
+QString* QmitkStoreSCPLauncherBuilder::GetOutputDirectory()
+{
+ return m_OutputDirectory;
+}
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.h
new file mode 100644
index 0000000000..decbc6150b
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.h
@@ -0,0 +1,53 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef QmitkStoreSCPLauncherBuilder_h
+#define QmitkStoreSCPLauncherBuilder_h
+
+#include <QString>
+#include <QObject>
+
+class QmitkStoreSCPLauncherBuilder : public QObject
+{
+ Q_OBJECT
+
+public:
+ QmitkStoreSCPLauncherBuilder();
+ virtual ~QmitkStoreSCPLauncherBuilder();
+ QmitkStoreSCPLauncherBuilder* AddPort(const QString& port = QString("105"));
+ QmitkStoreSCPLauncherBuilder* AddAETitle(const QString& aeTitle = QString("STORESCP"));
+ QmitkStoreSCPLauncherBuilder* AddTransferSyntax(const QString& transferSyntax = QString("+x="));
+ QmitkStoreSCPLauncherBuilder* AddOtherNetworkOptions(const QString& otherNetworkOptions = QString("-pm"));
+ QmitkStoreSCPLauncherBuilder* AddMode(const QString& mode = QString("-d"));
+ QmitkStoreSCPLauncherBuilder* AddOutputDirectory(const QString& outputDirectory);
+
+ QString* GetPort();
+ QString* GetAETitle();
+ QString* GetTransferSyntax();
+ QString* GetOtherNetworkOptions();
+ QString* GetMode();
+ QString* GetOutputDirectory();
+
+private:
+ QString* m_Port;
+ QString* m_AETitle;
+ QString* m_TransferSyntax;
+ QString* m_OtherNetworkOptions;
+ QString* m_Mode;
+ QString* m_OutputDirectory;
+};
+#endif QmitkStoreSCPLauncherBuilder_h
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..ea1612c721
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,49 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#include "mitkPluginActivator.h"
+
+#include <QtPlugin>
+
+#include "QmitkDicomEditor.h"
+//#include "QmitkDicomPreferencePage.h"
+
+namespace mitk {
+
+ctkPluginContext* PluginActivator::pluginContext = 0;
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkDicomEditor, context)
+ //BERRY_REGISTER_EXTENSION_CLASS(QmitkDicomPreferencePage, context)
+ pluginContext = context;
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+ pluginContext = NULL;
+}
+ctkPluginContext* PluginActivator::getContext()
+{
+ return pluginContext;
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_dicom, mitk::PluginActivator)
diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..a9bdd73875
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.h
@@ -0,0 +1,43 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+ static ctkPluginContext* getContext();
+private:
+ static ctkPluginContext* pluginContext;
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
diff --git a/Plugins/org.mitk.gui.qt.ext/files.cmake b/Plugins/org.mitk.gui.qt.ext/files.cmake
index c4efc7d27d..329cd8e3d7 100644
--- a/Plugins/org.mitk.gui.qt.ext/files.cmake
+++ b/Plugins/org.mitk.gui.qt.ext/files.cmake
@@ -1,51 +1,53 @@
set(SRC_CPP_FILES
QmitkExtActionBarAdvisor.cpp
QmitkExtWorkbenchWindowAdvisor.cpp
QmitkExtFileSaveProjectAction.cpp
+ QmitkOpenDicomEditorAction.cpp
)
set(INTERNAL_CPP_FILES
QmitkAppInstancesPreferencePage.cpp
QmitkCommonExtPlugin.cpp
QmitkInputDevicesPrefPage.cpp
QmitkModuleView.cpp
)
set(UI_FILES
src/internal/QmitkAppInstancesPreferencePage.ui
)
set(MOC_H_FILES
src/QmitkExtFileSaveProjectAction.h
src/QmitkExtWorkbenchWindowAdvisor.h
src/internal/QmitkAppInstancesPreferencePage.h
src/internal/QmitkCommonExtPlugin.h
src/internal/QmitkExtWorkbenchWindowAdvisorHack.h
src/internal/QmitkInputDevicesPrefPage.h
src/internal/QmitkModuleView.h
+ src/QmitkOpenDicomEditorAction.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
)
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/src/QmitkExtWorkbenchWindowAdvisor.cpp b/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
index b13dc5569f..669ee3d706 100644
--- a/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
+++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
@@ -1,1147 +1,1153 @@
/*===================================================================
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 "QmitkExtWorkbenchWindowAdvisor.h"
#include "QmitkExtActionBarAdvisor.h"
#include <QMenu>
#include <QMenuBar>
#include <QMainWindow>
#include <QStatusBar>
#include <QString>
#include <QFile>
#include <QRegExp>
#include <QTextStream>
#include <QSettings>
#include <ctkPluginException.h>
#include <service/event/ctkEventAdmin.h>
#include <berryPlatform.h>
#include <berryPlatformUI.h>
#include <berryIWorkbenchWindow.h>
#include <berryIWorkbenchPage.h>
#include <berryIPreferencesService.h>
#include <berryIPerspectiveRegistry.h>
#include <berryIPerspectiveDescriptor.h>
#include <berryIWorkbenchPartConstants.h>
#include <internal/berryQtShowViewAction.h>
#include <internal/berryQtOpenPerspectiveAction.h>
#include <QmitkFileOpenAction.h>
#include <QmitkExtFileSaveProjectAction.h>
#include <QmitkFileExitAction.h>
#include <QmitkCloseProjectAction.h>
#include <QmitkDefaultDropTargetListener.h>
#include <QmitkStatusBar.h>
#include <QmitkProgressBar.h>
#include <QmitkMemoryUsageIndicatorView.h>
#include <QmitkPreferencesDialog.h>
+#include <QmitkOpenDicomEditorAction.h>
#include <itkConfigure.h>
#include <vtkConfigure.h>
#include <mitkVersion.h>
// UGLYYY
#include "internal/QmitkExtWorkbenchWindowAdvisorHack.h"
#include "internal/QmitkCommonExtPlugin.h"
#include "mitkUndoController.h"
#include "mitkVerboseLimitedLinearUndo.h"
#include <QToolBar>
#include <QMessageBox>
#include <QLabel>
#include <QmitkAboutDialog/QmitkAboutDialog.h>
QmitkExtWorkbenchWindowAdvisorHack
* QmitkExtWorkbenchWindowAdvisorHack::undohack =
new QmitkExtWorkbenchWindowAdvisorHack();
QString QmitkExtWorkbenchWindowAdvisor::QT_SETTINGS_FILENAME = "QtSettings.ini";
class PartListenerForTitle: public berry::IPartListener
{
public:
PartListenerForTitle(QmitkExtWorkbenchWindowAdvisor* wa) :
windowAdvisor(wa)
{
}
Events::Types GetPartEventTypes() const
{
return Events::ACTIVATED | Events::BROUGHT_TO_TOP | Events::CLOSED
| Events::HIDDEN | Events::VISIBLE;
}
void PartActivated(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref.Cast<berry::IEditorReference> ())
{
windowAdvisor->UpdateTitle(false);
}
}
void PartBroughtToTop(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref.Cast<berry::IEditorReference> ())
{
windowAdvisor->UpdateTitle(false);
}
}
void PartClosed(berry::IWorkbenchPartReference::Pointer /*ref*/)
{
windowAdvisor->UpdateTitle(false);
}
void PartHidden(berry::IWorkbenchPartReference::Pointer ref)
{
if (!windowAdvisor->lastActiveEditor.Expired() &&
ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock())
{
windowAdvisor->UpdateTitle(true);
}
}
void PartVisible(berry::IWorkbenchPartReference::Pointer ref)
{
if (!windowAdvisor->lastActiveEditor.Expired() &&
ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock())
{
windowAdvisor->UpdateTitle(false);
}
}
private:
QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
};
class PartListenerForImageNavigator: public berry::IPartListener
{
public:
PartListenerForImageNavigator(QAction* act) :
imageNavigatorAction(act)
{
}
Events::Types GetPartEventTypes() const
{
return Events::OPENED | Events::CLOSED | Events::HIDDEN |
Events::VISIBLE;
}
void PartOpened(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(true);
}
}
void PartClosed(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(false);
}
}
void PartVisible(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(true);
}
}
void PartHidden(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(false);
}
}
private:
QAction* imageNavigatorAction;
};
class PerspectiveListenerForTitle: public berry::IPerspectiveListener
{
public:
PerspectiveListenerForTitle(QmitkExtWorkbenchWindowAdvisor* wa) :
windowAdvisor(wa), perspectivesClosed(false)
{
}
Events::Types GetPerspectiveEventTypes() const
{
return Events::ACTIVATED | Events::SAVED_AS | Events::DEACTIVATED
// remove the following line when command framework is finished
| Events::CLOSED | Events::OPENED;
}
void PerspectiveActivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
windowAdvisor->UpdateTitle(false);
}
void PerspectiveSavedAs(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*oldPerspective*/,
berry::IPerspectiveDescriptor::Pointer /*newPerspective*/)
{
windowAdvisor->UpdateTitle(false);
}
void PerspectiveDeactivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
windowAdvisor->UpdateTitle(false);
}
void PerspectiveOpened(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
if (perspectivesClosed)
{
QListIterator<QAction*> i(windowAdvisor->viewActions);
while (i.hasNext())
{
i.next()->setEnabled(true);
}
-
+ windowAdvisor->openDicomEditorAction->setEnabled(true);
windowAdvisor->fileSaveProjectAction->setEnabled(true);
windowAdvisor->closeProjectAction->setEnabled(true);
windowAdvisor->undoAction->setEnabled(true);
windowAdvisor->redoAction->setEnabled(true);
windowAdvisor->imageNavigatorAction->setEnabled(true);
windowAdvisor->resetPerspAction->setEnabled(true);
if( windowAdvisor->GetShowClosePerspectiveMenuItem() )
{
windowAdvisor->closePerspAction->setEnabled(true);
}
}
perspectivesClosed = false;
}
void PerspectiveClosed(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
berry::IWorkbenchWindow::Pointer wnd = windowAdvisor->GetWindowConfigurer()->GetWindow();
bool allClosed = true;
if (wnd->GetActivePage())
{
std::vector<berry::IPerspectiveDescriptor::Pointer> perspectives(wnd->GetActivePage()->GetOpenPerspectives());
allClosed = perspectives.empty();
}
if (allClosed)
{
perspectivesClosed = true;
QListIterator<QAction*> i(windowAdvisor->viewActions);
while (i.hasNext())
{
i.next()->setEnabled(false);
}
+ windowAdvisor->openDicomEditorAction->setEnabled(false);
windowAdvisor->fileSaveProjectAction->setEnabled(false);
windowAdvisor->closeProjectAction->setEnabled(false);
windowAdvisor->undoAction->setEnabled(false);
windowAdvisor->redoAction->setEnabled(false);
windowAdvisor->imageNavigatorAction->setEnabled(false);
windowAdvisor->resetPerspAction->setEnabled(false);
if( windowAdvisor->GetShowClosePerspectiveMenuItem() )
{
windowAdvisor->closePerspAction->setEnabled(false);
}
}
}
private:
QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
bool perspectivesClosed;
};
class PerspectiveListenerForMenu: public berry::IPerspectiveListener
{
public:
PerspectiveListenerForMenu(QmitkExtWorkbenchWindowAdvisor* wa) :
windowAdvisor(wa)
{
}
Events::Types GetPerspectiveEventTypes() const
{
return Events::ACTIVATED | Events::DEACTIVATED;
}
void PerspectiveActivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer perspective)
{
QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
if (action)
{
action->setChecked(true);
}
}
void PerspectiveDeactivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer perspective)
{
QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
if (action)
{
action->setChecked(false);
}
}
private:
QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
};
QmitkExtWorkbenchWindowAdvisor::QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor,
berry::IWorkbenchWindowConfigurer::Pointer configurer) :
berry::WorkbenchWindowAdvisor(configurer),
lastInput(0),
wbAdvisor(wbAdvisor),
showViewToolbar(true),
showPerspectiveToolbar(false),
showVersionInfo(true),
showMitkVersionInfo(true),
showViewMenuItem(true),
showNewWindowMenuItem(false),
showClosePerspectiveMenuItem(true),
dropTargetListener(new QmitkDefaultDropTargetListener)
{
productName = berry::Platform::GetConfiguration().getString("application.baseName");
}
berry::ActionBarAdvisor::Pointer QmitkExtWorkbenchWindowAdvisor::CreateActionBarAdvisor(
berry::IActionBarConfigurer::Pointer configurer)
{
berry::ActionBarAdvisor::Pointer actionBarAdvisor(
new QmitkExtActionBarAdvisor(configurer));
return actionBarAdvisor;
}
void* QmitkExtWorkbenchWindowAdvisor::CreateEmptyWindowContents(void* parent)
{
QWidget* parentWidget = static_cast<QWidget*>(parent);
QLabel* label = new QLabel(parentWidget);
label->setText("<b>No perspectives are open. Open a perspective in the <i>Window->Open Perspective</i> menu.</b>");
label->setContentsMargins(10,10,10,10);
label->setAlignment(Qt::AlignTop);
label->setEnabled(false);
parentWidget->layout()->addWidget(label);
return label;
}
void QmitkExtWorkbenchWindowAdvisor::ShowClosePerspectiveMenuItem(bool show)
{
showClosePerspectiveMenuItem = show;
}
bool QmitkExtWorkbenchWindowAdvisor::GetShowClosePerspectiveMenuItem()
{
return showClosePerspectiveMenuItem;
}
void QmitkExtWorkbenchWindowAdvisor::ShowNewWindowMenuItem(bool show)
{
showNewWindowMenuItem = show;
}
void QmitkExtWorkbenchWindowAdvisor::ShowViewToolbar(bool show)
{
showViewToolbar = show;
}
void QmitkExtWorkbenchWindowAdvisor::ShowViewMenuItem(bool show)
{
showViewMenuItem = show;
}
void QmitkExtWorkbenchWindowAdvisor::ShowPerspectiveToolbar(bool show)
{
showPerspectiveToolbar = show;
}
void QmitkExtWorkbenchWindowAdvisor::ShowVersionInfo(bool show)
{
showVersionInfo = show;
}
void QmitkExtWorkbenchWindowAdvisor::ShowMitkVersionInfo(bool show)
{
showMitkVersionInfo = show;
}
void QmitkExtWorkbenchWindowAdvisor::SetProductName(const std::string& product)
{
productName = product;
}
void QmitkExtWorkbenchWindowAdvisor::SetWindowIcon(const std::string& wndIcon)
{
windowIcon = wndIcon;
}
void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate()
{
// very bad hack...
berry::IWorkbenchWindow::Pointer window =
this->GetWindowConfigurer()->GetWindow();
QMainWindow* mainWindow =
static_cast<QMainWindow*> (window->GetShell()->GetControl());
if (!windowIcon.empty())
{
mainWindow->setWindowIcon(QIcon(QString::fromStdString(windowIcon)));
}
mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);
/*mainWindow->setStyleSheet("color: white;"
"background-color: #808080;"
"selection-color: #659EC7;"
"selection-background-color: #808080;"
" QMenuBar {"
"background-color: #808080; }");*/
// ==== Application menu ============================
QMenuBar* menuBar = mainWindow->menuBar();
menuBar->setContextMenuPolicy(Qt::PreventContextMenu);
QMenu* fileMenu = menuBar->addMenu("&File");
fileMenu->setObjectName("FileMenu");
QAction* fileOpenAction = new QmitkFileOpenAction(QIcon(":/org.mitk.gui.qt.ext/Load_48.png"), window);
fileMenu->addAction(fileOpenAction);
fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
fileSaveProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"));
fileMenu->addAction(fileSaveProjectAction);
closeProjectAction = new QmitkCloseProjectAction(window);
closeProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Remove_48.png"));
fileMenu->addAction(closeProjectAction);
fileMenu->addSeparator();
QAction* fileExitAction = new QmitkFileExitAction(window);
fileExitAction->setObjectName("QmitkFileExitAction");
fileMenu->addAction(fileExitAction);
+ QAction* openDicomEditorAction = new QmitkOpenDicomEditorAction(QIcon(":/org.mitk.editors.dicomeditor/resources/icon.xpm"), window);
+ fileMenu->addAction(openDicomEditorAction);
+
berry::IViewRegistry* viewRegistry =
berry::PlatformUI::GetWorkbench()->GetViewRegistry();
const std::vector<berry::IViewDescriptor::Pointer>& viewDescriptors =
viewRegistry->GetViews();
// another bad hack to get an edit/undo menu...
QMenu* editMenu = menuBar->addMenu("&Edit");
undoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Undo_48.png"),
"&Undo",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
QKeySequence("CTRL+Z"));
undoAction->setToolTip("Undo the last action (not supported by all modules)");
redoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Redo_48.png")
, "&Redo",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
QKeySequence("CTRL+Y"));
redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");
imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", NULL);
bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator");
if (imageNavigatorViewFound)
{
QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
imageNavigatorAction->setCheckable(true);
// add part listener for image navigator
imageNavigatorPartListener = new PartListenerForImageNavigator(imageNavigatorAction);
window->GetPartService()->AddPartListener(imageNavigatorPartListener);
berry::IViewPart::Pointer imageNavigatorView =
window->GetActivePage()->FindView("org.mitk.views.imagenavigator");
imageNavigatorAction->setChecked(false);
if (imageNavigatorView)
{
bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
if (isImageNavigatorVisible)
imageNavigatorAction->setChecked(true);
}
imageNavigatorAction->setToolTip("Open image navigator for navigating through image");
}
// toolbar for showing file open, undo, redo and other main actions
QToolBar* mainActionsToolBar = new QToolBar;
mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef __APPLE__
mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
#else
mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
#endif
mainActionsToolBar->addAction(fileOpenAction);
mainActionsToolBar->addAction(fileSaveProjectAction);
mainActionsToolBar->addAction(closeProjectAction);
mainActionsToolBar->addAction(undoAction);
mainActionsToolBar->addAction(redoAction);
+ mainActionsToolBar->addAction(openDicomEditorAction);
if (imageNavigatorViewFound)
{
mainActionsToolBar->addAction(imageNavigatorAction);
}
mainWindow->addToolBar(mainActionsToolBar);
#ifdef __APPLE__
mainWindow->setUnifiedTitleAndToolBarOnMac(true);
#endif
// ==== Window Menu ==========================
QMenu* windowMenu = menuBar->addMenu("Window");
if (showNewWindowMenuItem)
{
windowMenu->addAction("&New Window", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow()));
windowMenu->addSeparator();
}
QMenu* perspMenu = windowMenu->addMenu("&Open Perspective");
QMenu* viewMenu;
if (showViewMenuItem)
{
viewMenu = windowMenu->addMenu("Show &View");
viewMenu->setObjectName("Show View");
}
windowMenu->addSeparator();
resetPerspAction = windowMenu->addAction("&Reset Perspective",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective()));
if(showClosePerspectiveMenuItem)
closePerspAction = windowMenu->addAction("&Close Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective()));
windowMenu->addSeparator();
windowMenu->addAction("&Preferences...",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()),
QKeySequence("CTRL+P"));
// fill perspective menu
berry::IPerspectiveRegistry* perspRegistry =
window->GetWorkbench()->GetPerspectiveRegistry();
QActionGroup* perspGroup = new QActionGroup(menuBar);
std::vector<berry::IPerspectiveDescriptor::Pointer> perspectives(
perspRegistry->GetPerspectives());
bool skip = false;
for (std::vector<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt =
perspectives.begin(); perspIt != perspectives.end(); ++perspIt)
{
// if perspectiveExcludeList is set, it contains the id-strings of perspectives, which
// should not appear as an menu-entry in the perspective menu
if (perspectiveExcludeList.size() > 0)
{
for (unsigned int i=0; i<perspectiveExcludeList.size(); i++)
{
if (perspectiveExcludeList.at(i) == (*perspIt)->GetId())
{
skip = true;
break;
}
}
if (skip)
{
skip = false;
continue;
}
}
QAction* perspAction = new berry::QtOpenPerspectiveAction(window,
*perspIt, perspGroup);
mapPerspIdToAction.insert(std::make_pair((*perspIt)->GetId(), perspAction));
}
perspMenu->addActions(perspGroup->actions());
// sort elements (converting vector to map...)
std::vector<berry::IViewDescriptor::Pointer>::const_iterator iter;
std::map<std::string, berry::IViewDescriptor::Pointer> VDMap;
skip = false;
for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
{
// if viewExcludeList is set, it contains the id-strings of view, which
// should not appear as an menu-entry in the menu
if (viewExcludeList.size() > 0)
{
for (unsigned int i=0; i<viewExcludeList.size(); i++)
{
if (viewExcludeList.at(i) == (*iter)->GetId())
{
skip = true;
break;
}
}
if (skip)
{
skip = false;
continue;
}
}
if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
continue;
if ((*iter)->GetId() == "org.mitk.views.imagenavigator")
continue;
std::pair<std::string, berry::IViewDescriptor::Pointer> p(
(*iter)->GetLabel(), (*iter));
VDMap.insert(p);
}
// ==================================================
// ==== Perspective Toolbar ==================================
QToolBar* qPerspectiveToolbar = new QToolBar;
if (showPerspectiveToolbar)
{
qPerspectiveToolbar->addActions(perspGroup->actions());
mainWindow->addToolBar(qPerspectiveToolbar);
}
else
delete qPerspectiveToolbar;
// ==== View Toolbar ==================================
QToolBar* qToolbar = new QToolBar;
std::map<std::string, berry::IViewDescriptor::Pointer>::const_iterator
MapIter;
for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
{
berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window,
(*MapIter).second);
viewActions.push_back(viewAction);
if(showViewMenuItem)
viewMenu->addAction(viewAction);
if (showViewToolbar)
{
qToolbar->addAction(viewAction);
}
}
if (showViewToolbar)
{
mainWindow->addToolBar(qToolbar);
}
else
delete qToolbar;
QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray());
// ====================================================
// ===== Help menu ====================================
QMenu* helpMenu = menuBar->addMenu("Help");
helpMenu->addAction("&Welcome",this, SLOT(onIntro()));
helpMenu->addAction("&Contents", this, SLOT(onHelpContents()));
helpMenu->addAction("Context &Help",this, SLOT(onHelp()), QKeySequence("F1"));
helpMenu->addAction("&About",this, SLOT(onAbout()));
// =====================================================
QStatusBar* qStatusBar = new QStatusBar();
//creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
QmitkStatusBar *statusBar = new QmitkStatusBar(qStatusBar);
//disabling the SizeGrip in the lower right corner
statusBar->SetSizeGripEnabled(false);
QmitkProgressBar *progBar = new QmitkProgressBar();
qStatusBar->addPermanentWidget(progBar, 0);
progBar->hide();
// progBar->AddStepsToDo(2);
// progBar->Progress(1);
mainWindow->setStatusBar(qStatusBar);
QmitkMemoryUsageIndicatorView* memoryIndicator =
new QmitkMemoryUsageIndicatorView();
qStatusBar->addPermanentWidget(memoryIndicator, 0);
}
void QmitkExtWorkbenchWindowAdvisor::PreWindowOpen()
{
berry::IWorkbenchWindowConfigurer::Pointer configurer = GetWindowConfigurer();
// show the shortcut bar and progress indicator, which are hidden by
// default
//configurer->SetShowPerspectiveBar(true);
//configurer->SetShowFastViewBars(true);
//configurer->SetShowProgressIndicator(true);
// // add the drag and drop support for the editor area
// configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance());
// configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
// configurer.addEditorAreaTransfer(FileTransfer.getInstance());
// configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
// configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(
// configurer.getWindow()));
this->HookTitleUpdateListeners(configurer);
menuPerspectiveListener = new PerspectiveListenerForMenu(this);
configurer->GetWindow()->AddPerspectiveListener(menuPerspectiveListener);
configurer->AddEditorAreaTransfer(QStringList("text/uri-list"));
configurer->ConfigureEditorAreaDropListener(dropTargetListener);
}
void QmitkExtWorkbenchWindowAdvisor::onIntro()
{
QmitkExtWorkbenchWindowAdvisorHack::undohack->onIntro();
}
void QmitkExtWorkbenchWindowAdvisor::onHelp()
{
QmitkExtWorkbenchWindowAdvisorHack::undohack->onHelp();
}
void QmitkExtWorkbenchWindowAdvisor::onHelpContents()
{
QmitkExtWorkbenchWindowAdvisorHack::undohack->onHelpContents();
}
void QmitkExtWorkbenchWindowAdvisor::onAbout()
{
QmitkExtWorkbenchWindowAdvisorHack::undohack->onAbout();
}
//--------------------------------------------------------------------------------
// Ugly hack from here on. Feel free to delete when command framework
// and undo buttons are done.
//--------------------------------------------------------------------------------
QmitkExtWorkbenchWindowAdvisorHack::QmitkExtWorkbenchWindowAdvisorHack() : QObject()
{
}
QmitkExtWorkbenchWindowAdvisorHack::~QmitkExtWorkbenchWindowAdvisorHack()
{
}
void QmitkExtWorkbenchWindowAdvisorHack::onUndo()
{
mitk::UndoModel* model = mitk::UndoController::GetCurrentUndoModel();
if (model)
{
if (mitk::VerboseLimitedLinearUndo* verboseundo = dynamic_cast<mitk::VerboseLimitedLinearUndo*>( model ))
{
mitk::VerboseLimitedLinearUndo::StackDescription descriptions =
verboseundo->GetUndoDescriptions();
if (descriptions.size() >= 1)
{
MITK_INFO << "Undo " << descriptions.front().second;
}
}
model->Undo();
}
else
{
MITK_ERROR << "No undo model instantiated";
}
}
void QmitkExtWorkbenchWindowAdvisorHack::onRedo()
{
mitk::UndoModel* model = mitk::UndoController::GetCurrentUndoModel();
if (model)
{
if (mitk::VerboseLimitedLinearUndo* verboseundo = dynamic_cast<mitk::VerboseLimitedLinearUndo*>( model ))
{
mitk::VerboseLimitedLinearUndo::StackDescription descriptions =
verboseundo->GetRedoDescriptions();
if (descriptions.size() >= 1)
{
MITK_INFO << "Redo " << descriptions.front().second;
}
}
model->Redo();
}
else
{
MITK_ERROR << "No undo model instantiated";
}
}
void QmitkExtWorkbenchWindowAdvisorHack::onImageNavigator()
{
// get ImageNavigatorView
berry::IViewPart::Pointer imageNavigatorView =
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->FindView("org.mitk.views.imagenavigator");
if (imageNavigatorView)
{
bool isImageNavigatorVisible = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->IsPartVisible(imageNavigatorView);
if (isImageNavigatorVisible)
{
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->HideView(imageNavigatorView);
return;
}
}
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ShowView("org.mitk.views.imagenavigator");
//berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ResetPerspective();
}
void QmitkExtWorkbenchWindowAdvisorHack::onEditPreferences()
{
QmitkPreferencesDialog _PreferencesDialog(QApplication::activeWindow());
_PreferencesDialog.exec();
}
void QmitkExtWorkbenchWindowAdvisorHack::onQuit()
{
berry::PlatformUI::GetWorkbench()->Close();
}
void QmitkExtWorkbenchWindowAdvisorHack::onResetPerspective()
{
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ResetPerspective();
}
void QmitkExtWorkbenchWindowAdvisorHack::onClosePerspective()
{
berry::IWorkbenchPage::Pointer
page =
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage();
page->ClosePerspective(page->GetPerspective(), true, true);
}
void QmitkExtWorkbenchWindowAdvisorHack::onNewWindow()
{
berry::PlatformUI::GetWorkbench()->OpenWorkbenchWindow(0);
}
void QmitkExtWorkbenchWindowAdvisorHack::onIntro()
{
bool hasIntro =
berry::PlatformUI::GetWorkbench()->GetIntroManager()->HasIntro();
if (!hasIntro)
{
QRegExp reg("(.*)<title>(\\n)*");
QRegExp reg2("(\\n)*</title>(.*)");
QFile file(":/org.mitk.gui.qt.ext/index.html");
file.open(QIODevice::ReadOnly | QIODevice::Text); // Als Text-Datei nur zum Lesen öffnen
QString text = QString(file.readAll());
file.close();
QString title = text;
title.replace(reg, "");
title.replace(reg2, "");
std::cout << title.toStdString() << std::endl;
QMessageBox::information(NULL, title,
text, "Close");
}
else
{
berry::PlatformUI::GetWorkbench()->GetIntroManager()->ShowIntro(
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow(), false);
}
}
void QmitkExtWorkbenchWindowAdvisorHack::onHelp()
{
ctkPluginContext* context = QmitkCommonExtPlugin::getContext();
if (context == 0)
{
MITK_WARN << "Plugin context not set, unable to open context help";
return;
}
// Check if the org.blueberry.ui.qt.help plug-in is installed and started
QList<QSharedPointer<ctkPlugin> > plugins = context->getPlugins();
foreach(QSharedPointer<ctkPlugin> p, plugins)
{
if (p->getSymbolicName() == "org.blueberry.ui.qt.help")
{
if (p->getState() != ctkPlugin::ACTIVE)
{
// try to activate the plug-in explicitly
try
{
p->start(ctkPlugin::START_TRANSIENT);
}
catch (const ctkPluginException& pe)
{
MITK_ERROR << "Activating org.blueberry.ui.qt.help failed: " << pe.what();
return;
}
}
}
}
ctkServiceReference eventAdminRef = context->getServiceReference<ctkEventAdmin>();
ctkEventAdmin* eventAdmin = 0;
if (eventAdminRef)
{
eventAdmin = context->getService<ctkEventAdmin>(eventAdminRef);
}
if (eventAdmin == 0)
{
MITK_WARN << "ctkEventAdmin service not found. Unable to open context help";
}
else
{
ctkEvent ev("org/blueberry/ui/help/CONTEXTHELP_REQUESTED");
eventAdmin->postEvent(ev);
}
}
void QmitkExtWorkbenchWindowAdvisorHack::onHelpContents()
{
berry::PlatformUI::GetWorkbench()->ShowPerspective("org.blueberry.perspectives.help",
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow());
}
void QmitkExtWorkbenchWindowAdvisorHack::onAbout()
{
QmitkAboutDialog* aboutDialog = new QmitkAboutDialog(QApplication::activeWindow(),NULL);
aboutDialog->open();
}
void QmitkExtWorkbenchWindowAdvisor::HookTitleUpdateListeners(
berry::IWorkbenchWindowConfigurer::Pointer configurer)
{
// hook up the listeners to update the window title
titlePartListener = new PartListenerForTitle(this);
titlePerspectiveListener = new PerspectiveListenerForTitle(this);
editorPropertyListener = new berry::PropertyChangeIntAdapter<
QmitkExtWorkbenchWindowAdvisor>(this,
&QmitkExtWorkbenchWindowAdvisor::PropertyChange);
// configurer.getWindow().addPageListener(new IPageListener() {
// public void pageActivated(IWorkbenchPage page) {
// updateTitle(false);
// }
//
// public void pageClosed(IWorkbenchPage page) {
// updateTitle(false);
// }
//
// public void pageOpened(IWorkbenchPage page) {
// // do nothing
// }
// });
configurer->GetWindow()->AddPerspectiveListener(titlePerspectiveListener);
configurer->GetWindow()->GetPartService()->AddPartListener(titlePartListener);
}
std::string QmitkExtWorkbenchWindowAdvisor::ComputeTitle()
{
berry::IWorkbenchWindowConfigurer::Pointer configurer =
GetWindowConfigurer();
berry::IWorkbenchPage::Pointer currentPage =
configurer->GetWindow()->GetActivePage();
berry::IEditorPart::Pointer activeEditor;
if (currentPage)
{
activeEditor = lastActiveEditor.Lock();
}
std::string title;
//TODO Product
// IProduct product = Platform.getProduct();
// if (product != null) {
// title = product.getName();
// }
// instead of the product name, we use a custom variable for now
title = productName;
if(showMitkVersionInfo)
{
title += std::string(" ") + MITK_VERSION_STRING;
}
if (showVersionInfo)
{
// add version informatioin
QString versions = QString(" (ITK %1.%2.%3 VTK %4.%5.%6 Qt %7 MITK %8)")
.arg(ITK_VERSION_MAJOR).arg(ITK_VERSION_MINOR).arg(ITK_VERSION_PATCH)
.arg(VTK_MAJOR_VERSION).arg(VTK_MINOR_VERSION).arg(VTK_BUILD_VERSION)
.arg(QT_VERSION_STR)
.arg(MITK_VERSION_STRING);
title += versions.toStdString();
}
if (currentPage)
{
if (activeEditor)
{
lastEditorTitle = activeEditor->GetTitleToolTip();
if (!lastEditorTitle.empty())
title = lastEditorTitle + " - " + title;
}
berry::IPerspectiveDescriptor::Pointer persp =
currentPage->GetPerspective();
std::string label = "";
if (persp)
{
label = persp->GetLabel();
}
berry::IAdaptable* input = currentPage->GetInput();
if (input && input != wbAdvisor->GetDefaultPageInput())
{
label = currentPage->GetLabel();
}
if (!label.empty())
{
title = label + " - " + title;
}
}
title += " (Not for use in diagnosis or treatment of patients)";
return title;
}
void QmitkExtWorkbenchWindowAdvisor::RecomputeTitle()
{
berry::IWorkbenchWindowConfigurer::Pointer configurer =
GetWindowConfigurer();
std::string oldTitle = configurer->GetTitle();
std::string newTitle = ComputeTitle();
if (newTitle != oldTitle)
{
configurer->SetTitle(newTitle);
}
}
void QmitkExtWorkbenchWindowAdvisor::UpdateTitle(bool editorHidden)
{
berry::IWorkbenchWindowConfigurer::Pointer configurer =
GetWindowConfigurer();
berry::IWorkbenchWindow::Pointer window = configurer->GetWindow();
berry::IEditorPart::Pointer activeEditor;
berry::IWorkbenchPage::Pointer currentPage = window->GetActivePage();
berry::IPerspectiveDescriptor::Pointer persp;
berry::IAdaptable* input = 0;
if (currentPage)
{
activeEditor = currentPage->GetActiveEditor();
persp = currentPage->GetPerspective();
input = currentPage->GetInput();
}
if (editorHidden)
{
activeEditor = 0;
}
// Nothing to do if the editor hasn't changed
if (activeEditor == lastActiveEditor.Lock() && currentPage == lastActivePage.Lock()
&& persp == lastPerspective.Lock() && input == lastInput)
{
return;
}
if (!lastActiveEditor.Expired())
{
lastActiveEditor.Lock()->RemovePropertyListener(editorPropertyListener);
}
lastActiveEditor = activeEditor;
lastActivePage = currentPage;
lastPerspective = persp;
lastInput = input;
if (activeEditor)
{
activeEditor->AddPropertyListener(editorPropertyListener);
}
RecomputeTitle();
}
void QmitkExtWorkbenchWindowAdvisor::PropertyChange(berry::Object::Pointer /*source*/, int propId)
{
if (propId == berry::IWorkbenchPartConstants::PROP_TITLE)
{
if (!lastActiveEditor.Expired())
{
std::string newTitle = lastActiveEditor.Lock()->GetPartName();
if (lastEditorTitle != newTitle)
{
RecomputeTitle();
}
}
}
}
void QmitkExtWorkbenchWindowAdvisor::SetPerspectiveExcludeList(std::vector<std::string> v)
{
this->perspectiveExcludeList = v;
}
std::vector<std::string> QmitkExtWorkbenchWindowAdvisor::GetPerspectiveExcludeList()
{
return this->perspectiveExcludeList;
}
void QmitkExtWorkbenchWindowAdvisor::SetViewExcludeList(std::vector<std::string> v)
{
this->viewExcludeList = v;
}
std::vector<std::string> QmitkExtWorkbenchWindowAdvisor::GetViewExcludeList()
{
return this->viewExcludeList;
}
void QmitkExtWorkbenchWindowAdvisor::PostWindowClose()
{
berry::IWorkbenchWindow::Pointer window = this->GetWindowConfigurer()->GetWindow();
QMainWindow* mainWindow = static_cast<QMainWindow*> (window->GetShell()->GetControl());
QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
settings.setValue("ToolbarPosition", mainWindow->saveState());
}
QString QmitkExtWorkbenchWindowAdvisor::GetQSettingsFile() const
{
QFileInfo settingsInfo = QmitkCommonExtPlugin::getContext()->getDataFile(QT_SETTINGS_FILENAME);
return settingsInfo.canonicalFilePath();
}
diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h b/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
index 9ffa9ad3a8..90c8e8c06f 100644
--- a/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
+++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
@@ -1,165 +1,166 @@
/*===================================================================
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 QMITKEXTWORKBENCHWINDOWADVISOR_H_
#define QMITKEXTWORKBENCHWINDOWADVISOR_H_
#include <berryWorkbenchWindowAdvisor.h>
#include <berryIPartListener.h>
#include <berryIEditorPart.h>
#include <berryIWorkbenchPage.h>
#include <berryWorkbenchAdvisor.h>
#include <berryWorkbenchWindowAdvisor.h>
#include <org_mitk_gui_qt_ext_Export.h>
#include <QList>
class QAction;
class QMenu;
class MITK_QT_COMMON_EXT_EXPORT QmitkExtWorkbenchWindowAdvisor : public QObject, public berry::WorkbenchWindowAdvisor
{
Q_OBJECT
public:
QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor,
berry::IWorkbenchWindowConfigurer::Pointer configurer);
berry::ActionBarAdvisor::Pointer CreateActionBarAdvisor(
berry::IActionBarConfigurer::Pointer configurer);
void* CreateEmptyWindowContents(void* parent);
void PostWindowCreate();
void PreWindowOpen();
void PostWindowClose();
void ShowViewToolbar(bool show);
void ShowPerspectiveToolbar(bool show);
void ShowVersionInfo(bool show);
void ShowMitkVersionInfo(bool show);
void ShowViewMenuItem(bool show);
void ShowNewWindowMenuItem(bool show);
void ShowClosePerspectiveMenuItem(bool show);
bool GetShowClosePerspectiveMenuItem();
//TODO should be removed when product support is here
void SetProductName(const std::string& product);
void SetWindowIcon(const std::string& wndIcon);
void SetPerspectiveExcludeList(std::vector<std::string> v);
std::vector<std::string> GetPerspectiveExcludeList();
void SetViewExcludeList(std::vector<std::string> v);
std::vector<std::string> GetViewExcludeList();
protected slots:
virtual void onIntro();
virtual void onHelp();
virtual void onHelpContents();
virtual void onAbout();
private:
/**
* Hooks the listeners needed on the window
*
* @param configurer
*/
void HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer);
std::string ComputeTitle();
void RecomputeTitle();
QString GetQSettingsFile() const;
/**
* Updates the window title. Format will be: [pageInput -]
* [currentPerspective -] [editorInput -] [workspaceLocation -] productName
* @param editorHidden TODO
*/
void UpdateTitle(bool editorHidden);
void PropertyChange(berry::Object::Pointer /*source*/, int propId);
static QString QT_SETTINGS_FILENAME;
berry::IPartListener::Pointer titlePartListener;
berry::IPerspectiveListener::Pointer titlePerspectiveListener;
berry::IPerspectiveListener::Pointer menuPerspectiveListener;
berry::IPartListener::Pointer imageNavigatorPartListener;
berry::IPropertyChangeListener::Pointer editorPropertyListener;
friend struct berry::PropertyChangeIntAdapter<QmitkExtWorkbenchWindowAdvisor>;
friend class PartListenerForTitle;
friend class PerspectiveListenerForTitle;
friend class PerspectiveListenerForMenu;
friend class PartListenerForImageNavigator;
berry::IEditorPart::WeakPtr lastActiveEditor;
berry::IPerspectiveDescriptor::WeakPtr lastPerspective;
berry::IWorkbenchPage::WeakPtr lastActivePage;
std::string lastEditorTitle;
berry::IAdaptable* lastInput;
berry::WorkbenchAdvisor* wbAdvisor;
bool showViewToolbar;
bool showPerspectiveToolbar;
bool showVersionInfo;
bool showMitkVersionInfo;
bool showViewMenuItem;
bool showNewWindowMenuItem;
bool showClosePerspectiveMenuItem;
std::string productName;
std::string windowIcon;
// enables DnD on the editor area
berry::IDropTargetListener::Pointer dropTargetListener;
// stringlist for excluding perspectives from the perspective menu entry (e.g. Welcome Perspective)
std::vector<std::string> perspectiveExcludeList;
// stringlist for excluding views from the menu entry
std::vector<std::string> viewExcludeList;
// maps perspective ids to QAction objects
std::map<std::string, QAction*> mapPerspIdToAction;
// actions which will be enabled/disabled depending on the application state
QList<QAction*> viewActions;
QAction* fileSaveProjectAction;
QAction* closeProjectAction;
QAction* undoAction;
QAction* redoAction;
QAction* imageNavigatorAction;
QAction* resetPerspAction;
QAction* closePerspAction;
+ QAction* openDicomEditorAction;
};
#endif /*QMITKEXTWORKBENCHWINDOWADVISOR_H_*/
diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.cpp b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.cpp
new file mode 100644
index 0000000000..30f665c90c
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.cpp
@@ -0,0 +1,116 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2010-01-16 19:57:43 +0100 (Sa, 16 Jan 2010) $
+Version: $Revision: 21070 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "QmitkOpenDicomEditorAction.h"
+
+#include <QFileDialog>
+#include <QFileInfo>
+#include <mitkDataNodeFactory.h>
+
+#include "mitkCoreObjectFactory.h"
+#include "mitkSceneIO.h"
+#include "mitkProgressBar.h"
+
+#include <mitkCoreExtObjectFactory.h>
+#include <mitkDataStorageEditorInput.h>
+#include <berryIEditorPart.h>
+#include <berryIWorkbenchPage.h>
+#include <berryIPreferencesService.h>
+#include <berryIWorkbench.h>
+#include <berryPlatform.h>
+#include <berryFileEditorInput.h>
+
+#include "mitkProperties.h"
+#include "mitkNodePredicateData.h"
+#include "mitkNodePredicateNot.h"
+#include "mitkNodePredicateProperty.h"
+
+
+#include "QmitkStdMultiWidgetEditor.h"
+
+QmitkOpenDicomEditorAction::QmitkOpenDicomEditorAction(berry::IWorkbenchWindow::Pointer window)
+: QAction(0)
+{
+ this->init(window);
+}
+
+QmitkOpenDicomEditorAction::QmitkOpenDicomEditorAction(const QIcon & icon, berry::IWorkbenchWindow::Pointer window)
+: QAction(0)
+{
+ this->setIcon(icon);
+
+ this->init(window);
+}
+
+void QmitkOpenDicomEditorAction::init(berry::IWorkbenchWindow::Pointer window)
+{
+ m_Window = window;
+ this->setParent(static_cast<QWidget*>(m_Window->GetShell()->GetControl()));
+ this->setText("&DICOM");
+ this->setToolTip("Open dicom tool");
+
+ berry::IPreferencesService::Pointer prefService
+ = berry::Platform::GetServiceRegistry()
+ .GetServiceById<berry::IPreferencesService>(berry::IPreferencesService::ID);
+
+ m_GeneralPreferencesNode = prefService->GetSystemPreferences()->Node("/General");
+
+ this->connect(this, SIGNAL(triggered(bool)), this, SLOT(Run()));
+}
+
+void QmitkOpenDicomEditorAction::Run()
+{
+
+ // check if there is an open perspective, if not open the default perspective
+ if (m_Window->GetActivePage().IsNull())
+ {
+ std::string defaultPerspId = m_Window->GetWorkbench()->GetPerspectiveRegistry()->GetDefaultPerspective();
+ m_Window->GetWorkbench()->ShowPerspective(defaultPerspId, m_Window);
+ }
+
+ mitk::DataStorageEditorInput::Pointer editorInput;
+ //mitk::DataStorage::Pointer dataStorage;
+ //QmitkStdMultiWidgetEditor::Pointer multiWidgetEditor;
+ //berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->GetActiveEditor();
+
+
+
+ //if (editor.Cast<QmitkStdMultiWidgetEditor>().IsNull())
+ //{
+ // editorInput = new mitk::DataStorageEditorInput();
+ // dataStorage = editorInput->GetDataStorageReference()->GetDataStorage();
+ //}
+ //else
+ //{
+ // multiWidgetEditor = editor.Cast<QmitkStdMultiWidgetEditor>();
+ // dataStorage = multiWidgetEditor->GetEditorInput().Cast<mitk::DataStorageEditorInput>()->GetDataStorageReference()->GetDataStorage();
+ //}
+
+ //if (multiWidgetEditor.IsNull())
+ //{
+ // //berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID);
+ // multiWidgetEditor = editor.Cast<QmitkStdMultiWidgetEditor>();
+ //}
+ //else
+ //{
+ // multiWidgetEditor->GetStdMultiWidget()->RequestUpdate();
+ //}
+
+ berry::IEditorInput::Pointer editorInput2(new berry::FileEditorInput(Poco::Path()));
+ m_Window->GetActivePage()->OpenEditor(editorInput2, "org.mitk.editors.dicomeditor");
+}
+
diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.h b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.h
new file mode 100644
index 0000000000..e6321c9a23
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.h
@@ -0,0 +1,55 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2010-01-16 19:57:43 +0100 (Sa, 16 Jan 2010) $
+Version: $Revision: 21070 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef QMITKOPENDICOMEDITORACTION_H_
+#define QMITKOPENDICOMEDITORACTION_H_
+
+#ifdef __MINGW32__
+// We need to inlclude winbase.h here in order to declare
+// atomic intrinsics like InterlockedIncrement correctly.
+// Otherwhise, they would be declared wrong within qatomic_windows.h .
+#include <windows.h>
+#endif
+
+#include <QAction>
+#include <QIcon>
+
+#include <org_mitk_gui_qt_ext_Export.h>
+
+#include <berryIWorkbenchWindow.h>
+#include <berryIPreferences.h>
+
+class MITK_QT_COMMON_EXT_EXPORT QmitkOpenDicomEditorAction : public QAction
+{
+ Q_OBJECT
+
+public:
+ QmitkOpenDicomEditorAction(berry::IWorkbenchWindow::Pointer window);
+ QmitkOpenDicomEditorAction(const QIcon & icon, berry::IWorkbenchWindow::Pointer window);
+
+protected slots:
+
+ void Run();
+
+private:
+ void init ( berry::IWorkbenchWindow::Pointer window );
+ berry::IWorkbenchWindow::Pointer m_Window;
+ berry::IPreferences::WeakPtr m_GeneralPreferencesNode;
+};
+
+
+#endif /*QMITKOPENDICOMEDITORACTION_H_*/
diff --git a/t b/t
new file mode 100644
index 0000000000..f183d64a83
--- /dev/null
+++ b/t
@@ -0,0 +1,266 @@
+BlueBerry/Bundles/org.blueberry.ui.qt/files.cmake: berryQtEditorPart.cpp
+BlueBerry/Bundles/org.blueberry.ui.qt/src/berryQtEditorPart.cpp:#include "berryQtEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui.qt/src/berryQtEditorPart.cpp:void QtEditorPart::CreatePartControl(void* parent)
+BlueBerry/Bundles/org.blueberry.ui.qt/src/berryQtEditorPart.h:#include <berryEditorPart.h>
+BlueBerry/Bundles/org.blueberry.ui.qt/src/berryQtEditorPart.h:class BERRY_UI_QT QtEditorPart : public EditorPart
+BlueBerry/Bundles/org.blueberry.ui.qt/src/berryQtEditorPart.h: berryObjectMacro(QtEditorPart);
+BlueBerry/Bundles/org.blueberry.ui.qt/src/internal/berryQtWorkbenchPageTweaklet.cpp:IEditorPart::Pointer QtWorkbenchPageTweaklet::CreateErrorEditorPart(const std::string& /*partName*/, const std::string& /*msg*/)
+BlueBerry/Bundles/org.blueberry.ui.qt/src/internal/berryQtWorkbenchPageTweaklet.cpp: return IEditorPart::Pointer(0);
+BlueBerry/Bundles/org.blueberry.ui.qt/src/internal/berryQtWorkbenchPageTweaklet.h: IEditorPart::Pointer CreateErrorEditorPart(const std::string& partName, const std::string& msg);
+BlueBerry/Bundles/org.blueberry.ui/files.cmake: src/berryEditorPart.h
+BlueBerry/Bundles/org.blueberry.ui/files.cmake: berryEditorPart.cpp
+BlueBerry/Bundles/org.blueberry.ui/manifest.cpp:POCO_BEGIN_NAMED_MANIFEST(berryIEditorPart, berry::IEditorPart)
+BlueBerry/Bundles/org.blueberry.ui/schema/editors.exsd: the name of a class that implements &lt;samp&gt;berry::IEditorPart&lt;/samp&gt;. The attributes &lt;samp&gt;class&lt;/samp&gt;, &lt;samp&gt;command&lt;/samp&gt;, and &lt;samp&gt;launcher&lt;/samp&gt; are mutually exclusive. If this attribute is defined then &lt;samp&gt;contributorClass&lt;/samp&gt; should also be defined.
+BlueBerry/Bundles/org.blueberry.ui/schema/editors.exsd: <meta.attribute kind="java" basedOn="berry::EditorPart"/>
+BlueBerry/Bundles/org.blueberry.ui/schema/editors.exsd:class must implement &lt;samp&gt;org.eclipse.ui.IEditorPart&lt;/samp&gt;.
+BlueBerry/Bundles/org.blueberry.ui/schema/editors.exsd:&lt;samp&gt;subclass org.eclipse.ui.EditorPart&lt;/samp&gt; when
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:#include "berryEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:EditorPart::EditorPart()
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:void EditorPart::SetInput(IEditorInput::Pointer input)
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:void EditorPart::SetInputWithNotify(IEditorInput::Pointer input)
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:void EditorPart::SetContentDescription(const std::string& description)
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:void EditorPart::SetPartName(const std::string& partName)
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:void EditorPart::CheckSite(IWorkbenchPartSite::Pointer site)
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:IEditorInput::Pointer EditorPart::GetEditorInput() const
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:IEditorSite::Pointer EditorPart::GetEditorSite() const
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:std::string EditorPart::GetTitleToolTip() const
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.cpp:bool EditorPart::IsSaveOnCloseNeeded() const
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h:#include "berryIEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * <code>EditorPart</code> subclass.
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * <li><code>IEditorPart.init</code> - to initialize editor when assigned its site</li>
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * <li><code>IEditorPart.isDirty</code> - to decide whether a significant change has
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * <li><code>IEditorPart.doSave</code> - to save contents of editor</li>
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * <li><code>IEditorPart.doSaveAs</code> - to save contents of editor</li>
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * <li><code>IEditorPart.isSaveAsAllowed</code> - to control Save As</li>
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h:class BERRY_UI EditorPart : public WorkbenchPart , public IEditorPart {
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: Q_INTERFACES(berry::IEditorPart)
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: berryObjectMacro(EditorPart);
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: EditorPart();
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * for an editor. For greater details, see <code>IEditorPart</code>
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * @see IEditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * for an editor. For greater details, see <code>IEditorPart</code>
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * @see IEditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * Method declared on IEditorPart.
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * Method declared on IEditorPart.
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * Subclasses of <code>EditorPart</code> must implement this method. Within
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * for an editor. For greater details, see <code>IEditorPart</code>
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * @see IEditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * for an editor. For greater details, see <code>IEditorPart</code>
+BlueBerry/Bundles/org.blueberry.ui/src/berryEditorPart.h: * @see IEditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorInput.h: * the model source for an <code>IEditorPart</code>.
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorInput.h: * An editor input is passed to an editor via the <code>IEditorPart.init</code>
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorInput.h: * @see org.blueberry.ui.IEditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorPart.h: * implementation is defined in <code>EditorPart</code>.
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorPart.h: * @see org.blueberry.ui.part.EditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorPart.h:struct BERRY_UI IEditorPart : public virtual IWorkbenchPart,
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorPart.h: berryInterfaceMacro(IEditorPart, berry);
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorPart.h: virtual ~IEditorPart()
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorPart.h:Q_DECLARE_INTERFACE(berry::IEditorPart, "org.blueberry.IEditorPart")
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorReference.h:#include "berryIEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorReference.h: * The IEditorPart will not be instanciated until
+BlueBerry/Bundles/org.blueberry.ui/src/berryIEditorReference.h: virtual IEditorPart::Pointer GetEditor(bool restore) = 0;
+BlueBerry/Bundles/org.blueberry.ui/src/berryIReusableEditor.h:#include "berryIEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/berryIReusableEditor.h:struct BERRY_UI IReusableEditor : public IEditorPart {
+BlueBerry/Bundles/org.blueberry.ui/src/berryIReusableEditor.h: * <p><b>Note:</b> Clients must fire the {@link IEditorPart#PROP_INPUT }
+BlueBerry/Bundles/org.blueberry.ui/src/berryISaveablePart.h: * @see org.blueberry.ui.IEditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryISaveablesSource.h: * behaviour implemented by {@link EditorPart})</li>
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h:#include "berryIEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: * @see IEditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual bool CloseEditor(IEditorPart::Pointer editor, bool save) = 0;
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual IEditorPart::Pointer GetActiveEditor() = 0;
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual IEditorPart::Pointer FindEditor(IEditorInput::Pointer input) = 0;
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual std::vector<IEditorPart::Pointer> GetEditors() = 0;
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual std::vector<IEditorPart::Pointer> GetDirtyEditors() = 0;
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input, const std::string& editorId) = 0;
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input, const std::string& editorId,
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual bool SaveEditor(IEditorPart::Pointer editor, bool confirm) = 0;
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPage.h: virtual bool IsEditorPinned(IEditorPart::Pointer editor) = 0;
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPart.h: * <code>IEditorPart</code>.
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPart.h: * @see IEditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryIWorkbenchPartConstants.h: * The property id for <code>IEditorPart.getEditorInput()</code>.
+BlueBerry/Bundles/org.blueberry.ui/src/berryWorkbenchPart.h: * <code>EditorPart</code>.
+BlueBerry/Bundles/org.blueberry.ui/src/berryWorkbenchPart.h: * @see org.blueberry.ui.part.EditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/berryWorkbenchPart.h: * Subclasses must invoke this method from <code>IEditorPart.init</code>
+BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryHandlerUtil.cpp://IEditorPart::Pointer HandlerUtil::GetActiveEditor(ExecutionEvent::Pointer event)
+BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryHandlerUtil.cpp:// return o.Cast<IEditorPart>();
+BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryHandlerUtil.cpp://IEditorPart::Pointer HandlerUtil::GetActiveEditorChecked(
+BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryHandlerUtil.cpp:// if (o.Cast<IEditorPart>().IsNull())
+BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryHandlerUtil.cpp:// "IEditorPart", o->GetClassName());
+BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryHandlerUtil.cpp:// return (IEditorPart) o;
+BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryHandlerUtil.h: //static IEditorPart::Pointer GetActiveEditor(ExecutionEvent::Pointer event);
+BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryHandlerUtil.h: //static IEditorPart::Pointer GetActiveEditorChecked(ExecutionEvent::Pointer event);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorAreaHelper.cpp:void EditorAreaHelper::CloseEditor(IEditorPart::Pointer part)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorAreaHelper.cpp:void EditorAreaHelper::MoveEditor(IEditorPart::Pointer /*part*/, int /*position*/)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorAreaHelper.h: void CloseEditor(IEditorPart::Pointer part);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorAreaHelper.h: void MoveEditor(IEditorPart::Pointer part, int position);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorDescriptor.cpp:#include "../berryEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorDescriptor.cpp:IEditorPart::Pointer EditorDescriptor::CreateEditor()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorDescriptor.cpp: IEditorPart::Pointer extension(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorDescriptor.cpp: configurationElement->CreateExecutableExtension<IEditorPart> (
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorDescriptor.cpp: extension = configurationElement->CreateExecutableExtension<IEditorPart> (
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorDescriptor.cpp: WorkbenchRegistryConstants::ATT_CLASS, IEditorPart::GetManifestName());
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorDescriptor.h:struct IEditorPart;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorDescriptor.h:public: SmartPointer<IEditorPart> CreateEditor();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp:std::vector<IEditorPart::Pointer> EditorManager::CollectDirtyEditors()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp: std::vector<IEditorPart::Pointer> result;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp: IEditorPart::Pointer part = (*i)->GetPart(false).Cast<IEditorPart>();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp:IEditorPart::Pointer EditorManager::FindEditor(IEditorInput::Pointer input)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp:IEditorPart::Pointer EditorManager::FindEditor(const std::string& editorId,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp: return IEditorPart::Pointer();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp: IEditorPart::Pointer part = editor->GetPart(false).Cast<IEditorPart>();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp:std::vector<IEditorPart::Pointer> EditorManager::GetDirtyEditors()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp:IEditorPart::Pointer EditorManager::GetVisibleEditor()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp: return IEditorPart::Pointer(0);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp: return ref->GetPart(true).Cast<IEditorPart>();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp: IEditorPart::Pointer part, EditorDescriptor::Pointer desc,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp:IEditorPart::Pointer EditorManager::CreatePart(EditorDescriptor::Pointer desc) const
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp: IEditorPart::Pointer result = desc->CreateEditor();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp: IEditorPart::Pointer editor = editorReference->GetEditor(false);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.cpp:// final IEditorPart editor = ed.getEditor(false);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.h:#include "../berryIEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.h: std::vector<IEditorPart::Pointer> CollectDirtyEditors();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.h: IEditorPart::Pointer FindEditor(IEditorInput::Pointer input);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.h: IEditorPart::Pointer FindEditor(const std::string& editorId,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.h: std::vector<IEditorPart::Pointer> GetDirtyEditors();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.h: IEditorPart::Pointer GetVisibleEditor();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.h: IEditorPart::Pointer part, EditorDescriptor::Pointer desc,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorManager.h: IEditorPart::Pointer CreatePart(EditorDescriptor::Pointer desc) const;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp: // IEditorPart editor = getEditor(false);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp:IEditorPart::Pointer EditorReference::GetEditor(bool restore)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp: return this->GetPart(restore).Cast<IEditorPart> ();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp: IEditorPart::Pointer part = this->GetEditor(false);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp: IEditorPart::Pointer part =
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp: Tweaklets::Get(WorkbenchPageTweaklet::KEY)->CreateErrorEditorPart(label,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp:IEditorPart::Pointer EditorReference::CreatePartHelper()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp: IEditorPart::Pointer part;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp:IEditorPart::Pointer EditorReference::GetEmptyEditor(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp: IEditorPart::Pointer part =
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp: Tweaklets::Get(WorkbenchPageTweaklet::KEY)->CreateErrorEditorPart("(Empty)", "");
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp: return IEditorPart::Pointer(0);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.h:#include "../berryIEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.h: IEditorPart::Pointer GetEditor(bool restore);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.h: IEditorPart::Pointer CreatePartHelper();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.h: * Creates and returns an empty editor (<code>ErrorEditorPart</code>).
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.h: IEditorPart::Pointer GetEmptyEditor(SmartPointer<EditorDescriptor> descr);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorSite.cpp: IEditorPart::Pointer editor, WorkbenchPage* page,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorSite.cpp:IEditorPart::Pointer EditorSite::GetEditorPart()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorSite.cpp: return this->GetPart().Cast<IEditorPart>();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorSite.h:#include "../berryIEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorSite.h: EditorSite(IEditorReference::Pointer ref, IEditorPart::Pointer editor,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorSite.h: IEditorPart::Pointer GetEditorPart();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartList.cpp:IEditorPart::Pointer PartList::GetActiveEditor()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartList.cpp: return activeEditorReference.Expired() ? IEditorPart::Pointer(0) : activeEditorReference.Lock()->GetEditor(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartList.h: IEditorPart::Pointer GetActiveEditor();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartTester.cpp:void PartTester::TestEditor(IEditorPart::Pointer part)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartTester.h:#include "../berryIEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartTester.h:public: static void TestEditor(IEditorPart::Pointer part);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:SmartPointer<IEditorPart> WorkbenchPage::ActivationList::GetTopEditor()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: return IEditorPart::Pointer(0);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer _topEditor = this->topEditor.Lock();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: bool isNewPartAnEditor = newPart.Cast<IEditorPart> ().IsNotNull();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: topEditor = newPart.Cast<IEditorPart> ();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: topEditor = newPart.Cast<IEditorPart> ();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer newEditor)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: if (part.Cast<IEditorPart> () != 0)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer part = (ref == 0) ? IEditorPart::Pointer(0)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:bool WorkbenchPage::CloseEditor(IEditorPart::Pointer editor, bool save)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer editorPart = reference->GetEditor(false);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::GetActiveEditor()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:std::vector<IEditorPart::Pointer> WorkbenchPage::GetEditors()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: std::vector<IEditorPart::Pointer> result;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer part = (*iter)->GetEditor(true);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:std::vector<IEditorPart::Pointer> WorkbenchPage::GetDirtyEditors()
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::FindEditor(IEditorInput::Pointer input)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::OpenEditor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::OpenEditor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::OpenEditor(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::OpenEditor(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::OpenEditorFromDescriptor(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::BusyOpenEditor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer result;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::BusyOpenEditorFromDescriptor(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer result;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::BusyOpenEditorBatched(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer editor;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer editorToSave = editor;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: return IEditorPart::Pointer(0);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:IEditorPart::Pointer WorkbenchPage::BusyOpenEditorFromDescriptorBatched(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer editor;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: IEditorPart::Pointer editor;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:void WorkbenchPage::ShowEditor(bool activate, IEditorPart::Pointer editor)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:bool WorkbenchPage::IsEditorPinned(IEditorPart::Pointer editor)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp:bool WorkbenchPage::SaveEditor(IEditorPart::Pointer editor, bool confirm)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp: if (newPart.Cast<IEditorPart> () != 0)
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::WeakPtr topEditor;
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: void UpdateTopEditor(IEditorPart::Pointer newEditor);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: SmartPointer<IEditorPart> GetTopEditor();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: bool CloseEditor(IEditorPart::Pointer editor, bool save);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer GetActiveEditor();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: std::vector<IEditorPart::Pointer> GetEditors();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: std::vector<IEditorPart::Pointer> GetDirtyEditors();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer FindEditor(IEditorInput::Pointer input);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer OpenEditorFromDescriptor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer BusyOpenEditor(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer BusyOpenEditorFromDescriptor(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer BusyOpenEditorBatched(IEditorInput::Pointer input,
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: IEditorPart::Pointer BusyOpenEditorFromDescriptorBatched(
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: void ShowEditor(bool activate, IEditorPart::Pointer editor);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: bool IsEditorPinned(IEditorPart::Pointer editor);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: bool SaveEditor(IEditorPart::Pointer editor, bool confirm);
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.h: // IEditorPart getTopEditor() {
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPartReference.cpp:#include "../berryIEditorPart.h"
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPartReference.cpp: if (part.Cast<IEditorPart> ().IsNull())
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPartReference.cpp: return part.Cast<IEditorPart> ()->IsDirty();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchWindow.cpp: IEditorPart::Pointer editor = currentPage->GetActiveEditor();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchWindow.cpp: IEditorPart::Pointer editor = currentPage->GetActiveEditor();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/intro/berryEditorIntroAdapterPart.cpp: return introPart.IsNull() ? EditorPart::GetPartName() : introPart->GetPartName();
+BlueBerry/Bundles/org.blueberry.ui/src/internal/intro/berryEditorIntroAdapterPart.h:#include <berryEditorPart.h>
+BlueBerry/Bundles/org.blueberry.ui/src/internal/intro/berryEditorIntroAdapterPart.h:class EditorIntroAdapterPart: public EditorPart
+BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryWorkbenchPageTweaklet.h: virtual IEditorPart::Pointer CreateErrorEditorPart(const std::string& partName, const std::string& msg) = 0;
+Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditor.java:import org.eclipse.ui.IEditorPart;
+Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditor.java: firePropertyChange(IEditorPart.PROP_DIRTY);
+Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditor.java: * @see org.eclipse.ui.part.EditorPart#setInput(org.eclipse.ui.IEditorInput)
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkCloseProjectAction.cpp:#include <berryIEditorPart.h>
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkCloseProjectAction.cpp: berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->GetActiveEditor();
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkFileExitAction.cpp:#include <berryIEditorPart.h>
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkFileOpenAction.cpp:#include <berryIEditorPart.h>
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkFileOpenAction.cpp: berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->GetActiveEditor();
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkFileOpenAction.cpp: berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID);
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkFunctionality.cpp:#include <berryIEditorPart.h>
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkFunctionality.cpp: berry::IEditorPart::Pointer editor =
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkFunctionality.cpp: berry::IEditorPart::Pointer editor = this->GetSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID, false);
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkStdMultiWidgetEditor.h:#include <berryQtEditorPart.h>
+CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkStdMultiWidgetEditor.h: public berry::QtEditorPart, virtual public berry::IPartListener
+Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp:#include <berryIEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp: berry::IEditorPart::Pointer editor;
+Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp: std::vector<berry::IEditorPart::Pointer> editors =
+Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp: berry::IEditorPart::Pointer editor = this->GetSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID, false);
+Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPartialVolumeAnalysisView.cpp:#include <berryIEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppIntroPart.cpp: berry::IEditorPart::Pointer editor = GetIntroSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID);
+Modules/Bundles/org.mitk.gui.qt.dtiatlasapp/src/internal/QmitkDTIAtlasAppIntroPart.cpp: berry::IEditorPart::Pointer editor = GetIntroSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID);
+Modules/Bundles/org.mitk.gui.qt.examples/src/internal/simplemeasurement/QmitkSimpleMeasurement.cpp:#include <berryIEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtFileOpenAction.cpp:#include <berryIEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtFileOpenAction.cpp: berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->GetActiveEditor();
+Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtFileOpenAction.cpp: berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID);
+Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtFileSaveProjectAction.cpp:#include <berryIEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtFileSaveProjectAction.cpp: berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->GetActiveEditor();
+Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp: berry::IEditorPart::Pointer activeEditor;
+Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp: berry::IEditorPart::Pointer activeEditor;
+Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h:#include <berryIEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h: berry::IEditorPart::WeakPtr lastActiveEditor;
+Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp: berry::IEditorPart::Pointer editor =
+Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp: berry::IEditorPart::Pointer editor = this->GetSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID, false);
+Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/QmitkImageStatisticsView.cpp:#include <berryIEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/QmitkMITKSurfaceMaterialEditorView.cpp:#include "berryIEditorPart.h"
+Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/QmitkMeasurement.cpp:#include <berryIEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.python.console/src/internal/QmitkPythonEditor.h:#include <berryQtEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.python.console/src/internal/QmitkPythonEditor.h:class QmitkPythonEditor : public berry::QtEditorPart, virtual public berry::IPartListener
+Modules/Bundles/org.mitk.gui.qt.python.console/src/internal/QmitkPythonScriptEditor.h:#include <berryQtEditorPart.h>
+Modules/Bundles/org.mitk.gui.qt.python.console/src/internal/QmitkPythonScriptEditor.h:class QmitkPythonScriptEditor : public QWidget, public QmitkPythonPasteClient //, berry::QtEditorPart
+Modules/Bundles/org.mitk.gui.qt.python.console/src/internal/QmitkPythonVariableStack.cpp: berry::IEditorPart::Pointer editor =
+Modules/Bundles/org.mitk.gui.qt.python.console/src/internal/QmitkPythonVariableStack.cpp: berry::IEditorPart::Pointer editor = this->GetSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID, false);

File Metadata

Mime Type
application/octet-stream
Expires
Sat, Nov 9, 11:32 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2359729
Default Alt Text
(233 KB)

Event Timeline