diff --git a/Plugins/org.mitk.gui.qt.dicom./resources/dicom.qrc b/Plugins/org.mitk.gui.qt.dicom./resources/dicom.qrc new file mode 100644 index 0000000000..bf16525381 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.dicom./resources/dicom.qrc @@ -0,0 +1,10 @@ + + + drive-harddisk_32.png + folder_32.png + media-optical_32.png + network-workgroup_32.png + network-idle_16.png + network-offline_16.png + + diff --git a/Plugins/org.mitk.gui.qt.dicom/files.cmake b/Plugins/org.mitk.gui.qt.dicom/files.cmake index 5aba8d5012..a250736622 100644 --- a/Plugins/org.mitk.gui.qt.dicom/files.cmake +++ b/Plugins/org.mitk.gui.qt.dicom/files.cmake @@ -1,53 +1,54 @@ 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 +resources/dicom.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.dicom/resources/dicom.qrc b/Plugins/org.mitk.gui.qt.dicom/resources/dicom.qrc new file mode 100644 index 0000000000..bf16525381 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.dicom/resources/dicom.qrc @@ -0,0 +1,10 @@ + + + drive-harddisk_32.png + folder_32.png + media-optical_32.png + network-workgroup_32.png + network-idle_16.png + network-offline_16.png + + diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/drive-harddisk_32.png b/Plugins/org.mitk.gui.qt.dicom/resources/drive-harddisk_32.png new file mode 100644 index 0000000000..b34d8b7794 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/drive-harddisk_32.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/folder_32.png b/Plugins/org.mitk.gui.qt.dicom/resources/folder_32.png new file mode 100644 index 0000000000..472484f112 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/folder_32.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/media-optical_32.png b/Plugins/org.mitk.gui.qt.dicom/resources/media-optical_32.png new file mode 100644 index 0000000000..5853a754e4 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/media-optical_32.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/network-error_16.png b/Plugins/org.mitk.gui.qt.dicom/resources/network-error_16.png new file mode 100644 index 0000000000..3f18ed0f7b Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/network-error_16.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/network-idle_16.png b/Plugins/org.mitk.gui.qt.dicom/resources/network-idle_16.png new file mode 100644 index 0000000000..0efee57e59 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/network-idle_16.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/network-offline_16.png b/Plugins/org.mitk.gui.qt.dicom/resources/network-offline_16.png new file mode 100644 index 0000000000..1f210fc3e9 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/network-offline_16.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/network-receive_16.png b/Plugins/org.mitk.gui.qt.dicom/resources/network-receive_16.png new file mode 100644 index 0000000000..b57c65c86a Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/network-receive_16.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/network-transmit-receive_16.png b/Plugins/org.mitk.gui.qt.dicom/resources/network-transmit-receive_16.png new file mode 100644 index 0000000000..271d37d0f3 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/network-transmit-receive_16.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/network-transmit_16.png b/Plugins/org.mitk.gui.qt.dicom/resources/network-transmit_16.png new file mode 100644 index 0000000000..08aa28b099 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/network-transmit_16.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/resources/network-workgroup_32.png b/Plugins/org.mitk.gui.qt.dicom/resources/network-workgroup_32.png new file mode 100644 index 0000000000..4137b3c3b7 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.dicom/resources/network-workgroup_32.png differ diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.cpp index 50e1a090a3..6507cab0fc 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.cpp +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.cpp @@ -1,242 +1,245 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ // Blueberry #include #include #include #include #include #include #include #include #include "berryFileEditorInput.h" // Qmitk #include "QmitkDicomEditor.h" #include "mitkPluginActivator.h" #include //#include "mitkProgressBar.h" // Qt #include #include #include #include #include #include #include #include #include #include #include #include #include #include //CTK #include #include #include #include #include const std::string QmitkDicomEditor::EDITOR_ID = "org.mitk.editors.dicomeditor"; QmitkDicomEditor::QmitkDicomEditor() : m_Thread(new QThread()) , m_DicomDirectoryListener(new QmitkDicomDirectoryListener()) , m_StoreSCPLauncher(new QmitkStoreSCPLauncher(&builder)) , m_Publisher(new QmitkDicomDataEventPublisher()) { } QmitkDicomEditor::~QmitkDicomEditor() { m_Thread->quit(); m_Thread->wait(1000); delete m_Handler; delete m_Publisher; delete m_StoreSCPLauncher; delete m_Thread; delete m_DicomDirectoryListener; } void QmitkDicomEditor::CreateQtPartControl(QWidget *parent ) { m_Controls.setupUi( parent ); + m_Controls.LocalStorageButton->setIcon(QIcon(":/org.mitk.gui.qt.dicom/drive-harddisk_32.png")); + m_Controls.FolderButton->setIcon(QIcon(":/org.mitk.gui.qt.dicom/folder_32.png")); + m_Controls.CDButton->setIcon(QIcon(":/org.mitk.gui.qt.dicom/media-optical_32.png")); + m_Controls.QueryRetrieveButton->setIcon(QIcon(":/org.mitk.gui.qt.dicom/network-workgroup_32.png")); + m_Controls.StoreSCPStatusLabel->setTextFormat(Qt::RichText); + m_Controls.StoreSCPStatusLabel->setText(""); + + TestHandler(); SetPluginDirectory(); SetDatabaseDirectory("DatabaseDirectory"); SetListenerDirectory("ListenerDirectory"); StartDicomDirectoryListener(); m_Controls.m_ctkDICOMQueryRetrieveWidget->useProgressDialog(false); - m_Controls.StoreSCPLabel->setVisible(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.FolderButton, SIGNAL(clicked()), this, 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); 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))) { StopStoreSCP(); StartStoreSCP(); } - m_Controls.StoreSCPLabel->setVisible(true); } void QmitkDicomEditor::OnFolderCDImport() { - m_Controls.StoreSCPLabel->setVisible(false); } void QmitkDicomEditor::OnLocalStorage() { OnChangePage(0); - m_Controls.StoreSCPLabel->setVisible(false); } 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->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); + connect(m_StoreSCPLauncher, SIGNAL(SignalStatusOfStoreSCP(const QString&)), this, SLOT(OnStoreSCPStatusChanged(const QString&))); m_StoreSCPLauncher->StartStoreSCP(); - m_Controls.StoreSCPLabel->setText("Storage provider is running on port: "+storagePort); } +void QmitkDicomEditor::OnStoreSCPStatusChanged(const QString& status) +{ + m_Controls.StoreSCPStatusLabel->setText(" "+status); +} void QmitkDicomEditor::StopStoreSCP() { delete m_StoreSCPLauncher; - m_Controls.StoreSCPLabel->setText(QString("Storage service provider is not running!")); } void QmitkDicomEditor::SetPluginDirectory() { m_PluginDirectory = mitk::PluginActivator::getContext()->getDataFile("").absolutePath(); 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); } diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditorControls.ui b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditorControls.ui index c4d1a85be9..ec8d717b6f 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditorControls.ui +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditorControls.ui @@ -1,157 +1,264 @@ QmitkDicomEditorControls 0 0 752 696 0 0 + + false + QmitkTemplate QFrame::StyledPanel QFrame::Raised - QFrame::StyledPanel + QFrame::NoFrame QFrame::Plain + + 0 + + + 0 + + + Local storage you can find your dicom data here. + Local Storage + + + 32 + 32 + + + + false + + + true + + + Imports dicom data to your local storage from CD. + Import CD + + + 32 + 32 + + + + true + + + Imports dicom data to your local storage from a folder. + Import Folder + + + 32 + 32 + + + + true + + + Query dicom data from a PACS and retrieve it to your system. + Query Retrieve + + + 32 + 32 + + + + true + Qt::Horizontal 40 20 true 0 - - - Storage provider is not running! + + + QFrame::StyledPanel - - Qt::NoTextInteraction + + QFrame::Raised + + + 0 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 4 + 20 + + + + + + + + + + + Qt::RichText + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + ctkDICOMQueryRetrieveWidget QWidget
ctkDICOMQueryRetrieveWidget.h
1
QmitkDicomLocalStorageWidget QWidget
Qmitk/QmitkDicomLocalStorageWidget.h
1
QmitkDicomExternalDataWidget QWidget
Qmitk/QmitkDicomExternalDataWidget.h
1
OnChangePage(int)