]> Creatis software - clitk.git/commitdiff
move works for patient retrieve.
authorcervenansky <frederic.cervenansky@creatis.insa-lyon.fr>
Fri, 12 Jul 2013 14:07:11 +0000 (16:07 +0200)
committercervenansky <frederic.cervenansky@creatis.insa-lyon.fr>
Fri, 12 Jul 2013 14:07:11 +0000 (16:07 +0200)
Need to work around to smooth things.

vv/qt_ui/vvPacsConnection.ui
vv/vvMainWindow.cxx
vv/vvQPacsConnection.cxx
vv/vvQPacsConnection.h

index 2cc6b450a88b487d68738b73eb39ccba0995df40..682a825ece4a55139e4083d03ebd1cd554e023cf 100644 (file)
    </property>
   </widget>
   <widget class="QTabWidget" name="tabFilter">
+   <property name="enabled">
+    <bool>true</bool>
+   </property>
    <property name="geometry">
     <rect>
      <x>390</x>
     </rect>
    </property>
    <property name="currentIndex">
-    <number>1</number>
+    <number>0</number>
    </property>
    <widget class="QWidget" name="modalityTab">
     <property name="enabled">
           <property name="text">
            <string>MR</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>CR</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>OT</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>RF</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>SC</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>CT</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
        </layout>
           <property name="text">
            <string>US</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>NM</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>DR</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>SR</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>XA</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item>
           <property name="text">
            <string>MG</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
        </layout>
       </item>
       <item>
        <widget class="QCheckBox" name="check_ModAll">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
         <property name="text">
          <string>All</string>
         </property>
     </rect>
    </property>
    <property name="currentIndex">
-    <number>1</number>
+    <number>0</number>
    </property>
    <widget class="QWidget" name="networkSelect">
     <attribute name="title">
index 3dc0829bc6a2bd0134ef83138c049a82c51afe43..fcce5729b3b0b8b94f7e262ef89c428b49d94593 100644 (file)
@@ -761,8 +761,8 @@ void vvMainWindow::ConnectPacs()
 
   //std::cout << "dicomSeriesSelector " << std::endl;
 if (PacsConnection->exec() == QDialog::Accepted) {
-//    files = *(pacsconnect->GetFilenames());
-   // LoadImages(files, vvImageReader::DICOM);
+       files = PacsConnection->getFileNames();
+    LoadImages(files, vvImageReader::DICOM);
   }
   }
 
index a535e09168b441acd538bcd443cf31729c9b95ea..8c5ebc007e851c018482befbc1ef29b2f49d8850 100644 (file)
@@ -9,6 +9,7 @@
 #include "vvUtils.h"
 
 
+
 vvQPacsConnection::vvQPacsConnection(QWidget *i_parent)
        :QDialog(i_parent)
 {
@@ -20,8 +21,8 @@ vvQPacsConnection::vvQPacsConnection(QWidget *i_parent)
 
        ui. tabNetwork->setTabText(0,QString(tr("Network")));
        ui. tabNetwork->setTabText(1,QString(tr("Configuration")));
-       //ui.setChecked(true);
-       //ui.on_check_ModAll_clicked(true);
+       ui.check_ModAll->setEnabled(true);
+       //on_check_ModAll_clicked(true);
        
        
        ui.networkCombo->addItem("");
@@ -29,7 +30,7 @@ vvQPacsConnection::vvQPacsConnection(QWidget *i_parent)
        
        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.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();
@@ -79,12 +80,10 @@ void vvQPacsConnection::on_scanButton_clicked()
        {
                std::vector< std::pair<gdcm::Tag, std::string> > keys = getKeys();
 
-               gdcm::EQueryLevel theLevel = gdcm::eStudy;
-               gdcm::ERootType theRoot  = gdcm::eStudyRootType;//ePatientRootType;
-       
+               m_level =gdcm::ePatient;
                std::vector<gdcm::DataSet> theDataSet;
-               theLevel = gdcm::ePatient;
-               theRoot  = gdcm::ePatientRootType;//ePatientRootType;
+               gdcm::EQueryLevel theLevel = gdcm::ePatient;
+               gdcm::ERootType theRoot  = gdcm::ePatientRootType;//ePatientRootType;
                gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,getPatientKeys(""));
                bool cfindWork = gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), theQuery, theDataSet,   "CREATIS", m_nickname.c_str());
                if( cfindWork)
@@ -212,48 +211,37 @@ void vvQPacsConnection::createTreeView()
        Imagesmodel = new QStandardItemModel(0,1,this); 
        QStringList Imageslist;
        Imageslist.push_back(tr("instance number"));
+       Imageslist.push_back(tr("sopuid"));
        Imagesmodel->setHorizontalHeaderLabels(Imageslist);
        ui.imagesTreeView->setModel(Imagesmodel);
 }
 
 void vvQPacsConnection::selectStudies(const QModelIndex &index)
 {
+       m_level =gdcm::ePatient;
        Studymodel->removeRows(0, Studymodel->rowCount(),QModelIndex());
        QVariant elt= Patientmodel->data(index.sibling(index.row(),1));
+       QVariant elt2= 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(""));
+       if (  gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), 
+               mquery.composeQueryStudy(m_patient), theDataSet, "CREATIS", m_nickname.c_str()) )
+       {
+               convertDataSet(theDataSet, Studymodel, getStudyKeys(""));
+       }
 }
 
 
 void vvQPacsConnection::selectSeries(const QModelIndex &index)
 {
+       m_level =gdcm::eImage;
        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;
 
@@ -270,22 +258,23 @@ void vvQPacsConnection::selectSeries(const QModelIndex &index)
        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();
+       
+       if ( gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), mquery.composeQuerySeries(keys), theDataSet, "CREATIS", m_nickname.c_str()), "C:\\Boost")
+       {
+               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);
+               convertDataSet(theDataSet, Seriesmodel, getSeriesKeys(""));
+       }
 }
 
 void vvQPacsConnection::selectImages(const QModelIndex &index)
 {
+       m_level = gdcm::eImage;
        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));
@@ -303,16 +292,22 @@ void vvQPacsConnection::selectImages(const QModelIndex &index)
        keys.push_back(std::make_pair(tagss, elt.toString().toStdString()));
        //= getStudyKeys(elt.toString().toStdString());
 
-       // Study Description
+       // Image Description
        gdcm::Tag tagsdc(0x0020,0x0013);
        keys.push_back(std::make_pair(tagsdc, ""));
+               gdcm::Tag tagsic(0x0008,0x0018);
+
 
+       keys.push_back(std::make_pair(tagsic, ""));
 
        gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
        keys.clear();
-       // Study Description
+       // SOP Instance UID 
+       
+
 
        keys.push_back(std::make_pair(tagsdc, ""));
+keys.push_back(std::make_pair(tagsic, ""));
 
        gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), theQuery, theDataSet, "CREATIS", m_nickname.c_str());
        convertDataSet(theDataSet, Imagesmodel, keys);
@@ -474,21 +469,57 @@ void vvQPacsConnection::chooseServer(int index)
 
 void vvQPacsConnection::on_importButton_clicked()
        {
-       
+               int sel = 0;
+               //QModelIndexList list = ui.imagesTreeView-selectedIndexes();
+               QModelIndexList indices =  ui.imagesTreeView->selectionModel()->selectedRows(); 
+               QModelIndexList::iterator it = indices.begin();
+               for(; it != indices.end(); it++)
+                       sel = it->row();
                QModelIndex index;
                QVariant elt= Patientmodel->data(index.sibling(ui.patientTreeView->selectionModel()->selectedRows().first().row(),1));
                
-               gdcm::EQueryLevel theLevel = gdcm::ePatient;
+
                gdcm::ERootType theRoot  = gdcm::ePatientRootType;//ePatientRootType;
                std::vector<gdcm::DataSet> theDataSet;
                std::vector< std::pair<gdcm::Tag, std::string> > keys;
-               
+
+
                // Study Description
-               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::Tag tagsdc(0x0010,0x0020);
+               //keys.push_back(std::make_pair(tagsdc, elt.toString().toStdString()));
+
        
-                bool didItWork =  gdcm::CompositeNetworkFunctions::CMove(m_adress.c_str(),atoi(m_port.c_str()), theQuery, 0,
-       "CREATIS", m_nickname.c_str() );
-       }
\ No newline at end of file
+       // Study Description
+
+
+               gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, m_level ,fillMoveKeys(), true);
+
+               bool didItWork =  gdcm::CompositeNetworkFunctions::CMove(m_adress.c_str(),atoi(m_port.c_str()), theQuery, 1234,
+       "VVCREATIS", m_aetitle.c_str(),"D:\\move" );
+                gdcm::Directory theDir;
+               theDir.Load("D:\\move");
+          m_files =    theDir.GetFilenames();
+          accept();
+       }
+
+std::vector <std::string> vvQPacsConnection::getFileNames()
+{
+       std::vector <std::string> filenames;
+       gdcm::Directory::FilenamesType::iterator it = m_files.begin();
+       for (;it != m_files.end(); it++)
+               filenames.push_back(it->c_str());
+       return filenames;
+}
+std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::fillMoveKeys()
+{
+       std::vector< std::pair<gdcm::Tag, std::string> > keys;
+       switch(m_level)
+       {
+       case gdcm::ePatient:
+                       keys.push_back(std::make_pair(gdcm::Tag(0x0010,0x0020), m_patient));
+               //Patientmodel->data(index.sibling(index.row(),1)).toString().toStdString();
+               break;
+       }
+
+       return keys;
+}
\ No newline at end of file
index 96090658e463e1940443496e5ddb38d5eab0f479..e62886a6025df70e002951cb937ddc0eb659df11 100644 (file)
@@ -7,6 +7,7 @@
 #include <QtGui/QStandardItemModel.h>
 #include <QtGui/QStringListModel.h>
 #include <QFileDialog>
+#include "vvDicomServerQueryFactory.h"
 
   /**
    * \ingroup GUI
@@ -22,6 +23,7 @@
     
          ~vvQPacsConnection(){}
        void refreshNetworks();
+       std::vector <std::string> getFileNames();
 
 public slots:
        void selectStudies(const QModelIndex &index);
@@ -53,15 +55,17 @@ public slots:
        QStandardItemModel *Imagesmodel;
        void convertDataSet(std::vector<gdcm::DataSet> i_ds, QStandardItemModel *i_model, std::vector< std::pair<gdcm::Tag, std::string> > keys);
        void manageSeriesFilter(bool i_enable);
+       std::vector< std::pair<gdcm::Tag, std::string> > fillMoveKeys();
        std::string m_patient;
        std::string m_study;
        std::string m_series;
-       
+       gdcm::EQueryLevel m_level;
        std::string m_port;
        std::string m_aetitle;
        std::string m_adress;
        std::string m_nickname;
-
+       vvDicomServerQueryFactory mquery;
+        gdcm::Directory::FilenamesType m_files;
        
   }; // class vvQPacsConnection
   //=====================================================================