diff --git a/Plugins/org.mitk.gui.qt.xnatinterface/plugin.xml b/Plugins/org.mitk.gui.qt.xnatinterface/plugin.xml index 76ec9b3883..2a449dc03a 100644 --- a/Plugins/org.mitk.gui.qt.xnatinterface/plugin.xml +++ b/Plugins/org.mitk.gui.qt.xnatinterface/plugin.xml @@ -1,11 +1,11 @@ - - - + + + diff --git a/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjects.cpp b/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjects.cpp index b4c498f94b..f252def372 100644 --- a/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjects.cpp +++ b/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjects.cpp @@ -1,434 +1,325 @@ -/*========================================================================= +/*=================================================================== -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 "XNATProjects.h" // Standard #include #include #include +// CTK Widgets +//#include "ctkXnatLoginDialog.h" + +// CTK Core +#include "ctkXnatServer.h" +#include "ctkXnatConnectionFactory.h" +#include "ctkXnatConnection.h" +#include "ctkXnatProject.h" +#include "ctkXnatSubject.h" +#include "ctkXnatListModel.h" +#include "ctkXnatScanFolder.h" + // Blueberry #include #include -// Qmitk -#include "XNATProjects.h" - // Qt +#include +#include #include #include #include #include #include #include #include #include +#include +#include // Poco #include "Poco/Net/HTTPClientSession.h" #include "Poco/Net/HTTPRequest.h" #include "Poco/Net/HTTPResponse.h" #include "Poco/Net/HTTPBasicCredentials.h" #include "Poco/DOM/NodeList.h" #include "Poco/SAX/InputSource.h" #include "Poco/URI.h" #include "Poco/NumberParser.h" #include "Poco/SAX/SAXParser.h" #include "Poco/DOM/DOMParser.h" #include "Poco/DOM/Document.h" #include "Poco/DOM/NodeIterator.h" #include "Poco/DOM/NodeFilter.h" #include "Poco/DOM/AutoPtr.h" #include "Poco/DOM/Node.h" #include "Poco/StreamCopier.h" -// Boost -//#include "boost/smart_ptr.h" +const std::string XNATProjects::EDITOR_ID = "org.mitk.editors.xnatprojects"; + +XNATProjects::XNATProjects() : + m_ConnectionFactory(new ctkXnatConnectionFactory()), + m_Connection(0), + m_ProjectsModel(new ctkXnatListModel()), + m_SubjectsModel(new ctkXnatListModel()), + m_ExperimentsModel(new ctkXnatListModel()), + m_ScansModel(new ctkXnatListModel()), + m_ResourceModel(new ctkXnatListModel()) +{ + +} + +XNATProjects::~XNATProjects() +{ + if ( m_Connection ) delete m_Connection; + delete m_ConnectionFactory; + delete m_SubjectsModel; + delete m_ProjectsModel; + delete m_ExperimentsModel; + delete m_ScansModel; + delete m_ResourceModel; +} + +bool XNATProjects::IsDirty() const +{ + return false; +} -//qRestAPI -//konnte noch nicht eingebunden werden deshalb wird Poco benutzt +bool XNATProjects::IsSaveAsAllowed() const +{ + return false; +} -const std::string XNATProjects::VIEW_ID = "org.mitk.views.xnatprojects"; -const std::string QUERY_PATH = "/data/archive/projects?format=xml"; -const std::string QUERY = ""; -const int COUNT_PROJECT_COLUMNS_OR_ROWS = 7; +void XNATProjects::Init(berry::IEditorSite::Pointer site, berry::IEditorInput::Pointer input) +{ + this->SetSite(site); + this->SetInput(input); +} + +void XNATProjects::DoSave() +{ +} + +void XNATProjects::DoSaveAs() +{ +} void XNATProjects::SetFocus() { m_Controls.buttonGetAllProjects->setFocus(); + m_Controls.buttonLoginDialog->setFocus(); } void XNATProjects::CreateQtPartControl( QWidget *parent ) { // create GUI widgets from the Qt Designer's .ui file m_Controls.setupUi( parent ); + + m_Controls.projectTreeView->setModel(m_ProjectsModel); + m_Controls.subjectTreeView->setModel(m_SubjectsModel); + m_Controls.experimentTreeView->setModel(m_ExperimentsModel); + m_Controls.scanTreeView->setModel(m_ScansModel); + m_Controls.resourceTreeView->setModel(m_ResourceModel); + connect( m_Controls.buttonGetAllProjects, SIGNAL(clicked()), this, SLOT(GetAllProjects()) ); + connect( m_Controls.projectTreeView, SIGNAL(clicked(QModelIndex)), SLOT(projectSelected(QModelIndex)) ); + connect( m_Controls.subjectTreeView, SIGNAL(clicked(QModelIndex)), SLOT(subjectSelected(QModelIndex)) ); + connect( m_Controls.experimentTreeView, SIGNAL(clicked(QModelIndex)), SLOT(experimentSelected(QModelIndex)) ); + connect( m_Controls.scanTreeView, SIGNAL(clicked(QModelIndex)), SLOT(scanSelected(QModelIndex)) ); + + connect( m_Controls.buttonLoginDialog, SIGNAL(clicked()), this, SLOT(OpenLoginDialog()) ); } -void XNATProjects::OnSelectionChanged( berry::IWorkbenchPart::Pointer /*source*/, - const QList& nodes ) -{ +void XNATProjects::OnSelectionChanged( berry::IWorkbenchPart::Pointer /*source*/, const QList& nodes ) +{ // iterate all selected objects, adjust warning visibility //foreach( mitk::DataNode::Pointer node, nodes ) //{ // if( node.IsNotNull() && dynamic_cast(node->GetData()) ) // { // m_Controls.labelWarning->setVisible( false ); // m_Controls.buttonGetAllProjects->setEnabled( true ); // return; // } //} - //m_Controls.labelWarning->setVisible( true ); //m_Controls.buttonGetAllProjects->setEnabled( false ); } - +/** +\brief To get all Projects +*/ void XNATProjects::GetAllProjects() -{ - //*********************************************** - /*******************MockUpCode******************* - //XNATProjects::model.reset(new StandardItemModel()); - QStandardItemModel* projectModel = new QStandardItemModel(); - QStandardItemModel* detailModel = new QStandardItemModel(); - QStandardItemModel* subjectModel = new QStandardItemModel(); - QStandardItemModel* experimentModel = new QStandardItemModel(); - //QScopePointer::QScopedPointer projectModelScopedPtr(new QStandardItemModel()); - - QStringList project(QString("Projects")); - QStringList detail(QString("Details of the chosen project")); - QStringList subject(QString("Subjects")); - QStringList experiment(QString("Experiments")); - - projectModel->setHorizontalHeaderLabels(project); - detailModel->setHorizontalHeaderLabels(detail); - subjectModel->setHorizontalHeaderLabels(subject); - experimentModel->setHorizontalHeaderLabels(experiment); - - QTreeView* projectView = m_Controls.projectTreeView; - QTreeView* detailView = m_Controls.detailTreeView; - QTreeView* subjectView = m_Controls.subjectTreeView; - QTreeView* experimentView = m_Controls.experimentTreeView; - - //QStandardItem* projectRoot = projectModel->invisibleRootItem(); - //QStandardItem* detailRoot = detailModel->invisibleRootItem(); - //QStandardItem* subjectRoot = subjectModel->invisibleRootItem(); - //QStandardItem* experimentRoot = experimentModel->invisibleRootItem(); - - projectModel->appendRow(new QStandardItem("prj001")); - detailModel->appendRow(new QStandardItem("Secondary_ID")); - subjectModel->appendRow(new QStandardItem("prj001_sub001")); - experimentModel->appendRow(new QStandardItem("prj001_sub001_exp001")); - - projectView->setModel(projectModel); - detailView->setModel(detailModel); - subjectView->setModel(subjectModel); - experimentView->setModel(experimentModel); - - projectView->show(); - detailView->show(); - subjectView->show(); - experimentView->show(); - - **********************************************/ - - /* ********************AUSKOMMENTIERT ZU MOCKUP ZWECKEN ************************ - ******************************************************************************** - */// AUSKOMMENTIERT ZU MOCKUP ZWECKEN ****************************************** - - // Assign existing treeView to mytree(View) - QTreeView* myTree = m_Controls.projectTreeView; - - // MEMBER SCOPED POINTER - projectModel.reset(new QStandardItemModel()); - QStandardItemModel* model = projectModel.data(); - - // Normaler RAW Pointer - //QStandardItemModel* model = new QStandardItemModel(); - /*QList columns; - columns.append(new QStandardItem("Projects")); - columns.append(new QStandardItem("Subjects")); - columns.append(new QStandardItem("Experiments")); - model->appendColumn(columns);*/ - +{ // Clear existing treeView - myTree->setModel(model); - myTree->show(); - + m_SubjectsModel->setRootObject(ctkXnatObject::Pointer()); + m_ExperimentsModel->setRootObject(ctkXnatObject::Pointer()); + m_ScansModel->setRootObject(ctkXnatObject::Pointer()); + m_ResourceModel->setRootObject(ctkXnatObject::Pointer()); + m_Controls.subjectTreeView->reset(); + m_Controls.experimentTreeView->reset(); + m_Controls.scanTreeView->reset(); + m_Controls.resourceTreeView->reset(); + // Validate user input if ( m_Controls.inHostAddress->text().isEmpty() || m_Controls.inUser->text().isEmpty() || m_Controls.inPassword->text().isEmpty() ) { - if ( m_Controls.inHostAddress->text().isEmpty() ) + if ( m_Controls.inHostAddress->text().isEmpty() ) { MITK_INFO << "No host address!"; m_Controls.inHostAddress->setStyleSheet("QLineEdit{ background-color: rgb(255,0,0) }"); } if ( m_Controls.inUser->text().isEmpty() ) { MITK_INFO << "No user !"; m_Controls.inUser->setStyleSheet("QLineEdit{ background-color: rgb(255,0,0) }"); } if ( m_Controls.inPassword->text().isEmpty() ) { MITK_INFO << "No password!"; m_Controls.inPassword->setStyleSheet("QLineEdit{ background-color: rgb(255,0,0) }"); } return; } else { m_Controls.inHostAddress->setStyleSheet("QLineEdit{ background-color: rgb(255,255,255) }"); m_Controls.inUser->setStyleSheet("QLineEdit{ background-color: rgb(255,255,255) }"); m_Controls.inPassword->setStyleSheet("QLineEdit{ background-color: rgb(255,255,255) }"); } - // Set input URI from MITK user - std::string uri = m_Controls.inHostAddress->text().toStdString(); - uri += QUERY_PATH; - Poco::URI projectURI = Poco::URI(uri); - // Regular Expression for uri - std::string uriregex = "^(https?)://([a-zA-Z0-9\.]+):([0-9]+)(/[^ /]+)*$"; + QRegExp uriregex("^(https?)://([a-zA-Z0-9\\.]+):([0-9]+)(/[^ /]+)*$"); // Validate address - if ( ! std::tr1::regex_match( m_Controls.inHostAddress->text().toStdString(), std::tr1::regex(uriregex) ) ) + if ( ! uriregex.exactMatch(m_Controls.inHostAddress->text()) ) { MITK_INFO << m_Controls.inHostAddress->text().toStdString(); MITK_INFO << "Host address not valid"; m_Controls.inHostAddress->setStyleSheet("QLineEdit{ background-color: rgb(255,0,0) }"); return; } - else + else { m_Controls.inHostAddress->setStyleSheet("QLineEdit{ background-color: rgb(255,255,255) }"); } - // Set query path - std::string path = projectURI.getPathAndQuery(); + // create ctkXnatConnection + m_Connection = m_ConnectionFactory->makeConnection(m_Controls.inHostAddress->text(), m_Controls.inUser->text(), m_Controls.inPassword->text()); + ctkXnatServer::Pointer server(ctkXnatServer::Create(m_Connection)); - // Create session and request - Poco::Net::HTTPClientSession session(projectURI.getHost(), projectURI.getPort()); - Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, path, Poco::Net::HTTPMessage::HTTP_1_1); + // fetch projects from server + server->fetch(); - // Add username and password (HTTP basic authentication) to the request. - Poco::Net::HTTPBasicCredentials cred(m_Controls.inUser->text().toStdString(), m_Controls.inPassword->text().toStdString()); - cred.authenticate(request); + // list projects + m_ProjectsModel->setRootObject(server); - // Send the request - session.sendRequest(request); + // Set tree visible + m_Controls.projectTreeView->reset(); +} + +/** +\brief ******** SEARCH ******** +*/ +void XNATProjects::SearchWithXmlFilePath(QString filepath) +{ + /* + bla.. blaa... blaaa.... + */ +} - // Receive the response. - Poco::Net::HTTPResponse response; - std::istream& rs = session.receiveResponse(response); +/** +\brief Converts a Poco::XML::XMLString to QString +*/ +QString XNATProjects::ConvertFromXMLString(const Poco::XML::XMLString xmlstr) +{ + const char* cstr = (Poco::XML::fromXMLString(xmlstr).c_str()); + QString qstr = cstr; + return qstr; +} - MITK_INFO << "HTTP Statuscode: " << response.getStatus(); +/** +\brief *****DOES NOT THAT WHAT IT IS THERE FOR***** +*/ +void XNATProjects::OpenLoginDialog() +{ +} - // Checks th HTTP Statuscode - if ( response.getStatus() != Poco::Net::HTTPResponse::HTTP_OK ) +/** +\brief *****fetchs subjects from chosen project***** +*/ +void XNATProjects::projectSelected(const QModelIndex& index) +{ + QVariant variant = m_ProjectsModel->data(index, Qt::UserRole); + if (variant.isValid()) { - MITK_ERROR << "HTTP STATUSCODE NOT OK"; - MITK_ERROR << "Getting all projects failed!"; - return; + ctkXnatObject::Pointer project = variant.value(); + project->fetch(); + m_SubjectsModel->setRootObject(project); + m_Controls.subjectTreeView->reset(); } +} - //TEST für ausgabe ohne QTreeView (nur Konsole) - //Poco::StreamCopier::copyStream(rs, std::cout); - - Poco::XML::InputSource inXML(rs); - - Poco::XML::DOMParser parser; - Poco::AutoPtr pDoc = parser.parse(&inXML); - Poco::XML::NodeIterator it(pDoc, Poco::XML::NodeFilter::SHOW_ALL); - Poco::XML::Node* pNode = it.nextNode(); - - - QStandardItem* rootNode = model->invisibleRootItem(); - - // Set header label - QStringList strlist(QString("Projects")); - model->setHorizontalHeaderLabels(strlist); - - //defining list - QList list; - - while (pNode) +/** +\brief *****fetchs experiments from chosen subject***** +*/ +void XNATProjects::subjectSelected(const QModelIndex& index) +{ + QVariant variant = m_SubjectsModel->data(index, Qt::UserRole); + if (variant.isValid()) { - //Converting - QString text = ConvertFromXMLString(pNode->nodeName()); - - if (text == QString("row")) - { - pNode = it.nextNode(); - text = ConvertFromXMLString(pNode->nodeName()); - - if ( text == QString("cell") ){ - pNode = it.nextNode(); - text = QString("ID: ") + ConvertFromXMLString(pNode->nodeValue()).toStdString().c_str(); - QStandardItem* id = new QStandardItem(text); - rootNode->appendRow(id); - - //defining Items - QStandardItem* details = new QStandardItem("Details"); - QStandardItem* secondaryId = new QStandardItem("secondary_ID"); - QStandardItem* name = new QStandardItem("name"); - QStandardItem* description = new QStandardItem("description"); - QStandardItem* piFirstname = new QStandardItem("pi_firstname"); - QStandardItem* piLastname = new QStandardItem("pi_lastname"); - QStandardItem* uri = new QStandardItem("URI"); - - //filling list - list.append(secondaryId); - list.append(name); - list.append(description); - list.append(piFirstname); - list.append(piLastname); - list.append(uri); - - //refering - id->appendRow(details); - details->appendRows(list); - - //clear list - list.clear(); - - //next cell - pNode = it.nextNode(); - QString wstr = ConvertFromXMLString(pNode->nodeName()); - - for ( int i = 0; i < 6; i++ ) - { - if ( wstr == QString("cell") ) - { - pNode = it.nextNode(); - - //breaks if a cell has no value and node is "cell" again - if ( ConvertFromXMLString(pNode->nodeName()) == QString("cell") ) - continue; - - text = ConvertFromXMLString(pNode->nodeValue()); - QStandardItem* item0 = new QStandardItem(); - QStandardItem* item1 = new QStandardItem(); - QStandardItem* item2 = new QStandardItem(); - QStandardItem* item3 = new QStandardItem(); - QStandardItem* item4 = new QStandardItem(); - QStandardItem* item5 = new QStandardItem(); - - //generating and refering - switch(i) - { - case 0: - item0->setText(text); - secondaryId->appendRow(item0); - break; - case 1: - item1->setText(text); - name->appendRow(item1); - break; - case 2: - item2->setText(text); - description->appendRow(item2); - break; - case 3: - item3->setText(text); - piFirstname->appendRow(item3); - break; - case 4: - item4->setText(text); - piLastname->appendRow(item4); - break; - case 5: - item5->setText(text); - uri->appendRow(item5); - break; - default: - MITK_ERROR << "Fatal Error! Please call your Administrator!"; - break; - } - //next cell - pNode = it.nextNode(); - wstr = ConvertFromXMLString(pNode->nodeName()); - } - } - //clear list - list.clear(); - } - } - if ( !(ConvertFromXMLString(pNode->nodeName()) == QString("row")) ) - pNode = it.nextNode(); + ctkXnatObject::Pointer subject = variant.value(); + subject->fetch(); + m_ExperimentsModel->setRootObject(subject); + m_Controls.experimentTreeView->reset(); } - MITK_INFO << "Project tree has been drawn"; - - // Set tree visible - myTree->setModel(model); - myTree->show(); } /** -\brief ******** SEARCH ******** +\brief *****fetchs data from chosen experiment***** */ -void XNATProjects::SearchWithXmlFilePath(QString filepath){ -/* - - // Search-URI - Poco::URI searchUri("http://localhost:12345/xnat/data/search"); - searchUri.setQuery("format=xml&body=" + filepath); - - // Create session and request - Poco::Net::HTTPClientSession session(projectURI.getHost(), projectURI.getPort()); - Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, searchUri.getPathAndQuery();, Poco::Net::HTTPMessage::HTTP_1_1); - - // Add username and password (HTTP basic authentication) to the request. - Poco::Net::HTTPBasicCredentials cred("admin", "admin"); - cred.authenticate(request); - - // Fill request-body with xml-file - request.setContentType("text/xml; charset=utf-8"); - request.setContentLength(); - request << - - // Send the request - session.sendRequest(request); - - // Receive the response. - Poco::Net::HTTPResponse response; - std::istream& rs = session.receiveResponse(response); - - std::ifstream fis("C:/Users/knorr/Desktop/einfacheSubjectIdAbfrage.xml"); - - Poco::XML::InputSource inXML(fis); - - Poco::XML::DOMParser parser; - Poco::AutoPtr pDoc = parser.parse(&inXML); - Poco::XML::Document(pDoc.get()); - Poco::XML::NodeIterator it(pDoc, Poco::XML::NodeFilter::SHOW_ALL); - Poco::XML::Node* pNode = it.nextNode(); - - while(pNode){ - request - it.nextNode(); +void XNATProjects::experimentSelected(const QModelIndex& index) +{ + QVariant variant = m_ExperimentsModel->data(index, Qt::UserRole); + if (variant.isValid()) + { + ctkXnatObject::Pointer experiment = variant.value(); + experiment->fetch(); + ctkXnatObject::Pointer scanfolder = experiment->children().takeFirst(); + scanfolder->fetch(); + m_ScansModel->setRootObject(scanfolder); + m_Controls.scanTreeView->reset(); + MITK_INFO << scanfolder->children().takeFirst()->uri().toStdString(); } -*/ } /** -\brief Converts a Poco::XML::XMLString to QString +\brief *****fetchs download data from chosen experiment***** */ -QString XNATProjects::ConvertFromXMLString(const Poco::XML::XMLString xmlstr) +void XNATProjects::scanSelected(const QModelIndex& index) { - const char* cstr = (Poco::XML::fromXMLString(xmlstr).c_str()); - QString qstr = cstr; - return qstr; -} \ No newline at end of file + QVariant variant = m_ScansModel->data(index, Qt::UserRole); + if (variant.isValid()) + { + ctkXnatObject::Pointer scan = variant.value(); + scan->fetch(); + m_ResourceModel->setRootObject(scan); + m_Controls.resourceTreeView->reset(); + MITK_INFO << scan->children().takeAt(2)->uri().toStdString(); + } +} diff --git a/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjects.h b/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjects.h index 8c8c5c1a36..05ed015a6c 100644 --- a/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjects.h +++ b/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjects.h @@ -1,82 +1,103 @@ -/*========================================================================= +/*=================================================================== -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 XNATProjects_h #define XNATProjects_h +#include #include +#include "berryIEditorInput.h" +#include "berryIEditorSite.h" #include #include "ui_XNATProjectsControls.h" #include "Poco/DOM/Node.h" #include "Poco/URI.h" #include #include +#include + +#include "ctkXnatListModel.h" +#include "ctkXnatConnectionFactory.h" +#include "ctkXnatConnection.h" /*! \brief XNATProjects \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 XNATProjects : public QmitkAbstractView -{ +class XNATProjects : public berry::QtEditorPart +{ // 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: - QScopedPointer projectModel; - QScopedPointer subjectModel; - QScopedPointer experimentModel; - - static const std::string VIEW_ID; - - virtual void CreateQtPartControl(QWidget *parent); +public: + XNATProjects(); + ~XNATProjects(); + static const std::string EDITOR_ID; + void CreateQtPartControl(QWidget *parent); void SearchWithXmlFilePath(QString filepath); + void DoSave(/*IProgressMonitor monitor*/); + void DoSaveAs(); + void Init(berry::IEditorSite::Pointer site, berry::IEditorInput::Pointer input); + bool IsDirty() const; + bool IsSaveAsAllowed() const; + protected slots: /// \brief Called when the user clicks the GUI button void GetAllProjects(); + void OpenLoginDialog(); + void projectSelected(const QModelIndex& index); + void subjectSelected(const QModelIndex& index); + void experimentSelected(const QModelIndex& index); + void scanSelected(const QModelIndex& index); protected: virtual void SetFocus(); /// \brief called by QmitkFunctionality when DataManager's selection has changed virtual void OnSelectionChanged( berry::IWorkbenchPart::Pointer source, const QList& nodes ); Ui::XNATProjectsControls m_Controls; private: - + //QMap::QMap m_Profiles; QString ConvertFromXMLString(const Poco::XML::XMLString); + ctkXnatConnectionFactory* m_ConnectionFactory; + ctkXnatConnection* m_Connection; + ctkXnatListModel* m_ProjectsModel; + ctkXnatListModel* m_SubjectsModel; + ctkXnatListModel* m_ExperimentsModel; + ctkXnatListModel* m_ScansModel; + ctkXnatListModel* m_ResourceModel; }; #endif // XNATProjects_h - diff --git a/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjectsControls.ui b/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjectsControls.ui index ca1d8c9555..035b4bbf3d 100644 --- a/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjectsControls.ui +++ b/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/XNATProjectsControls.ui @@ -1,159 +1,161 @@ XNATProjectsControls 0 0 838 975 0 0 QmitkTemplate xnat_icon.icoxnat_icon.ico QLabel { color: rgb(255, 0, 0) } Please insert your XNAT host address: 230 0 - <html><head/><body><p>Example: &quot;http://localhost:8080/xnat&quot;</p><p>Example: &quot;http://central.xnat.org:80&quot;</p><p>Example: &quot;https://xnat.myserver.de:443&quot;</p></body></html> + <html><head/><body><p>Examples:</p><p>&quot;http://localhost:8080/xnat&quot;</p><p>&quot;http://central.xnat.org:80&quot;</p><p>&quot;https://xnat.myserver.de:443&quot;</p></body></html> + + + http://localhost:12345/xnat http(s)://host:port/pathToXnatServerInstance + + admin + User 53 0 + + admin + QLineEdit::Password Password - - - - Example: "http://localhost:8080/xnat" - - - Example: "http://localhost:8080/xnat" - - - - - - - Example: "http://central.xnat.org:80" - - - - - - - Example: "https://xnat.myserver.de:443" - - - true Get all projects Get all projects + + + + Login Dialog + + + - - + + - - + + Download Upload + + + + + + + + + + diff --git a/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/org_mitk_gui_qt_xnatinterface_Activator.h b/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/org_mitk_gui_qt_xnatinterface_Activator.h index 033fd35117..9e01c136e0 100644 --- a/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/org_mitk_gui_qt_xnatinterface_Activator.h +++ b/Plugins/org.mitk.gui.qt.xnatinterface/src/internal/org_mitk_gui_qt_xnatinterface_Activator.h @@ -1,41 +1,40 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ - -Copyright (c) German Cancer Research Center, Division of Medical and -Biological Informatics. All rights reserved. -See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ #ifndef org_mitk_gui_qt_xnatinterface_Activator_h #define org_mitk_gui_qt_xnatinterface_Activator_h #include namespace mitk { class org_mitk_gui_qt_xnatinterface_Activator : public QObject, public ctkPluginActivator { Q_OBJECT Q_INTERFACES(ctkPluginActivator) public: void start(ctkPluginContext* context); void stop(ctkPluginContext* context); }; // org_mitk_gui_qt_xnatinterface_Activator } #endif // org_mitk_gui_qt_xnatinterface_Activator_h