diff --git a/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.cpp b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.cpp index 3fecfe5ff1..7069b5e2bf 100644 --- a/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.cpp +++ b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.cpp @@ -1,223 +1,222 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 // Qmitk #include "QmitkDicomExternalDataWidget.h" #include // Qt #include #include #include #include // CTK #include 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(m_ImportDialog->bottomWidget()); if (copyOnImport->isChecked()) { //targetDirectory = d->DICOMDatabase->databaseDirectory(); MBI_DEBUG<ExternalDataTreeView->currentIndex(); if(m_ExternalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast(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(ctkDICOMModel::SeriesType)) { filePaths.append(m_ExternalDatabase->filesForSeries(currentUID)); } else if(m_ExternalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast(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(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()); } diff --git a/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.h b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.h index cb71e277a4..ac7cac6e5d 100644 --- a/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.h +++ b/Modules/DicomUI/Qmitk/QmitkDicomExternalDataWidget.h @@ -1,123 +1,122 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 QmitkDicomExternalDataWidget_h #define QmitkDicomExternalDataWidget_h // #include #include "ui_QmitkDicomExternalDataWidgetControls.h" #include "mitkDicomUIExports.h" // include ctk #include #include #include #include //include QT #include #include #include #include //For running dicom import in background #include #include #include #include /*! \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 m_Future; QFutureWatcher m_Watcher; QTimer* m_Timer; QString* m_DirectoryName; }; #endif // _QmitkDicomExternalDataWidget_H_INCLUDED diff --git a/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.cpp b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.cpp index cb6c5fce35..c4b30c38e5 100644 --- a/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.cpp +++ b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.cpp @@ -1,193 +1,192 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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. + +===================================================================*/ // Qmitk #include "QmitkDicomLocalStorageWidget.h" #include #include // Qt #include #include #include #include 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->addSortingTagButton_2->setVisible(false); m_Controls->deleteSortingTagButton_2->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(); } mitk::ProgressBar::GetInstance()->AddStepsToDo(2); 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(); } mitk::ProgressBar::GetInstance()->AddStepsToDo(dicomData.count()); 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()) { mitk::ProgressBar::GetInstance()->Progress(); m_LocalIndexer->addDirectory(*m_LocalDatabase,directory,m_LocalDatabase->databaseDirectory()); } m_LocalModel->setDatabase(m_LocalDatabase->database()); mitk::ProgressBar::GetInstance()->Progress(); 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()); mitk::ProgressBar::GetInstance()->Progress(); } } 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(ctkDICOMModel::SeriesType)) { m_LocalDatabase->removeSeries(currentUID); } else if(m_LocalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast(ctkDICOMModel::StudyType)) { m_LocalDatabase->removeStudy(currentUID); } else if(m_LocalModel->data(currentIndex,ctkDICOMModel::TypeRole)==static_cast(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(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 <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()); } diff --git a/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.h b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.h index 6beadeb46e..36528eb66f 100644 --- a/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.h +++ b/Modules/DicomUI/Qmitk/QmitkDicomLocalStorageWidget.h @@ -1,116 +1,114 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 QmitkDicomLocalStorageWidget_h #define QmitkDicomLocalStorageWidget_h // #include #include "ui_QmitkDicomLocalStorageWidgetControls.h" #include "mitkDicomUIExports.h" // include ctk #include #include #include #include //include QT #include #include #include //For running dicom import in background #include #include #include #include #include #include /*! \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 m_Future; QFutureWatcher m_Watcher; }; #endif // _QmitkDicomLocalStorageWidget_H_INCLUDED diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.cpp index 915221690f..5ce9c09daf 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.cpp +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.cpp @@ -1,100 +1,99 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. -=========================================================================*/ +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ #include "mitkPluginActivator.h" #include "DicomEventHandler.h" #include #include #include #include #include #include #include #include #include #include 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 qualifiedUIDs; mitk::DicomSeriesReader::StringContainer seriesToLoad; std::size_t found; mitk::DicomSeriesReader::UidFileNamesMap dicomSeriesMap = mitk::DicomSeriesReader::GetSeries(path.toStdString(),false); 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* storageService = mitk::PluginActivator::getContext()->getService(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(); if (ref) { ctkEventAdmin* eventAdmin = mitk::PluginActivator::getContext()->getService(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); } } diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.h index 32aa9aac18..e1fd5249fe 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.h +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/DicomEventHandler.h @@ -1,42 +1,40 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 DicomEventHandler_h #define DicomEventHandler_h #include #include 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 index 434d32dfe8..25ae2f2911 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.cpp +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.cpp @@ -1,55 +1,53 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 "QmitkDicomDataEventPublisher.h" #include #include #include 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(); if (ref) { ctkEventAdmin* eventAdmin = context->getService(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 index 6ec7d2be10..6cb437bf25 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.h +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDataEventPublisher.h @@ -1,46 +1,44 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 QmitkDicomDataEventPublisher_H #define QmitkDicomDataEventPublisher_H #include #include 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 index 85489b35a0..f92f90138b 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.cpp +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.cpp @@ -1,126 +1,124 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 "QmitkDicomDirectoryListener.h" #include #include #include 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 index ceed36f1f0..a8f694ebee 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.h +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomDirectoryListener.h @@ -1,80 +1,80 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 QmitkDicomDirectoryListener_h #define QmitkDicomDirectoryListener_h #include #include #include #include #include #include #include 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 index 60cceb17c3..50e1a090a3 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.cpp +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.cpp @@ -1,244 +1,242 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 ); 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); m_StoreSCPLauncher->StartStoreSCP(); m_Controls.StoreSCPLabel->setText("Storage provider is running on port: "+storagePort); } 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/QmitkDicomEditor.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.h index 6b87a94cb7..bb5a35d6b4 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.h +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomEditor.h @@ -1,135 +1,133 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 QmitkDicomEditor_h #define QmitkDicomEditor_h #include #include #include #include "ui_QmitkDicomEditorControls.h" #include "QmitkDicomDirectoryListener.h" #include "QmitkStoreSCPLauncher.h" #include "QmitkStoreSCPLauncherBuilder.h" #include "DicomEventHandler.h" #include "QmitkDicomDataEventPublisher.h" #include #include #include #include #include #include #include #include #include #include /*! \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(); 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 start void StartStoreSCP(); /// \brief Called when StoreSCP should stop void StopStoreSCP(); /// \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 FolderCDButton was clicked. void OnFolderCDImport(); /// \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: void CreateQtPartControl(QWidget *parent); void 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/QmitkDicomPreferencePage.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.cpp index db34660ce2..61d4ae018f 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.cpp +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.cpp @@ -1,101 +1,101 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 "QmitkDicomPreferencePage.h" #include "QmitkDicomEditor.h" #include #include #include 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::ID); m_DicomPreferencesNode = prefService->GetSystemPreferences()->Node(QmitkDicomEditor::EDITOR_ID).Cast();; 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 index 5af834be5b..60f9ef3445 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.h +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkDicomPreferencePage.h @@ -1,88 +1,86 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 QmitkDicomPreferencePage_h #define QmitkDicomPreferencePage_h #include #include #include "ui_DicomPreferencePage.h" #include "berryIQtPreferencePage.h" #include "berryIQtPreferencePage.h" #include #include 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 index 38f04571a8..f70107e5b0 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.cpp +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.cpp @@ -1,142 +1,140 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 "QmitkStoreSCPLauncher.h" #include #include #include #include #include #include #include #include #include #include #include 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() { FindPathToStoreSCP(); MITK_INFO << m_PathToStoreSCP.toStdString(); m_StoreSCP->start(m_PathToStoreSCP,m_ArgumentList); } void QmitkStoreSCPLauncher::FindPathToStoreSCP() { if(m_PathToStoreSCP.isEmpty()) { QString fileName; #ifdef _WIN32 fileName = "/storescp.exe"; #else fileName = "/storescp"; #endif QString appPath= QCoreApplication::applicationDirPath(); appPath; m_PathToStoreSCP = appPath; m_PathToStoreSCP.append(fileName); //In developement the storescp isn't copied into bin directory if(!QFile::exists(m_PathToStoreSCP)) { m_PathToStoreSCP.clear(); appPath.append("/../../../DCMTK-install/bin"); m_PathToStoreSCP = appPath; m_PathToStoreSCP.append(fileName); } } } void QmitkStoreSCPLauncher::OnProcessError(QProcess::ProcessError err) { switch(err) { case QProcess::FailedToStart: MITK_INFO << QString("Failed to start storage provider: ").append(m_StoreSCP->errorString()).toStdString(); break; case QProcess::Crashed: MITK_INFO << QString("Storage provider crashed: ").append(m_StoreSCP->errorString()).toStdString(); break; case QProcess::Timedout: MITK_INFO << QString("Storage provider timeout: ").append(m_StoreSCP->errorString()).toStdString(); break; case QProcess::WriteError: MITK_INFO << QString("Storage provider write error: ").append(m_StoreSCP->errorString()).toStdString(); break; case QProcess::ReadError: MITK_INFO << QString("Storage provider read error: ").append(m_StoreSCP->errorString()).toStdString(); break; case QProcess::UnknownError: MITK_INFO << QString("Storage provider unknown error: ").append(m_StoreSCP->errorString()).toStdString(); break; default: MITK_INFO << QString("Storage provider unknown error: ").append(m_StoreSCP->errorString()).toStdString(); break; } } void QmitkStoreSCPLauncher::OnStateChanged(QProcess::ProcessState status) { switch(status) { case QProcess::NotRunning: MITK_INFO << QString("Storage provider not running: ").append(m_StoreSCP->errorString()).toStdString(); break; case QProcess::Starting: MITK_INFO << QString("Starting storage provider").toStdString(); break; case QProcess::Running: MITK_INFO << QString("Running storage provider").toStdString(); break; default: MITK_INFO << QString("Storage provider unknown error: ").append(m_StoreSCP->errorString()).toStdString(); 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; } diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.h b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.h index 22fbfb538d..1aa4ba7a19 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.h +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncher.h @@ -1,48 +1,47 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 QmitkStoreSCPLauncher_h #define QmitkStoreSCPLauncher_h #include #include #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: void FindPathToStoreSCP(); void SetArgumentList(QmitkStoreSCPLauncherBuilder* builder); QString ArgumentListToQString(); QString m_PathToStoreSCP; 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 index 56a310cede..c8aa1fb7e4 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.cpp +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.cpp @@ -1,109 +1,109 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 "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 index 35a4273b0d..1f0e532069 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.h +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/QmitkStoreSCPLauncherBuilder.h @@ -1,53 +1,51 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 QmitkStoreSCPLauncherBuilder_h #define QmitkStoreSCPLauncherBuilder_h #include #include 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 diff --git a/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.cpp b/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.cpp index ea1612c721..ec771fb529 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.cpp +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.cpp @@ -1,49 +1,47 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. -=========================================================================*/ +See LICENSE.txt or http://www.mitk.org for details. +===================================================================*/ #include "mitkPluginActivator.h" #include #include "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 index a9bdd73875..90aa1c78d5 100644 --- a/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.h +++ b/Plugins/org.mitk.gui.qt.dicom/src/internal/mitkPluginActivator.h @@ -1,43 +1,41 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. -=========================================================================*/ +See LICENSE.txt or http://www.mitk.org for details. +===================================================================*/ #ifndef MITKPLUGINACTIVATOR_H #define MITKPLUGINACTIVATOR_H #include 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/src/QmitkOpenDicomEditorAction.cpp b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.cpp index 6622b27f20..f9468dd0c3 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.cpp +++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.cpp @@ -1,116 +1,115 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2010-01-16 19:57:43 +0100 (Sa, 16 Jan 2010) $ -Version: $Revision: 21070 $ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 "QmitkOpenDicomEditorAction.h" #include #include #include #include "mitkCoreObjectFactory.h" #include "mitkSceneIO.h" #include "mitkProgressBar.h" #include #include #include #include #include #include #include #include #include "mitkProperties.h" #include "mitkNodePredicateData.h" #include "mitkNodePredicateNot.h" #include "mitkNodePredicateProperty.h" //#include 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(m_Window->GetShell()->GetControl())); this->setText("&DICOM"); this->setToolTip("Open dicom tool"); berry::IPreferencesService::Pointer prefService = berry::Platform::GetServiceRegistry() .GetServiceById(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().IsNull()) //{ // editorInput = new mitk::DataStorageEditorInput(); // dataStorage = editorInput->GetDataStorageReference()->GetDataStorage(); //} //else //{ // multiWidgetEditor = editor.Cast(); // dataStorage = multiWidgetEditor->GetEditorInput().Cast()->GetDataStorageReference()->GetDataStorage(); //} //if (multiWidgetEditor.IsNull()) //{ // //berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID); // multiWidgetEditor = editor.Cast(); //} //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 index e6321c9a23..fbde21443b 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.h +++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenDicomEditorAction.h @@ -1,55 +1,54 @@ -/*========================================================================= +/*=================================================================== -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2010-01-16 19:57:43 +0100 (Sa, 16 Jan 2010) $ -Version: $Revision: 21070 $ +The Medical Imaging Interaction Toolkit (MITK) -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. +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 the above copyright notices for more information. +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 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 #endif #include #include #include #include #include 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_*/