]> Creatis software - clitk.git/commitdiff
pacs only if clitk_use_system_gdcm is defined
authorcervenansky <frederic.cervenansky@creatis.insa-lyon.fr>
Fri, 5 Jul 2013 15:20:49 +0000 (17:20 +0200)
committercervenansky <frederic.cervenansky@creatis.insa-lyon.fr>
Fri, 5 Jul 2013 15:20:49 +0000 (17:20 +0200)
14 files changed:
vv/CMakeLists.txt
vv/qt_ui/vvMainWindow.ui
vv/qt_ui/vvPacsConnection.ui
vv/qt_ui/vvPacsSettingsDialog.ui [new file with mode: 0644]
vv/vv.cxx
vv/vvIcons.qrc
vv/vvMainWindow.cxx
vv/vvMainWindow.h
vv/vvPacsSettingsDialog.cxx [new file with mode: 0644]
vv/vvPacsSettingsDialog.h [new file with mode: 0644]
vv/vvQPacsConnection.cxx
vv/vvQPacsConnection.h
vv/vvUtils.cxx
vv/vvUtils.h

index 025a6f41d18ebbf7d2322019bc76f7d6237825f6..acbc86ce05e09ea7f35e59296f6840933db398dd 100644 (file)
@@ -86,7 +86,7 @@ SET(vv_SRCS
   vvSlicerManager.cxx
   vvSlicerManagerCommand.cxx
   vvUtils.cxx
-  vvMesh.cxx
+#  vvMaximumIntensityProjection.cxx  vvMesh.cxx
   vvMeshActor.cxx
   vvMeshReader.cxx
   vvMidPosition.cxx
@@ -122,17 +122,21 @@ QT4_WRAP_UI(vv_UI_CXX
   qt_ui/vvHelpDialog.ui 
   qt_ui/vvDocumentation.ui 
   qt_ui/vvDicomSeriesSelector.ui
-  )
+qt_ui/vvDummyWindow.ui #For testing  )
 
 QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
 
-# Add DICOM gui selector if the adequate GDCM is available
-IF(CLITK_USE_SYSTEM_GDCM)
+# Add DICOM SERVER gui selector if the adequate GDCM is available
+#IF(CLITK_USE_SYSTEM_GDCM)
+message("ololoa")
   SET(vv_SRCS ${vv_SRCS}
-      vvQPacsConnection.cxx)
-  QT4_WRAP_CPP(vv_SRCS vvQPacsConnection.cxx)
-  QT4_WRAP_UI(vv_UI_CXX qt_ui/vvPacsConnection.ui)
-ENDIF(CLITK_USE_SYSTEM_GDCM)
+      vvQPacsConnection.cxx
+         vvPacsSettingsDialog.cxx)
+  QT4_WRAP_CPP(vv_SRCS vvQPacsConnection.cxx
+     vvPacsSettingsDialog.cxx)
+  QT4_WRAP_UI(vv_UI_CXX qt_ui/vvPacsConnection.ui
+     qt_ui/vvPacsSettingsDialog.ui)
+#ENDIF(CLITK_USE_SYSTEM_GDCM)
 
 # Add the autotools in the header vvToolsList.h for initialization of the dummy
 # variables in vv.cxx for the tools contained in vvLib
index 5cf4b33b473fdff99dead3057a7ea2bd0babc21d..c86d6c892ff3a3270ec4c7000be7a6187e9adf29 100644 (file)
      <x>0</x>
      <y>0</y>
      <width>1008</width>
-     <height>20</height>
+     <height>21</height>
     </rect>
    </property>
    <property name="defaultUp">
     <addaction name="actionExit"/>
     <addaction name="separator"/>
     <addaction name="separator"/>
+    <addaction name="actionConnect_Pacs"/>
    </widget>
    <addaction name="menuFile"/>
    <addaction name="menuOverlay"/>
     <bool>true</bool>
    </property>
   </action>
+  <action name="actionConnect_Pacs">
+   <property name="text">
+    <string>Connect Pacs</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>
index 086b50a6e181209a83dd4bd5e0aeba8d259e18ac..6e50ca11b2871f5626aa01285ab4027551eb4a70 100644 (file)
    </property>
    <property name="icon">
     <iconset>
-     <normaloff>basket_download.png</normaloff>basket_download.png</iconset>
+     <normaloff>../icons/basket_download.png</normaloff>../icons/basket_download.png</iconset>
    </property>
    <property name="iconSize">
     <size>
    <property name="title">
     <string>Studies</string>
    </property>
-  </widget>
-  <widget class="QTreeView" name="studyTreeView">
-   <property name="geometry">
-    <rect>
-     <x>410</x>
-     <y>150</y>
-     <width>411</width>
-     <height>231</height>
-    </rect>
-   </property>
+   <widget class="QTreeView" name="studyTreeView">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>20</y>
+      <width>411</width>
+      <height>231</height>
+     </rect>
+    </property>
+   </widget>
   </widget>
   <widget class="QTreeView" name="seriesTreeView">
    <property name="geometry">
     </rect>
    </property>
    <property name="currentIndex">
-    <number>1</number>
+    <number>0</number>
    </property>
    <widget class="QWidget" name="modalityTab">
     <property name="enabled">
     </rect>
    </property>
    <property name="currentIndex">
-    <number>1</number>
+    <number>0</number>
    </property>
    <widget class="QWidget" name="networkSelect">
     <attribute name="title">
      <string>Network</string>
     </attribute>
-    <widget class="QCheckBox" name="checkBox">
-     <property name="geometry">
-      <rect>
-       <x>10</x>
-       <y>10</y>
-       <width>101</width>
-       <height>17</height>
-      </rect>
-     </property>
-     <property name="text">
-      <string>HCL Neuro</string>
-     </property>
-    </widget>
-    <widget class="QCheckBox" name="checkBox_2">
+    <widget class="QComboBox" name="networkCombo">
      <property name="geometry">
       <rect>
-       <x>10</x>
+       <x>20</x>
        <y>40</y>
-       <width>70</width>
-       <height>17</height>
+       <width>191</width>
+       <height>22</height>
       </rect>
      </property>
-     <property name="text">
-      <string>conquest</string>
-     </property>
     </widget>
    </widget>
    <widget class="QWidget" name="networkConfig">
       <string>OK</string>
      </property>
     </widget>
-    <widget class="QWidget" name="">
+    <widget class="QWidget" name="layoutWidget">
      <property name="geometry">
       <rect>
        <x>0</x>
        <y>0</y>
        <width>179</width>
-       <height>100</height>
+       <height>120</height>
       </rect>
      </property>
      <layout class="QGridLayout" name="gridLayout">
       <item row="0" column="1">
        <widget class="QLineEdit" name="NameEdit"/>
       </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="label_ID_2">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-        <property name="text">
-         <string>AE Title</string>
-        </property>
-       </widget>
-      </item>
       <item row="1" column="1">
        <widget class="QLineEdit" name="AETitleEdit"/>
       </item>
       <item row="3" column="1">
        <widget class="QLineEdit" name="PortEdit"/>
       </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_ID_2">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>AE Title</string>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </widget>
    </property>
    <property name="icon">
     <iconset>
-     <normaloff>edit.png</normaloff>edit.png</iconset>
+     <normaloff>../icons/edit.png</normaloff>../icons/edit.png</iconset>
    </property>
    <property name="iconSize">
     <size>
     <string>Options</string>
    </property>
   </widget>
+  <zorder>groupBox_4</zorder>
+  <zorder>groupBox_3</zorder>
+  <zorder>label_ID</zorder>
+  <zorder>text_ID</zorder>
+  <zorder>scanButton</zorder>
+  <zorder>clearButton</zorder>
+  <zorder>text_NAME</zorder>
+  <zorder>label_NAME</zorder>
+  <zorder>importButton</zorder>
+  <zorder>groupBox</zorder>
+  <zorder>groupBox_2</zorder>
+  <zorder>seriesTreeView</zorder>
+  <zorder>imagesTreeView</zorder>
+  <zorder>text_PHYS</zorder>
+  <zorder>label_PHYS</zorder>
+  <zorder>label_SDESC</zorder>
+  <zorder>text_SDESC</zorder>
+  <zorder>tabFilter</zorder>
+  <zorder>tabNetwork</zorder>
+  <zorder>label_2</zorder>
+  <zorder>label_help</zorder>
+  <zorder>helpButton</zorder>
+  <zorder>optionsButton</zorder>
+  <zorder>label_email_2</zorder>
  </widget>
  <resources>
-  <include location="icones.qrc"/>
+  <include location="../vvIcons.qrc"/>
  </resources>
  <connections/>
 </ui>
diff --git a/vv/qt_ui/vvPacsSettingsDialog.ui b/vv/qt_ui/vvPacsSettingsDialog.ui
new file mode 100644 (file)
index 0000000..a64e15d
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvPacsSettingsDialog</class>
+ <widget class="QDialog" name="vvPacsSettingsDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>201</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>PACS settings</string>
+  </property>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>160</y>
+     <width>341</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QWidget" name="layoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>20</y>
+     <width>361</width>
+     <height>120</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="0" column="0">
+     <widget class="QLabel" name="label_ID_3">
+      <property name="enabled">
+       <bool>false</bool>
+      </property>
+      <property name="text">
+       <string>Name</string>
+      </property>
+     </widget>
+    </item>
+    <item row="0" column="1">
+     <widget class="QLineEdit" name="NameEdit"/>
+    </item>
+    <item row="1" column="1">
+     <widget class="QLineEdit" name="AETitleEdit"/>
+    </item>
+    <item row="2" column="0">
+     <widget class="QLabel" name="label_ID_4">
+      <property name="enabled">
+       <bool>false</bool>
+      </property>
+      <property name="text">
+       <string>Adress</string>
+      </property>
+     </widget>
+    </item>
+    <item row="2" column="1">
+     <widget class="QLineEdit" name="AdressEdit"/>
+    </item>
+    <item row="3" column="0">
+     <widget class="QLabel" name="label_ID_5">
+      <property name="enabled">
+       <bool>false</bool>
+      </property>
+      <property name="text">
+       <string>Port</string>
+      </property>
+     </widget>
+    </item>
+    <item row="3" column="1">
+     <widget class="QLineEdit" name="PortEdit"/>
+    </item>
+    <item row="1" column="0">
+     <widget class="QLabel" name="label_ID_2">
+      <property name="enabled">
+       <bool>false</bool>
+      </property>
+      <property name="text">
+       <string>AE Title</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>vvPacsSettingsDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>vvPacsSettingsDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
index 5df3415e0437ed44a77a9ebf15c6358bd8e620d2..7071a1b8e22a78e23f5cd6271b21df7c191f0418 100644 (file)
--- a/vv/vv.cxx
+++ b/vv/vv.cxx
@@ -44,6 +44,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
+#pragma comment(lib, "ws2_32.lib")
 
 typedef enum {O_BASE,O_OVERLAY,O_FUSION,O_VF,O_CONTOUR,O_LANDMARKS} OpenModeType;
 typedef enum {P_NORMAL,P_SEQUENCE,P_WINDOW,P_LEVEL} ParseModeType;
index 15a864843ba26c5767d6a665b72bd65063f245ca..dbc93e3192deffc5fd1f86ca93c8c4cbb55e380f 100644 (file)
@@ -40,5 +40,8 @@
     <file>icons/standardbutton-apply-16.png</file>
     <file>icons/standardbutton-cancel-16.png</file>
     <file>icons/identity.png</file>
+       <file>icons/basket_download.png</file>
+       <file>icons/bullet_info.png</file>
+       <file>icons/bullet_info.png</file>
   </qresource>
 </RCC>
index 8047b7d2e42c5d006f9d7d08442c26c2a3f654fe..3dc0829bc6a2bd0134ef83138c049a82c51afe43 100644 (file)
@@ -47,6 +47,9 @@ It is distributed under dual licence
 #include "vvMeshReader.h"
 #include "vvSaveState.h"
 #include "vvReadState.h"
+#ifdef CLITK_USE_SYSTEM_GDCM
+#include "vvQPacsConnection.h"
+#endif
 #include "clitkConfiguration.h"
 
 // ITK include
@@ -235,8 +238,8 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   documentation = new vvDocumentation();
   help_dialog = new vvHelpDialog();
   dicomSeriesSelector = new vvDicomSeriesSelector();
-#ifdef vvPacsConnection
-  PacsConnection = new vvPacsConnection();
+#ifdef CLITK_USE_SYSTEM_GDCM
+     PacsConnection = new vvQPacsConnection();
 #endif
 
   inverseButton->setEnabled(0);
@@ -280,6 +283,9 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   connect(actionWarp_image_with_vector_field,SIGNAL(triggered()),this,SLOT(WarpImage()));
   connect(actionLoad_images,SIGNAL(triggered()),this,SLOT(OpenImages()));
   connect(actionOpen_Dicom,SIGNAL(triggered()),this,SLOT(OpenDicom()));
+  #ifdef CLITK_USE_SYSTEM_GDCM
+connect(actionConnect_Pacs,SIGNAL(triggered()),this,SLOT(ConnectPacs()));
+#endif
   //  connect(actionOpen_Dicom_Struct,SIGNAL(triggered()),this,SLOT(OpenDCStructContour()));
   connect(actionOpen_VTK_contour,SIGNAL(triggered()),this,SLOT(OpenVTKContour()));
   connect(actionOpen_Multiple_Images_As_One,SIGNAL(triggered()),this,SLOT(MergeImages()));
@@ -747,20 +753,19 @@ void vvMainWindow::OpenDicom()
     files = *(dicomSeriesSelector->GetFilenames());
     LoadImages(files, vvImageReader::DICOM);
   }
-}
-
-#ifdef vvPacsConnection
+}  
+#ifdef CLITK_USE_SYSTEM_GDCM
 void vvMainWindow::ConnectPacs()
 {
   std::vector<std::string> files;
 
   //std::cout << "dicomSeriesSelector " << std::endl;
-  if (PacsConnection->exec() == QDialog::Accepted) {
-    files = *(PacsConnection->GetFilenames());
-    LoadImages(files, vvImageReader::DICOM);
+if (PacsConnection->exec() == QDialog::Accepted) {
+//    files = *(pacsconnect->GetFilenames());
+   // LoadImages(files, vvImageReader::DICOM);
+  }
   }
 
-}
 #endif
 //------------------------------------------------------------------------------
 
index 75d04976538a769ca679a17157b1d83c5a5e9479..92d70417815c62e464bc1864e92eba6f438584d1 100644 (file)
@@ -39,6 +39,9 @@ class vtkImageData;
 class vtkRenderer;
 class vtkMatrix4x4;
 class vvDicomSeriesSelector;
+#ifdef CLITK_USE_SYSTEM_GDCM
+class vvQPacsConnection;
+#endif
 class vvSlicer;
 class QTreeWidget;
 
@@ -91,8 +94,8 @@ public slots:
   void SliceImages();
   void MergeImagesWithTime();
   void OpenDicom();
-#ifdef vvPacsConnection
-  void PacsConnection();
+#ifdef CLITK_USE_SYSTEM_GDCM
+  void ConnectPacs();
 #endif
   ///Open a vtkPolyData surface mesh and display it over the current image
   void OpenVTKContour();
@@ -196,8 +199,9 @@ private:
   vvHelpDialog *help_dialog;
   vvDocumentation *documentation;
   vvDicomSeriesSelector *dicomSeriesSelector;
-#ifdef vvPacsConnection
-  vvPacsConnection *PacsConnection;
+
+#ifdef CLITK_USE_SYSTEM_GDCM
+  vvQPacsConnection *PacsConnection;
 #endif
 
   bool viewMode;
diff --git a/vv/vvPacsSettingsDialog.cxx b/vv/vvPacsSettingsDialog.cxx
new file mode 100644 (file)
index 0000000..7cde608
--- /dev/null
@@ -0,0 +1,19 @@
+#include "vvPacsSettingsDialog.h"      
+#include "vvQPacsConnection.h"
+#include "vvUtils.h"
+
+vvPacsSettingsDialog::vvPacsSettingsDialog(QWidget *i_parent)
+               : QDialog(i_parent)
+       {
+               mparent = i_parent;
+               ui.setupUi(this);
+               update();
+       }
+
+void vvPacsSettingsDialog::accept()
+{
+
+       AddDicomServer(ui.NameEdit->text().toStdString(),ui.AETitleEdit->text().toStdString(),ui.AdressEdit->text().toStdString(), ui.PortEdit->text().toStdString());
+((vvQPacsConnection*)this->parent())->refreshNetworks();
+       close();
+}
\ No newline at end of file
diff --git a/vv/vvPacsSettingsDialog.h b/vv/vvPacsSettingsDialog.h
new file mode 100644 (file)
index 0000000..48f3f48
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef __vvPacsSettingsDialog_H
+#define __vvPacsSettingsDialog_H
+#include "ui_vvPacsSettingsDialog.h"
+#include <QFileDialog>
+#include <QTGUI/QWidget>
+
+ class vvPacsSettingsDialog : public QDialog 
+  {
+         Q_OBJECT
+  public:
+         
+         vvPacsSettingsDialog(QWidget *parent=0);
+    
+         ~vvPacsSettingsDialog(){}
+  private:
+         QWidget *mparent;
+         Ui::vvPacsSettingsDialog ui;
+private slots:
+       void accept();
+
+ };
+#endif //__vvPacsSettingsDialog_H
\ No newline at end of file
index 0f3f91657f3c3c7e7056bb8bbebb6d6781acd164..9cc4c9c4013e3c687ea924a57019b6f7add26dac 100644 (file)
 #include <QtGui/qlistview.h>
 #include <qfile.h>
 #include <QDate>
+#include <QIcon>
 #include <QDateTime>
-
-
-       vvQPacsConnection::vvQPacsConnection(QWidget *i_parent)
-               :QWidget(i_parent)
+#include "vvPacsSettingsDialog.h"
+#include "vvUtils.h"
+
+
+vvQPacsConnection::vvQPacsConnection(QWidget *i_parent)
+       :QDialog(i_parent)
+{
+       ui.setupUi(this);
+       setWindowTitle(QString::fromUtf8("PACS CONNECTIONHHHH"));
+       createTreeView();
+       ui.tabFilter->setTabText(0,QString(tr("Modality")));
+       ui.tabFilter->setTabText(1,QString(tr("Date")));
+
+       ui. tabNetwork->setTabText(0,QString(tr("Network")));
+       ui. tabNetwork->setTabText(1,QString(tr("Configuration")));
+       //ui.setChecked(true);
+       //ui.on_check_ModAll_clicked(true);
+       QIcon icon;
+       icon.addFile("basket_download.png",QSize(),QIcon::Normal,QIcon::Off);
+       ui.importButton->setIcon(icon);
+       icon.addFile("file_upload.png",QSize(),QIcon::Normal,QIcon::Off);
+       // exportButton->setIcon(icon);
+       icon.addFile("email_forward.png",QSize(),QIcon::Normal,QIcon::Off);
+       icon.addFile("edit.png",QSize(),QIcon::Normal,QIcon::Off);
+       ui.optionsButton->setIcon(icon);
+       icon.addFile("bullet_info.png",QSize(),QIcon::Normal,QIcon::Off);
+       ui.helpButton->setIcon(icon);
+
+       ui.networkCombo->addItems(getDicomServers());
+       connect(ui.networkCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(connectServer(int)));
+       connect(ui.scanButton,SIGNAL(clicked()),this,SLOT(on_scanButton_clicked()));
+       update();
+}
+
+void vvQPacsConnection::refreshNetworks()
+{
+       ui.networkCombo->clear();
+       ui.networkCombo->addItems(getDicomServers());
+       //ui.networkCombo->show();
+}
+
+void vvQPacsConnection::on_clearButton_clicked()
+{
+       Patientmodel->removeRows(0, Patientmodel->rowCount(),QModelIndex());
+       Studymodel->removeRows(0, Studymodel->rowCount(),QModelIndex());
+       Seriesmodel->removeRows(0, Seriesmodel->rowCount(),QModelIndex());
+       Imagesmodel->removeRows(0, Imagesmodel->rowCount(),QModelIndex());
+}
+
+void vvQPacsConnection::on_scanButton_clicked()
+{
+
+       manageStudiesFilter(true);
+       bool didItWork = gdcm::CompositeNetworkFunctions::CEcho(m_adress.c_str(), atoi(m_port.c_str()), "CREATIS", m_nickname.c_str() );
+       std::vector< std::pair<gdcm::Tag, std::string> > keys = getKeys();
+
+       gdcm::EQueryLevel theLevel = gdcm::eStudy;
+       gdcm::ERootType theRoot  = gdcm::eStudyRootType;//ePatientRootType;
+       
+       std::vector<gdcm::DataSet> theDataSet;
+       theLevel = gdcm::ePatient;
+       theRoot  = gdcm::ePatientRootType;//ePatientRootType;
+       gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,getPatientKeys(""));
+       gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), theQuery, theDataSet,    "CREATIS", m_nickname.c_str());
+       std::vector<gdcm::DataSet>::iterator it_ds = theDataSet.begin();
+
+       for(; it_ds != theDataSet.end(); it_ds++)
        {
-                setupUi(this);
-                setWindowTitle(QString::fromUtf8("DCM API PACS"));
-                createTreeView();
-                tabFilter->setTabText(0,QString(tr("Modality")));
-                tabFilter->setTabText(1,QString(tr("Date")));
-
-                tabNetwork->setTabText(0,QString(tr("Network")));
-                tabNetwork->setTabText(1,QString(tr("Configuration")));
-                check_ModAll->setChecked(true);
-                on_check_ModAll_clicked(true);
-                QIcon icon;
-                icon.addFile("basket_download.png",QSize(),QIcon::Normal,QIcon::Off);
-                importButton->setIcon(icon);
-                icon.addFile("file_upload.png",QSize(),QIcon::Normal,QIcon::Off);
-               // exportButton->setIcon(icon);
-                icon.addFile("email_forward.png",QSize(),QIcon::Normal,QIcon::Off);
-                icon.addFile("edit.png",QSize(),QIcon::Normal,QIcon::Off);
-                optionsButton->setIcon(icon);
-                icon.addFile("bullet_info.png",QSize(),QIcon::Normal,QIcon::Off);
-                helpButton->setIcon(icon);
-                update();
+               QList<QStandardItem *> items;
+               const gdcm::DataSet ds = (*it_ds);
+               std::vector< std::pair<gdcm::Tag, std::string> >::iterator it_key = keys.begin();
+               int ind = 0;
+               for(; it_key != keys.end(); it_key++, ind++)
+               {
+                       gdcm::DataElement de = ds.GetDataElement((*it_key).first);
+                       QStandardItem *item = new QStandardItem;
+                       const gdcm::ByteValue *bv = (de).GetByteValue();
+                       if( !de.IsEmpty() )
+                       {
+                               std::string buffer = std::string( bv->GetPointer(), bv->GetLength() );
+                               item->setText(tr(buffer.c_str()));
+                       }
+                       else
+                       {
+                               item->setText(tr(""));
+                       }
+                       if(ind ==0)
+                       {
+                               item->setCheckable(true);
+                       }
+                       items.push_back(item);
+               }
+               Patientmodel->appendRow(items);
        }
+}
+
 
+void vvQPacsConnection::on_optionsButton_clicked()
+{
+       vvPacsSettingsDialog *dg  = new vvPacsSettingsDialog(this);
+       dg->show();
+}
 
-       void vvQPacsConnection::on_clearButton_clicked()
+void vvQPacsConnection::convertDataSet(std::vector<gdcm::DataSet> i_ds, QStandardItemModel *i_model, std::vector< std::pair<gdcm::Tag, std::string> > keys)
+{
+       gdcm::Tag tagdb(0x0008,0x0020);
+       std::vector<gdcm::DataSet>::iterator it_ds = i_ds.begin();
+       for(; it_ds != i_ds.end(); it_ds++)
        {
-               Patientmodel->removeRows(0, Patientmodel->rowCount(),QModelIndex());
-               Studymodel->removeRows(0, Studymodel->rowCount(),QModelIndex());
-               Seriesmodel->removeRows(0, Seriesmodel->rowCount(),QModelIndex());
-               Imagesmodel->removeRows(0, Imagesmodel->rowCount(),QModelIndex());
+               QList<QStandardItem *> items;
+               const gdcm::DataSet ds = (*it_ds);
+               std::vector< std::pair<gdcm::Tag, std::string> >::iterator it_key = keys.begin();
+               int ind = 0;
+               for(; it_key != keys.end(); it_key++, ind++)
+               {
+                       gdcm::DataElement de = ds.GetDataElement((*it_key).first);
+                       QStandardItem *item = new QStandardItem;
+                       const gdcm::ByteValue *bv = (de).GetByteValue();
+                       if( !de.IsEmpty() )
+                       {
+                               std::string buffer = std::string( bv->GetPointer(), bv->GetLength() );
+                               /*if((*it_key).first == tagdb)
+                               {
+                               QDate date;
+                               date.fromString(tr(buffer.c_str()),"yyyy'MM'd");
+                               item->setText(date.toString());
+                               }
+                               else
+                               {*/
+                               item->setText(tr(buffer.c_str()));
+                               //}
+                       }
+                       else
+                       {
+                               item->setText(tr(""));
+                       }
+                       if(ind ==0)
+                       {
+                               item->setCheckable(true);
+                       }
+                       items.push_back(item);
+               }
+               i_model->appendRow(items);
        }
 
-       void vvQPacsConnection::on_scanButton_clicked()
+}
+
+
+void vvQPacsConnection::createTreeView()
+{
+       // Patient Tree View
+       Patientmodel = new QStandardItemModel(0,2,this); 
+       QStringList Patientlist;
+       Patientlist.push_back(tr("PATIENT NAME"));
+       Patientlist.push_back(tr("PATIENT ID"));
+       Patientmodel->setHorizontalHeaderLabels(Patientlist);
+       ui.patientTreeView->setModel(Patientmodel);
+       ui.patientTreeView->setEnabled(true);
+       connect(ui.patientTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectStudies(QModelIndex)));
+
+       // Study Tree View
+       Studymodel = new QStandardItemModel(0,3,this); 
+       QStringList Studylist;
+       Studylist.push_back(tr("DESCRIPTION"));
+       Studylist.push_back(tr("DATE"));
+       Studylist.push_back(tr("HOUR"));
+       Studymodel->setHorizontalHeaderLabels(Studylist);
+       ui.studyTreeView->setModel(Studymodel);
+       connect(ui.studyTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectSeries(QModelIndex)));
+
+
+       // Series Tree View
+       Seriesmodel = new QStandardItemModel(0,2,this); 
+       QStringList Serieslist;
+       Serieslist.push_back(tr("MODALITY"));
+       Serieslist.push_back(tr("DESCRIPTION"));
+       Serieslist.push_back(tr("no. accept."));
+       Seriesmodel->setHorizontalHeaderLabels(Serieslist);
+       ui.seriesTreeView->setModel(Seriesmodel);
+       connect(ui.seriesTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectImages(QModelIndex)));
+
+       // Images Tree View
+       Imagesmodel = new QStandardItemModel(0,1,this); 
+       QStringList Imageslist;
+       Imageslist.push_back(tr("instance number"));
+       Imagesmodel->setHorizontalHeaderLabels(Imageslist);
+       ui.imagesTreeView->setModel(Imagesmodel);
+}
+
+void vvQPacsConnection::selectStudies(const QModelIndex &index)
+{
+       Studymodel->removeRows(0, Studymodel->rowCount(),QModelIndex());
+       QVariant elt= Patientmodel->data(index.sibling(index.row(),1));
+       m_patient=elt.toString().toStdString();
+       manageSeriesFilter(true);
+       gdcm::EQueryLevel theLevel = gdcm::eStudy;
+       gdcm::ERootType theRoot  = gdcm::ePatientRootType;//ePatientRootType;
+       std::vector<gdcm::DataSet> theDataSet;
+       std::vector< std::pair<gdcm::Tag, std::string> > keys;
+
+       // Study Description
+       gdcm::Tag tagsd(0x0010,0x0020);
+       keys.push_back(std::make_pair(tagsd, m_patient));
+       // Study Description
+       gdcm::Tag tagsdc(0x0008,0x1030);
+       keys.push_back(std::make_pair(tagsdc, ""));
+       // Study date
+       gdcm::Tag tagdb(0x0008,0x0020);
+       keys.push_back(std::make_pair(tagdb, ""));
+       // Study Hour
+       gdcm::Tag tagsdh(0x0008,0x0030);
+       keys.push_back(std::make_pair(tagsdh, ""));
+       gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
+       gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), theQuery, theDataSet, "CREATIS", m_nickname.c_str());
+       convertDataSet(theDataSet, Studymodel, getStudyKeys(""));
+}
+
+
+void vvQPacsConnection::selectSeries(const QModelIndex &index)
+{
+       Seriesmodel->removeRows(0, Seriesmodel->rowCount(),QModelIndex());
+       QVariant elt= Studymodel->data(index.sibling(index.row(),3));
+       QVariant elt2= Patientmodel->data(index.sibling(ui.patientTreeView->selectionModel()->selectedRows().first().row(),1));
+
+       //manageImagesFilter(true);
+       gdcm::EQueryLevel theLevel = gdcm::eSeries;
+       gdcm::ERootType theRoot  = gdcm::ePatientRootType;//ePatientRootType;
+       std::vector<gdcm::DataSet> theDataSet;
+       std::vector< std::pair<gdcm::Tag, std::string> > keys;
+
+       //Patient Unique key
+       keys.push_back(std::make_pair(gdcm::Tag(0x0010,0x0020), m_patient));
+
+       //Study Unique Key
+       keys.push_back(std::make_pair(gdcm::Tag(0x0020,0x000d), elt.toString().toStdString()));
+
+
+       // Modality
+       keys.push_back(std::make_pair(gdcm::Tag(0x0008,0x0060), elt.toString().toStdString()));
+       // Description
+       keys.push_back(std::make_pair(gdcm::Tag(0x0008,0x0060), elt.toString().toStdString()));
+       // Acceptance NUmber????
+       keys.push_back(std::make_pair(gdcm::Tag(0x0020,0x000e), elt.toString().toStdString()));
+
+       gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
+       keys.clear();
+       // Modality
+       keys.push_back(std::make_pair(gdcm::Tag(0x0008,0x0060), elt.toString().toStdString()));
+       // Description
+       keys.push_back(std::make_pair(gdcm::Tag(0x0008,0x0060), elt.toString().toStdString()));
+       // Acceptance NUmber????
+       keys.push_back(std::make_pair(gdcm::Tag(0x0020,0x000e), elt.toString().toStdString()));
+
+       gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), theQuery, theDataSet, "CREATIS", m_nickname.c_str());
+       convertDataSet(theDataSet, Seriesmodel, keys);
+}
+
+void vvQPacsConnection::selectImages(const QModelIndex &index)
+{
+       Imagesmodel->removeRows(0, Imagesmodel->rowCount(),QModelIndex());
+       QVariant elt= Seriesmodel->data(index.sibling(index.row(),2));
+       QVariant elt2= Patientmodel->data(index.sibling(ui.patientTreeView->selectionModel()->selectedRows().first().row(),1));
+
+       //manageImagesFilter(true);
+       gdcm::EQueryLevel theLevel = gdcm::eImage;
+       gdcm::ERootType theRoot  = gdcm::ePatientRootType;//ePatientRootType;
+       std::vector<gdcm::DataSet> theDataSet;
+       std::vector< std::pair<gdcm::Tag, std::string> > keys;
+
+       gdcm::Tag tagsd(0x0010,0x0020);
+       keys.push_back(std::make_pair(tagsd, m_patient));
+
+       gdcm::Tag tagss(0x0020,0x000e);
+       keys.push_back(std::make_pair(tagss, elt.toString().toStdString()));
+       //= getStudyKeys(elt.toString().toStdString());
+
+       // Study Description
+       gdcm::Tag tagsdc(0x0020,0x0013);
+       keys.push_back(std::make_pair(tagsdc, ""));
+
+
+       gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
+       keys.clear();
+       // Study Description
+
+       keys.push_back(std::make_pair(tagsdc, ""));
+
+       gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), theQuery, theDataSet, "CREATIS", m_nickname.c_str());
+       convertDataSet(theDataSet, Imagesmodel, keys);
+}
+
+
+void vvQPacsConnection::manageStudiesFilter(bool i_enable)
+{
+       ui.text_PHYS->setEnabled(i_enable);
+       ui.text_SDESC->setEnabled(i_enable);
+       ui.dateTab->setEnabled(i_enable);
+
+}
+
+void vvQPacsConnection::manageSeriesFilter(bool i_enable)
+{
+       ui.modalityTab->setEnabled(i_enable);
+}
+
+std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::getPatientKeys(const std::string i_val)
+{
+       std::vector< std::pair<gdcm::Tag, std::string> > keys;
+       // Patient Name
+       gdcm::Tag tag(0x0010,0x0010);
+       keys.push_back(std::make_pair(tag, ""));
+
+       //// Patient ID
+       gdcm::Tag tagpid(0x0010,0x0020);
+       keys.push_back(std::make_pair(tagpid, i_val));
+       return keys;
+}
+
+std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::getStudyKeys(const std::string i_val)
+{
+       std::vector< std::pair<gdcm::Tag, std::string> > keys;
+       // Study Description
+       gdcm::Tag tagsdc(0x0008,0x1030);
+       keys.push_back(std::make_pair(tagsdc, ""));
+       // Study date
+       gdcm::Tag tagdb(0x0008,0x0020);
+       keys.push_back(std::make_pair(tagdb, ""));
+       // Study Hour
+       gdcm::Tag tagsdh(0x0008,0x0030);
+       keys.push_back(std::make_pair(tagsdh, ""));
+       // Study Instance UID
+       gdcm::Tag tagsid(0x0020,0x000d);
+       keys.push_back(std::make_pair(tagsid, i_val));
+
+       return keys;
+}
+
+
+std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::getSeriesKeys(const std::string i_val)
+{
+       std::vector< std::pair<gdcm::Tag, std::string> > keys;
+       // Modality
+       gdcm::Tag tagsm(0x0008,0x0060);
+       keys.push_back(std::make_pair(tagsm, ""));
+       // Study date
+       gdcm::Tag tagdb(0x0008,0x103e);
+       keys.push_back(std::make_pair(tagdb, ""));
+       // Study Hour
+       gdcm::Tag tagsdh(0x0020,0x000e);
+       keys.push_back(std::make_pair(tagsdh, ""));
+       // Study Instance UID
+       gdcm::Tag tagsid(0x0020,0x1209);
+       keys.push_back(std::make_pair(tagsid, i_val));
+
+       return keys;
+}
+std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::getKeys()
+{
+       std::vector< std::pair<gdcm::Tag, std::string> > keys;
+       // Patient Name
+       gdcm::Tag tag(0x0010,0x0010);
+       keys.push_back(std::make_pair(tag, ""));
+
+       //// Patient ID
+       gdcm::Tag tagpid(0x0010,0x0020);
+       keys.push_back(std::make_pair(tagpid, ""));
+
+       // Modality
+       gdcm::Tag tagmod(0x0008,0x0061);
+       keys.push_back(std::make_pair(tagmod, ""));
+
+       // date of birth
+       gdcm::Tag tagdb(0x0010,0x0030);
+       keys.push_back(std::make_pair(tagdb, ""));
+
+       // Study Date
+       gdcm::Tag tagsd(0x0020,0x000D);
+       keys.push_back(std::make_pair(tagsd, ""));
+
+       //// Study Time
+       //gdcm::Tag tagst(8,30);
+       //keys.push_back(std::make_pair(tagst, ""));
+
+       //// Study Description
+       //gdcm::Tag tagsdc(8,1030);
+       //keys.push_back(std::make_pair(tagsdc, ""));
+
+       //// Accession n°
+       //gdcm::Tag tagacc(8,50);
+       //keys.push_back(std::make_pair(tagacc, ""));
+
+       return keys;
+}
+
+void vvQPacsConnection::on_check_ModAll_clicked(bool state)
+{
+       ui.check_MR->setEnabled(!state);
+       ui.check_CR->setEnabled(!state);
+       ui.check_OT->setEnabled(!state);
+       ui.check_RF->setEnabled(!state);
+       ui.check_SC->setEnabled(!state);
+       ui.check_CT->setEnabled(!state);
+       ui.check_US->setEnabled(!state);
+       ui.check_NM->setEnabled(!state);
+       ui.check_DR->setEnabled(!state);
+       ui.check_US->setEnabled(!state);
+       ui.check_NM->setEnabled(!state);
+       ui.check_DR->setEnabled(!state);
+       ui.check_SR->setEnabled(!state);
+       ui.check_XA->setEnabled(!state);
+       ui.check_MG->setEnabled(!state);
+       if(state)
        {
-               //on_clearButton_clicked();
-               manageStudiesFilter(true);
-               #if defined (USE_GDCM2)
-           bool didItWork = gdcm::CompositeNetworkFunctions::CEcho( "127.0.0.1", 5678,
-                       "CREATIS", "CONQUESTSRV1" );
-                               /*  tag.SetElement(8);
-                 tag.SetGroup(8);*/
-               std::vector< std::pair<gdcm::Tag, std::string> > keys = getKeys();
-
-               //std::pair<gdcm::Tag, std::string> pa;
-               //pa.first = tag;
-               //pa.second = "";
-               ////keys.push_back(std::make_pair(tag, ""));
-               gdcm::EQueryLevel theLevel = gdcm::eStudy;
-               gdcm::ERootType theRoot  = gdcm::eStudyRootType;//ePatientRootType;
-               //gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
-
-       
-                   std::vector<gdcm::DataSet> theDataSet;
-
-                         theLevel = gdcm::ePatient;
-  theRoot  = gdcm::ePatientRootType;//ePatientRootType;
-  gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,getPatientKeys(""));
-
-//     
-//theDataSet.clear();
-//  gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet,
-//       "CREATIS", "CONQUESTSRV1");
-//   keys.clear();
-//   keys.push_back(std::make_pair(gdcm::Tag(0x0010,0x0010), ""));                     
-//                     
-                       gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet,
-       "CREATIS", "CONQUESTSRV1");
-  std::vector<gdcm::DataSet>::iterator it_ds = theDataSet.begin();
-//
-  for(; it_ds != theDataSet.end(); it_ds++)
-  {
-
-         QList<QStandardItem *> items;
-         const gdcm::DataSet ds = (*it_ds);
-         std::vector< std::pair<gdcm::Tag, std::string> >::iterator it_key = keys.begin();
-         int ind = 0;
-         for(; it_key != keys.end(); it_key++, ind++)
-         {
-                 gdcm::DataElement de = ds.GetDataElement((*it_key).first);
-                 QStandardItem *item = new QStandardItem;
-                 const gdcm::ByteValue *bv = (de).GetByteValue();
-                 if( !de.IsEmpty() )
-                 {
-                         std::string buffer = std::string( bv->GetPointer(), bv->GetLength() );
-                         item->setText(tr(buffer.c_str()));
-                 }
-                 else
-                 {
-                         item->setText(tr(""));
-                 }
-                 if(ind ==0)
-                 {
-                       item->setCheckable(true);
-                 }
-                 items.push_back(item);
-         }
-         Patientmodel->appendRow(items);
-        }
-//   gdcm::Tag tagtest(0x0020,0x1208);
-//   keys.clear();
-//   keys.push_back(std::make_pair(gdcm::Tag(0x0010,0x0010), ""));
-////  keys.push_back(std::make_pair(tagtest, ""));
-//  theLevel = gdcm::ePatient;
-//  theRoot  = gdcm::ePatientRootType;//ePatientRootType;
-//  theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
-//
-//     
-//theDataSet.clear();
-//  gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet,
-//       "CREATIS", "CONQUESTSRV1");
-#endif
+               ui.check_MR->setChecked(state);
+               ui.check_CR->setChecked(state);
+               ui.check_OT->setChecked(state);
+               ui.check_RF->setChecked(state);
+               ui.check_SC->setChecked(state);
+               ui.check_CT->setChecked(state);
+               ui.check_US->setChecked(state);
+               ui.check_NM->setChecked(state);
+               ui.check_DR->setChecked(state);
+               ui.check_US->setChecked(state);
+               ui.check_NM->setChecked(state);
+               ui.check_DR->setChecked(state);
+               ui.check_SR->setChecked(state);
+               ui.check_XA->setChecked(state);
+               ui.check_MG->setChecked(state);
        }
 
-
-       void vvQPacsConnection::on_importButton_clicked()
+}
+
+void vvQPacsConnection::connectServer(int index)
+{
+       std::map < std::string, std:: string> values = getDicomServer(ui.networkCombo->currentText());
+       m_port = values["PORT"];
+       m_aetitle = values["AETITLE"];
+       m_adress= values["ADRESS"];
+       m_nickname = values["nickname"];
+       ui.AdressEdit->setText(QString(m_adress.c_str()));
+       ui.AETitleEdit->setText(QString(m_aetitle.c_str()));
+       ui.NameEdit->setText(QString(m_nickname.c_str()));
+       ui.PortEdit->setText(QString(m_port.c_str()));
+}
+
+void vvQPacsConnection::on_importButton_clicked()
        {
                QModelIndex index;
-               QVariant elt= Patientmodel->data(index.sibling(patientTreeView->selectionModel()->selectedRows().first().row(),1));
+               QVariant elt= Patientmodel->data(index.sibling(ui.patientTreeView->selectionModel()->selectedRows().first().row(),1));
                
                gdcm::EQueryLevel theLevel = gdcm::ePatient;
                gdcm::ERootType theRoot  = gdcm::ePatientRootType;//ePatientRootType;
                gdcm::Tag tagsdc(0x0010,0x0020);
                keys.push_back(std::make_pair(tagsdc, elt.toString().toStdString()));
                                gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
-               gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet, "CREATIS", "CONQUESTSRV1");
+       //      gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet, "CREATIS", "CONQUESTSRV1");
        
-                bool didItWork =  gdcm::CompositeNetworkFunctions::CMove( "127.0.0.1", 5678, theQuery, 0,
-       "CREATIS", "CONQUESTSRV1", "d:\\temp_pacs_import\\" );
-       }
-
-       void vvQPacsConnection::convertDataSet(std::vector<gdcm::DataSet> i_ds, QStandardItemModel *i_model, std::vector< std::pair<gdcm::Tag, std::string> > keys)
-       {
-               gdcm::Tag tagdb(0x0008,0x0020);
-               std::vector<gdcm::DataSet>::iterator it_ds = i_ds.begin();
-               for(; it_ds != i_ds.end(); it_ds++)
-               {
-                       QList<QStandardItem *> items;
-                       const gdcm::DataSet ds = (*it_ds);
-                       std::vector< std::pair<gdcm::Tag, std::string> >::iterator it_key = keys.begin();
-                   int ind = 0;
-                   for(; it_key != keys.end(); it_key++, ind++)
-                   {
-                           gdcm::DataElement de = ds.GetDataElement((*it_key).first);
-                           QStandardItem *item = new QStandardItem;
-                           const gdcm::ByteValue *bv = (de).GetByteValue();
-                           if( !de.IsEmpty() )
-                           {
-                                   std::string buffer = std::string( bv->GetPointer(), bv->GetLength() );
-                                       /*if((*it_key).first == tagdb)
-                                       {
-                                               QDate date;
-                                               date.fromString(tr(buffer.c_str()),"yyyy'MM'd");
-                                               item->setText(date.toString());
-                                       }
-                                       else
-                                       {*/
-                                               item->setText(tr(buffer.c_str()));
-                                       //}
-                           }
-                           else
-                           {
-                                   item->setText(tr(""));
-                           }
-                           if(ind ==0)
-                           {
-                                  item->setCheckable(true);
-                           }
-                           items.push_back(item);
-                   }
-                       i_model->appendRow(items);
-               }
-               
-       }
-
-
-       void vvQPacsConnection::createTreeView()
-       {
-               // Patient Tree View
-               Patientmodel = new QStandardItemModel(0,2,this); 
-               QStringList Patientlist;
-               Patientlist.push_back(tr("PATIENT NAME"));
-               Patientlist.push_back(tr("PATIENT ID"));
-               Patientmodel->setHorizontalHeaderLabels(Patientlist);
-               patientTreeView->setModel(Patientmodel);
-               patientTreeView->setEnabled(true);
-               connect(patientTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectStudies(QModelIndex)));
-               
-               // Study Tree View
-               Studymodel = new QStandardItemModel(0,3,this); 
-               QStringList Studylist;
-               Studylist.push_back(tr("DESCRIPTION"));
-               Studylist.push_back(tr("DATE"));
-               Studylist.push_back(tr("HOUR"));
-               Studymodel->setHorizontalHeaderLabels(Studylist);
-               studyTreeView->setModel(Studymodel);
-               connect(studyTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectSeries(QModelIndex)));
-
-
-               // Series Tree View
-               Seriesmodel = new QStandardItemModel(0,2,this); 
-               QStringList Serieslist;
-               Serieslist.push_back(tr("MODALITY"));
-               Serieslist.push_back(tr("DESCRIPTION"));
-               Serieslist.push_back(tr("no. accept."));
-               Seriesmodel->setHorizontalHeaderLabels(Serieslist);
-               seriesTreeView->setModel(Seriesmodel);
-               connect(seriesTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectImages(QModelIndex)));
-
-               // Images Tree View
-               Imagesmodel = new QStandardItemModel(0,1,this); 
-               QStringList Imageslist;
-               Imageslist.push_back(tr("instance number"));
-               Imagesmodel->setHorizontalHeaderLabels(Imageslist);
-               imagesTreeView->setModel(Imagesmodel);
-
-               //model->setHeaderData(0, Qt::Horizontal,tr("test"),Qt::DisplayRole);
-               /*QFileSystemModel *filemodel = new   QFileSystemModel;
-               filemodel->insertColumn(1);
-               filemodel->setHeaderData(1, Qt::Horizontal,"test",0);*/
-
-       }
-
-       void vvQPacsConnection::selectStudies(const QModelIndex &index)
-       {
-               Studymodel->removeRows(0, Studymodel->rowCount(),QModelIndex());
-               QVariant elt= Patientmodel->data(index.sibling(index.row(),1));
-               m_patient=elt.toString().toStdString();
-               manageSeriesFilter(true);
-               gdcm::EQueryLevel theLevel = gdcm::eStudy;
-               gdcm::ERootType theRoot  = gdcm::ePatientRootType;//ePatientRootType;
-               std::vector<gdcm::DataSet> theDataSet;
-               std::vector< std::pair<gdcm::Tag, std::string> > keys;
-               
-               // Study Description
-               gdcm::Tag tagsd(0x0010,0x0020);
-               keys.push_back(std::make_pair(tagsd, m_patient));
-               // Study Description
-               gdcm::Tag tagsdc(0x0008,0x1030);
-               keys.push_back(std::make_pair(tagsdc, ""));
-               // Study date
-               gdcm::Tag tagdb(0x0008,0x0020);
-               keys.push_back(std::make_pair(tagdb, ""));
-               // Study Hour
-               gdcm::Tag tagsdh(0x0008,0x0030);
-               keys.push_back(std::make_pair(tagsdh, ""));
-               gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
-               gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet, "CREATIS", "CONQUESTSRV1");
-               convertDataSet(theDataSet, Studymodel, getStudyKeys(""));
-       }
-
-
-       void vvQPacsConnection::selectSeries(const QModelIndex &index)
-       {
-               Seriesmodel->removeRows(0, Seriesmodel->rowCount(),QModelIndex());
-               QVariant elt= Studymodel->data(index.sibling(index.row(),3));
-               QVariant elt2= Patientmodel->data(index.sibling(patientTreeView->selectionModel()->selectedRows().first().row(),1));
-
-               //manageImagesFilter(true);
-               gdcm::EQueryLevel theLevel = gdcm::eSeries;
-               gdcm::ERootType theRoot  = gdcm::ePatientRootType;//ePatientRootType;
-               std::vector<gdcm::DataSet> theDataSet;
-               std::vector< std::pair<gdcm::Tag, std::string> > keys;
-               
-               //Patient Unique key
-               keys.push_back(std::make_pair(gdcm::Tag(0x0010,0x0020), m_patient));
-
-               //Study Unique Key
-               keys.push_back(std::make_pair(gdcm::Tag(0x0020,0x000d), elt.toString().toStdString()));
-
-               
-               // Modality
-               keys.push_back(std::make_pair(gdcm::Tag(0x0008,0x0060), elt.toString().toStdString()));
-               // Description
-               keys.push_back(std::make_pair(gdcm::Tag(0x0008,0x0060), elt.toString().toStdString()));
-               // Acceptance NUmber????
-               keys.push_back(std::make_pair(gdcm::Tag(0x0020,0x000e), elt.toString().toStdString()));
-               
-               gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
-               keys.clear();
-               // Modality
-               keys.push_back(std::make_pair(gdcm::Tag(0x0008,0x0060), elt.toString().toStdString()));
-               // Description
-               keys.push_back(std::make_pair(gdcm::Tag(0x0008,0x0060), elt.toString().toStdString()));
-               // Acceptance NUmber????
-               keys.push_back(std::make_pair(gdcm::Tag(0x0020,0x000e), elt.toString().toStdString()));
-
-
-
-               gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet, "CREATIS", "CONQUESTSRV1");
-               convertDataSet(theDataSet, Seriesmodel, keys);
-       }
-
-       void vvQPacsConnection::selectImages(const QModelIndex &index)
-       {
-               Imagesmodel->removeRows(0, Imagesmodel->rowCount(),QModelIndex());
-               QVariant elt= Seriesmodel->data(index.sibling(index.row(),2));
-               QVariant elt2= Patientmodel->data(index.sibling(patientTreeView->selectionModel()->selectedRows().first().row(),1));
-
-               //manageImagesFilter(true);
-               gdcm::EQueryLevel theLevel = gdcm::eImageOrFrame;
-               gdcm::ERootType theRoot  = gdcm::ePatientRootType;//ePatientRootType;
-               std::vector<gdcm::DataSet> theDataSet;
-               std::vector< std::pair<gdcm::Tag, std::string> > keys;
-               
-               gdcm::Tag tagsd(0x0010,0x0020);
-               keys.push_back(std::make_pair(tagsd, m_patient));
-
-               gdcm::Tag tagss(0x0020,0x000e);
-               keys.push_back(std::make_pair(tagss, elt.toString().toStdString()));
-               //= getStudyKeys(elt.toString().toStdString());
-               
-               // Study Description
-               gdcm::Tag tagsdc(0x0020,0x0013);
-               keys.push_back(std::make_pair(tagsdc, ""));
-               
-
-               gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
-               keys.clear();
-               // Study Description
-
-               keys.push_back(std::make_pair(tagsdc, ""));
-               
-
-               gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet, "CREATIS", "CONQUESTSRV1");
-               convertDataSet(theDataSet, Seriesmodel, keys);
-       }
-
-
-       void vvQPacsConnection::manageStudiesFilter(bool i_enable)
-       {
-               text_PHYS->setEnabled(i_enable);
-               text_SDESC->setEnabled(i_enable);
-               dateTab->setEnabled(i_enable);
-
-       }
-
-       void vvQPacsConnection::manageSeriesFilter(bool i_enable)
-       {
-               modalityTab->setEnabled(i_enable);
-       }
-
-       std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::getPatientKeys(const std::string i_val)
-       {
-               std::vector< std::pair<gdcm::Tag, std::string> > keys;
-               // Patient Name
-                gdcm::Tag tag(0x0010,0x0010);
-               keys.push_back(std::make_pair(tag, ""));
-
-               //// Patient ID
-               gdcm::Tag tagpid(0x0010,0x0020);
-               keys.push_back(std::make_pair(tagpid, i_val));
-               return keys;
-       }
-
-       std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::getStudyKeys(const std::string i_val)
-       {
-               std::vector< std::pair<gdcm::Tag, std::string> > keys;
-               // Study Description
-               gdcm::Tag tagsdc(0x0008,0x1030);
-               keys.push_back(std::make_pair(tagsdc, ""));
-               // Study date
-               gdcm::Tag tagdb(0x0008,0x0020);
-               keys.push_back(std::make_pair(tagdb, ""));
-               // Study Hour
-               gdcm::Tag tagsdh(0x0008,0x0030);
-               keys.push_back(std::make_pair(tagsdh, ""));
-               // Study Instance UID
-               gdcm::Tag tagsid(0x0020,0x000d);
-               keys.push_back(std::make_pair(tagsid, i_val));
-
-               return keys;
-       }
-
-
-       std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::getSeriesKeys(const std::string i_val)
-       {
-               std::vector< std::pair<gdcm::Tag, std::string> > keys;
-               // Modality
-               gdcm::Tag tagsm(0x0008,0x0060);
-               keys.push_back(std::make_pair(tagsm, ""));
-               // Study date
-               gdcm::Tag tagdb(0x0008,0x103e);
-               keys.push_back(std::make_pair(tagdb, ""));
-               // Study Hour
-               gdcm::Tag tagsdh(0x0020,0x000e);
-               keys.push_back(std::make_pair(tagsdh, ""));
-               // Study Instance UID
-               gdcm::Tag tagsid(0x0020,0x1209);
-               keys.push_back(std::make_pair(tagsid, i_val));
-
-               return keys;
-       }
-       std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::getKeys()
-       {
-               std::vector< std::pair<gdcm::Tag, std::string> > keys;
-               // Patient Name
-                gdcm::Tag tag(0x0010,0x0010);
-               keys.push_back(std::make_pair(tag, ""));
-
-               //// Patient ID
-               gdcm::Tag tagpid(0x0010,0x0020);
-               keys.push_back(std::make_pair(tagpid, ""));
-
-               // Modality
-               gdcm::Tag tagmod(0x0008,0x0061);
-               keys.push_back(std::make_pair(tagmod, ""));
-
-               // date of birth
-               gdcm::Tag tagdb(0x0010,0x0030);
-               keys.push_back(std::make_pair(tagdb, ""));
-
-               // Study Date
-               gdcm::Tag tagsd(0x0020,0x000D);
-               keys.push_back(std::make_pair(tagsd, ""));
-
-               //// Study Time
-               //gdcm::Tag tagst(8,30);
-               //keys.push_back(std::make_pair(tagst, ""));
-
-               //// Study Description
-               //gdcm::Tag tagsdc(8,1030);
-               //keys.push_back(std::make_pair(tagsdc, ""));
-
-               //// Accession n°
-               //gdcm::Tag tagacc(8,50);
-               //keys.push_back(std::make_pair(tagacc, ""));
-
-               return keys;
-       }
-
-       void vvQPacsConnection::on_check_ModAll_clicked(bool state)
-       {
-               check_MR->setEnabled(!state);
-               check_CR->setEnabled(!state);
-               check_OT->setEnabled(!state);
-               check_RF->setEnabled(!state);
-               check_SC->setEnabled(!state);
-               check_CT->setEnabled(!state);
-               check_US->setEnabled(!state);
-               check_NM->setEnabled(!state);
-               check_DR->setEnabled(!state);
-               check_US->setEnabled(!state);
-               check_NM->setEnabled(!state);
-               check_DR->setEnabled(!state);
-               check_SR->setEnabled(!state);
-               check_XA->setEnabled(!state);
-               check_MG->setEnabled(!state);
-               if(state)
-               {
-                       check_MR->setChecked(state);
-                       check_CR->setChecked(state);
-                       check_OT->setChecked(state);
-                       check_RF->setChecked(state);
-                       check_SC->setChecked(state);
-                       check_CT->setChecked(state);
-                       check_US->setChecked(state);
-                       check_NM->setChecked(state);
-                       check_DR->setChecked(state);
-                       check_US->setChecked(state);
-                       check_NM->setChecked(state);
-                       check_DR->setChecked(state);
-                       check_SR->setChecked(state);
-                       check_XA->setChecked(state);
-                       check_MG->setChecked(state);
-               }
-
+                bool didItWork =  gdcm::CompositeNetworkFunctions::CMove(m_adress.c_str(),atoi(m_port.c_str()), theQuery, 0,
+       "CREATIS", m_nickname.c_str(), "d:\\temp_pacs_import\\" );
        }
\ No newline at end of file
index fbbdbeb3602c67d7743e51500a491235c7cdc6a0..3fbb1f756902be421416eb1feb46b465b9dfc6ff 100644 (file)
@@ -6,23 +6,23 @@
 #include "gdcmCompositeNetworkFunctions.h"
 #include <QtGui/QStandardItemModel.h>
 #include <QtGui/QStringListModel.h>
-
+#include <QFileDialog>
 
   /**
    * \ingroup GUI
    */
   //=====================================================================
- //=====================================================================
-  class vvQPacsConnection : public QWidget , public Ui_vvPacsConnection
+ //======================================================================
+  class vvQPacsConnection : public QDialog 
   {
          Q_OBJECT
   public:
-         vvQPacsConnection(){}    
-         vvQPacsConnection(QWidget *parent);
+         //vvQPacsConnection(){}    
+         vvQPacsConnection(QWidget *parent=0);
     
          ~vvQPacsConnection(){}
-       ///Queries the PACS
-        //void OnQueryPACS(wxCommandEvent& event);  
+       void refreshNetworks();
+
 public slots:
        void selectStudies(const QModelIndex &index);
        void selectSeries(const QModelIndex &index);
@@ -30,11 +30,13 @@ public slots:
   private slots:
     void on_scanButton_clicked();
        void on_clearButton_clicked();
-       void on_importButton_clicked();
+       void on_optionsButton_clicked();
        void on_check_ModAll_clicked(bool state);
-
+       void on_importButton_clicked();
+ void connectServer(int index);
 
   private :
+         Ui::vvPacsConnection ui;
        std::vector< std::pair<gdcm::Tag, std::string> > getKeys();
        std::vector< std::pair<gdcm::Tag, std::string> > getPatientKeys(const std::string );
        std::vector< std::pair<gdcm::Tag, std::string> > getStudyKeys(const std::string);
@@ -42,6 +44,7 @@ public slots:
        std::vector< std::pair<gdcm::Tag, std::string> > getImageKeys(const std::string i_val);
        void manageStudiesFilter(bool i_enable);
        void createTreeView();
+       void setNewPacs();
        QStandardItemModel *Patientmodel;
        QStandardItemModel *Studymodel;
        QStandardItemModel *Seriesmodel;
@@ -52,11 +55,11 @@ public slots:
        std::string m_study;
        std::string m_series;
        
-       std::string m_ip;
+       std::string m_port;
        std::string m_aetitle;
        std::string m_adress;
-       std::string m_name;
-       //wxDialog* dialog;
+       std::string m_nickname;
+
        
   }; // class vvQPacsConnection
   //=====================================================================
index 3ef9cc606b2d6d7a87a6ee97b2699ce01056aadf..2dc0a96e07ec54166cf1c7ab83be7c282f24e465 100644 (file)
@@ -48,6 +48,50 @@ FileListType GetRecentlyOpenedImages()
   return result;
 }
 
+/// Add new Dicom Server
+void AddDicomServer(std::string nickname, std::string aetitle, std::string adress, std::string port)
+{
+       QSettings settings(getVVSettingsPath(), getSettingsOptionFormat());
+        settings.beginGroup(QString::fromStdString("DICOMSERVER"));
+        settings.beginWriteArray(QString::fromStdString(nickname));
+        settings.setValue("nickname",QString::fromStdString(nickname));
+        settings.setValue("AETITLE",QString::fromStdString(aetitle));
+        settings.setValue("ADRESS",QString::fromStdString(adress));
+        settings.setValue("PORT",QString::fromStdString(port));
+        settings.endGroup();
+}
+
+
+//std::map <std::string, std::vector<std::string> > getDicomServers()
+QStringList getDicomServers()
+{
+
+       QStringList list;
+       QSettings settings(getVVSettingsPath(), getSettingsOptionFormat());
+        settings.beginGroup(QString::fromStdString("DICOMSERVER"));
+        QStringList  keys = settings.allKeys();
+        for(int i =0; i < keys.size(); i++)
+        {
+                QString val = keys.at(i);
+                if (val.contains("nickname"))
+                        list.push_back(settings.value(val).toString());
+        }
+        return list;
+}
+
+std::map <std::string,std::string > getDicomServer(QString nickname)
+{
+               std::map< std::string, std::string  >results;
+               QSettings settings(getVVSettingsPath(), getSettingsOptionFormat());
+        settings.beginGroup(QString::fromStdString("DICOMSERVER"));
+        settings.beginReadArray(nickname);
+          QStringList keys = settings.childKeys();
+          for (int i = 0; i <keys.size(); i++)
+                  results[keys.at(i).toStdString()] = settings.value(keys.at(i)).toString().toStdString();
+          return results;
+
+}
+
 ///Adds an image to the list of recently opened images
 void AddToRecentlyOpenedImages(std::string filename)
 {
index 5854b5b6141c6e6221acf7d4ddf4faf1b4d7a908..3d57f6860881a638b64e98ed362460bd3f04691d 100644 (file)
@@ -33,4 +33,11 @@ QString getVVSettingsPath();
 ///by default nativeFormat
 QSettings::Format getSettingsOptionFormat();
 
+/// Add a Dicom Server to settings
+void AddDicomServer(std::string nickname, std::string aetitle, std::string adress, std::string port);
+
+// get List of Dicom Servers
+QStringList getDicomServers();
+
+std::map <std::string,std::string > getDicomServer(QString nickname);
 #endif