]> Creatis software - clitk.git/commitdiff
modify settings save
authorcervenansky <frederic.cervenansky@creatis.insa-lyon.fr>
Tue, 9 Jul 2013 09:14:19 +0000 (11:14 +0200)
committercervenansky <frederic.cervenansky@creatis.insa-lyon.fr>
Tue, 9 Jul 2013 09:14:19 +0000 (11:14 +0200)
CMakeLists.txt
vv/CMakeLists.txt
vv/qt_ui/vvMainWindow.ui
vv/qt_ui/vvPacsConnection.ui
vv/vvIcons.qrc
vv/vvQPacsConnection.cxx
vv/vvQPacsConnection.h
vv/vvUtils.cxx
vv/vvUtils.h

index f64d0aa47e916c08cc921752550312deb4004ca5..20e162ee66cd0965463f8b694e2f26a12ca054ad 100644 (file)
@@ -24,7 +24,7 @@ INCLUDE(${CLITK_SOURCE_DIR}/cmake/dependencies.cmake)
 INCLUDE(${CLITK_SOURCE_DIR}/cmake/build_opt.cmake)
 #=========================================================
 #=========================================================
-
+SET(vvPacsConnection true)
 # Select what is compiled
 ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/common ${PROJECT_BINARY_DIR}/common)
 ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
index acbc86ce05e09ea7f35e59296f6840933db398dd..9c991ff787e131e7fa64ba1a3dc211e7acc3eb16 100644 (file)
@@ -86,7 +86,8 @@ SET(vv_SRCS
   vvSlicerManager.cxx
   vvSlicerManagerCommand.cxx
   vvUtils.cxx
-#  vvMaximumIntensityProjection.cxx  vvMesh.cxx
+#  vvMaximumIntensityProjection.cxx 
+ vvMesh.cxx
   vvMeshActor.cxx
   vvMeshReader.cxx
   vvMidPosition.cxx
@@ -122,20 +123,22 @@ QT4_WRAP_UI(vv_UI_CXX
   qt_ui/vvHelpDialog.ui 
   qt_ui/vvDocumentation.ui 
   qt_ui/vvDicomSeriesSelector.ui
-qt_ui/vvDummyWindow.ui #For testing  )
+qt_ui/vvDummyWindow.ui          #For testing 
+qt_ui/vvPacsConnection.ui
+     qt_ui/vvPacsSettingsDialog.ui
+)
 
 QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
 
 # 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
          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)
+  QT4_WRAP_CPP(vv_SRCS vvQPacsConnection.h
+     vvPacsSettingsDialog.h)
+  #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
index c86d6c892ff3a3270ec4c7000be7a6187e9adf29..444b00fdbed022ba34e72d48b897900b9d08348d 100644 (file)
     <addaction name="separator"/>
     <addaction name="actionOpen_Dicom"/>
     <addaction name="actionOpen_VTK_contour"/>
+    <addaction name="actionConnect_Pacs"/>
     <addaction name="separator"/>
     <addaction name="actionSave_As"/>
     <addaction name="separator"/>
     <addaction name="actionExit"/>
     <addaction name="separator"/>
     <addaction name="separator"/>
-    <addaction name="actionConnect_Pacs"/>
    </widget>
    <addaction name="menuFile"/>
    <addaction name="menuOverlay"/>
index 6e50ca11b2871f5626aa01285ab4027551eb4a70..2cc6b450a88b487d68738b73eb39ccba0995df40 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>923</width>
-    <height>783</height>
+    <width>933</width>
+    <height>802</height>
    </rect>
   </property>
   <property name="font">
     <string notr="true">...</string>
    </property>
    <property name="icon">
-    <iconset>
-     <normaloff>../icons/basket_download.png</normaloff>../icons/basket_download.png</iconset>
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/basket_download.png</normaloff>:/common/icons/basket_download.png</iconset>
    </property>
    <property name="iconSize">
     <size>
   <widget class="QGroupBox" name="groupBox">
    <property name="geometry">
     <rect>
-     <x>70</x>
-     <y>130</y>
+     <x>90</x>
+     <y>140</y>
      <width>311</width>
      <height>271</height>
     </rect>
   <widget class="QGroupBox" name="groupBox_2">
    <property name="geometry">
     <rect>
-     <x>390</x>
-     <y>130</y>
+     <x>410</x>
+     <y>150</y>
      <width>451</width>
      <height>271</height>
     </rect>
   <widget class="QTreeView" name="seriesTreeView">
    <property name="geometry">
     <rect>
-     <x>90</x>
-     <y>440</y>
+     <x>110</x>
+     <y>450</y>
      <width>281</width>
      <height>311</height>
     </rect>
   <widget class="QTreeView" name="imagesTreeView">
    <property name="geometry">
     <rect>
-     <x>410</x>
-     <y>440</y>
+     <x>450</x>
+     <y>450</y>
      <width>411</width>
      <height>311</height>
     </rect>
   <widget class="QGroupBox" name="groupBox_3">
    <property name="geometry">
     <rect>
-     <x>70</x>
-     <y>420</y>
+     <x>90</x>
+     <y>430</y>
      <width>321</width>
      <height>341</height>
     </rect>
   <widget class="QGroupBox" name="groupBox_4">
    <property name="geometry">
     <rect>
-     <x>380</x>
-     <y>420</y>
+     <x>420</x>
+     <y>430</y>
      <width>451</width>
      <height>341</height>
     </rect>
     </rect>
    </property>
    <property name="currentIndex">
-    <number>0</number>
+    <number>1</number>
    </property>
    <widget class="QWidget" name="modalityTab">
     <property name="enabled">
     <rect>
      <x>680</x>
      <y>0</y>
-     <width>231</width>
-     <height>131</height>
+     <width>251</width>
+     <height>151</height>
     </rect>
    </property>
    <property name="currentIndex">
-    <number>0</number>
+    <number>1</number>
    </property>
    <widget class="QWidget" name="networkSelect">
     <attribute name="title">
      <property name="geometry">
       <rect>
        <x>180</x>
-       <y>40</y>
-       <width>41</width>
+       <y>90</y>
+       <width>61</width>
        <height>23</height>
       </rect>
      </property>
      <property name="text">
-      <string>OK</string>
+      <string>Save</string>
      </property>
     </widget>
     <widget class="QWidget" name="layoutWidget">
       </item>
      </layout>
     </widget>
+    <widget class="QPushButton" name="removeNetworkButton">
+     <property name="geometry">
+      <rect>
+       <x>180</x>
+       <y>10</y>
+       <width>61</width>
+       <height>23</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Remove</string>
+     </property>
+    </widget>
    </widget>
   </widget>
   <widget class="QLabel" name="label_2">
     <string notr="true">...</string>
    </property>
    <property name="icon">
-    <iconset>
-     <normaloff>bullet_info.png</normaloff>bullet_info.png</iconset>
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/bullet_info.png</normaloff>:/common/icons/bullet_info.png</iconset>
    </property>
    <property name="iconSize">
     <size>
     </rect>
    </property>
    <property name="text">
-    <string notr="true">...</string>
+    <string notr="true"/>
    </property>
    <property name="icon">
-    <iconset>
-     <normaloff>../icons/edit.png</normaloff>../icons/edit.png</iconset>
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/edit.png</normaloff>:/common/icons/edit.png</iconset>
    </property>
    <property name="iconSize">
     <size>
   <zorder>optionsButton</zorder>
   <zorder>label_email_2</zorder>
  </widget>
+ <tabstops>
+  <tabstop>scanButton</tabstop>
+  <tabstop>text_ID</tabstop>
+  <tabstop>clearButton</tabstop>
+  <tabstop>text_NAME</tabstop>
+  <tabstop>importButton</tabstop>
+  <tabstop>seriesTreeView</tabstop>
+  <tabstop>imagesTreeView</tabstop>
+  <tabstop>text_PHYS</tabstop>
+  <tabstop>text_SDESC</tabstop>
+  <tabstop>tabFilter</tabstop>
+  <tabstop>tabNetwork</tabstop>
+  <tabstop>helpButton</tabstop>
+  <tabstop>optionsButton</tabstop>
+  <tabstop>patientTreeView</tabstop>
+  <tabstop>studyTreeView</tabstop>
+  <tabstop>check_MR</tabstop>
+  <tabstop>check_CR</tabstop>
+  <tabstop>check_OT</tabstop>
+  <tabstop>check_RF</tabstop>
+  <tabstop>check_SC</tabstop>
+  <tabstop>check_CT</tabstop>
+  <tabstop>check_US</tabstop>
+  <tabstop>check_NM</tabstop>
+  <tabstop>check_DR</tabstop>
+  <tabstop>check_SR</tabstop>
+  <tabstop>check_XA</tabstop>
+  <tabstop>check_MG</tabstop>
+  <tabstop>check_ModAll</tabstop>
+  <tabstop>comboDate</tabstop>
+  <tabstop>dateEdit</tabstop>
+  <tabstop>dateBetweenEdit</tabstop>
+  <tabstop>networkCombo</tabstop>
+  <tabstop>NetworkButton</tabstop>
+  <tabstop>NameEdit</tabstop>
+  <tabstop>AETitleEdit</tabstop>
+  <tabstop>AdressEdit</tabstop>
+  <tabstop>PortEdit</tabstop>
+  <tabstop>removeNetworkButton</tabstop>
+ </tabstops>
  <resources>
   <include location="../vvIcons.qrc"/>
  </resources>
index dbc93e3192deffc5fd1f86ca93c8c4cbb55e380f..0737e3c3ec80fefd4802b112469c371340bcc233 100644 (file)
@@ -41,7 +41,7 @@
     <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/edit.png</file>
        <file>icons/bullet_info.png</file>
   </qresource>
 </RCC>
index 9cc4c9c4013e3c687ea924a57019b6f7add26dac..3c7a5e556951abee1ec0c73f3375b3660a3f3b5e 100644 (file)
@@ -22,28 +22,44 @@ vvQPacsConnection::vvQPacsConnection(QWidget *i_parent)
        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->addItem("");
        ui.networkCombo->addItems(getDicomServers());
-       connect(ui.networkCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(connectServer(int)));
+       
+       connect(ui.networkCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(chooseServer(int)));
        connect(ui.scanButton,SIGNAL(clicked()),this,SLOT(on_scanButton_clicked()));
+       connect(ui.importButton, SIGNAL(clicked()), this, SLOT(on_importButton_clicked()));
+       connect(ui.removeNetworkButton,SIGNAL(clicked()),this,SLOT(removeServer()));
+       connect(ui.NetworkButton,SIGNAL(clicked()),this,SLOT(modifyServer()));
        update();
 }
 
+void vvQPacsConnection::removeServer()
+{
+       removeDicomServer(m_nickname);
+       ui.networkCombo->removeItem(ui.networkCombo->findText(QString(m_nickname.c_str())));
+       m_nickname="";
+       refreshNetworks();
+}
+
+void vvQPacsConnection::modifyServer()
+{
+       AddDicomServer(ui.NameEdit->text().toStdString(),ui.AETitleEdit->text().toStdString(),ui.AdressEdit->text().toStdString(),ui.PortEdit->text().toStdString());
+       removeServer();
+}
+
+
 void vvQPacsConnection::refreshNetworks()
 {
        ui.networkCombo->clear();
+       ui.networkCombo->addItem(QString());
        ui.networkCombo->addItems(getDicomServers());
-       //ui.networkCombo->show();
+       ui.NameEdit->setText(QString());
+       ui.AETitleEdit->setText(QString());
+       ui.AdressEdit->setText(QString());
+       ui.PortEdit->setText(QString());
+       ui.tabNetwork->setCurrentIndex(0);
 }
 
 void vvQPacsConnection::on_clearButton_clicked()
@@ -59,45 +75,48 @@ 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();
+       if (didItWork)
+       {
+               std::vector< std::pair<gdcm::Tag, std::string> > keys = getKeys();
 
-       gdcm::EQueryLevel theLevel = gdcm::eStudy;
-       gdcm::ERootType theRoot  = gdcm::eStudyRootType;//ePatientRootType;
+               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();
+               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++)
-       {
-               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++)
+               for(; it_ds != theDataSet.end(); it_ds++)
                {
-                       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)
+                       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++)
                        {
-                               item->setCheckable(true);
+                               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);
                        }
-                       items.push_back(item);
+                       Patientmodel->appendRow(items);
                }
-               Patientmodel->appendRow(items);
        }
 }
 
@@ -152,7 +171,7 @@ void vvQPacsConnection::convertDataSet(std::vector<gdcm::DataSet> i_ds, QStandar
 
 }
 
-
+// TreeViews creation
 void vvQPacsConnection::createTreeView()
 {
        // Patient Tree View
@@ -437,7 +456,7 @@ void vvQPacsConnection::on_check_ModAll_clicked(bool state)
 
 }
 
-void vvQPacsConnection::connectServer(int index)
+void vvQPacsConnection::chooseServer(int index)
 {
        std::map < std::string, std:: string> values = getDicomServer(ui.networkCombo->currentText());
        m_port = values["PORT"];
@@ -452,6 +471,7 @@ void vvQPacsConnection::connectServer(int index)
 
 void vvQPacsConnection::on_importButton_clicked()
        {
+       
                QModelIndex index;
                QVariant elt= Patientmodel->data(index.sibling(ui.patientTreeView->selectionModel()->selectedRows().first().row(),1));
                
@@ -467,5 +487,5 @@ void vvQPacsConnection::on_importButton_clicked()
        //      gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet, "CREATIS", "CONQUESTSRV1");
        
                 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\\" );
+       "CREATIS", m_nickname.c_str() );
        }
\ No newline at end of file
index 3fbb1f756902be421416eb1feb46b465b9dfc6ff..96090658e463e1940443496e5ddb38d5eab0f479 100644 (file)
@@ -33,7 +33,9 @@ public slots:
        void on_optionsButton_clicked();
        void on_check_ModAll_clicked(bool state);
        void on_importButton_clicked();
- void connectServer(int index);
+ void chooseServer(int index);
+ void removeServer();
+ void modifyServer();
 
   private :
          Ui::vvPacsConnection ui;
index 2dc0a96e07ec54166cf1c7ab83be7c282f24e465..86b20dbe1ef496a1a13b1b07593a2a465779618f 100644 (file)
@@ -48,7 +48,7 @@ FileListType GetRecentlyOpenedImages()
   return result;
 }
 
-/// Add new Dicom Server
+/// Add new Dicom Server
 void AddDicomServer(std::string nickname, std::string aetitle, std::string adress, std::string port)
 {
        QSettings settings(getVVSettingsPath(), getSettingsOptionFormat());
@@ -61,8 +61,23 @@ void AddDicomServer(std::string nickname, std::string aetitle, std::string adres
         settings.endGroup();
 }
 
+/// Remove a Dicom Server
+void removeDicomServer(std::string nickname)
+{
+       QSettings settings(getVVSettingsPath(), getSettingsOptionFormat());
+        settings.beginGroup(QString::fromStdString("DICOMSERVER"));
+        std::string temp = nickname + "//";
+        settings.remove(QString::fromStdString(temp + "nickname"));
+        settings.remove(QString::fromStdString(temp + "AETITLE"));
+         settings.remove(QString::fromStdString(temp + "ADRESS"));
+          settings.remove(QString::fromStdString(temp + "PORT"));
+        settings.endGroup();
+}
+
+
+
 
-//std::map <std::string, std::vector<std::string> > getDicomServers()
+/// get the list of a Dicom Server
 QStringList getDicomServers()
 {
 
@@ -79,6 +94,7 @@ QStringList getDicomServers()
         return list;
 }
 
+/// get needed Infos for a Dicom Server
 std::map <std::string,std::string > getDicomServer(QString nickname)
 {
                std::map< std::string, std::string  >results;
index 3d57f6860881a638b64e98ed362460bd3f04691d..6aabdbeae647a73d1bef044fd0da5d86f55d1e55 100644 (file)
@@ -36,6 +36,9 @@ QSettings::Format getSettingsOptionFormat();
 /// Add a Dicom Server to settings
 void AddDicomServer(std::string nickname, std::string aetitle, std::string adress, std::string port);
 
+/// Remove a Dicom Server to settings
+void removeDicomServer(std::string nickname);
+
 // get List of Dicom Servers
 QStringList getDicomServers();