From: cervenansky Date: Fri, 12 Jul 2013 14:07:11 +0000 (+0200) Subject: move works for patient retrieve. X-Git-Tag: v1.4.0~2^2~22 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=510b7ef004cea3c2a8fc6a268694c705de36fa80;p=clitk.git move works for patient retrieve. Need to work around to smooth things. --- diff --git a/vv/qt_ui/vvPacsConnection.ui b/vv/qt_ui/vvPacsConnection.ui index 2cc6b45..682a825 100644 --- a/vv/qt_ui/vvPacsConnection.ui +++ b/vv/qt_ui/vvPacsConnection.ui @@ -341,6 +341,9 @@ + + true + 390 @@ -350,7 +353,7 @@ - 1 + 0 @@ -376,6 +379,9 @@ MR + + true + @@ -383,6 +389,9 @@ CR + + true + @@ -390,6 +399,9 @@ OT + + true + @@ -397,6 +409,9 @@ RF + + true + @@ -404,6 +419,9 @@ SC + + true + @@ -411,6 +429,9 @@ CT + + true + @@ -422,6 +443,9 @@ US + + true + @@ -429,6 +453,9 @@ NM + + true + @@ -436,6 +463,9 @@ DR + + true + @@ -443,6 +473,9 @@ SR + + true + @@ -450,6 +483,9 @@ XA + + true + @@ -457,12 +493,18 @@ MG + + true + + + false + All @@ -538,7 +580,7 @@ - 1 + 0 diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 3dc0829..fcce572 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -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); } } diff --git a/vv/vvQPacsConnection.cxx b/vv/vvQPacsConnection.cxx index a535e09..8c5ebc0 100644 --- a/vv/vvQPacsConnection.cxx +++ b/vv/vvQPacsConnection.cxx @@ -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 > keys = getKeys(); - gdcm::EQueryLevel theLevel = gdcm::eStudy; - gdcm::ERootType theRoot = gdcm::eStudyRootType;//ePatientRootType; - + m_level =gdcm::ePatient; std::vector theDataSet; - theLevel = gdcm::ePatient; - theRoot = gdcm::ePatientRootType;//ePatientRootType; + gdcm::EQueryLevel theLevel = gdcm::ePatient; + gdcm::ERootType theRoot = gdcm::ePatientRootType;//ePatientRootType; gdcm::SmartPointer 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 theDataSet; - std::vector< std::pair > 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 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 theDataSet; std::vector< std::pair > 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 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 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 theDataSet; std::vector< std::pair > keys; - + + // Study Description - gdcm::Tag tagsdc(0x0010,0x0020); - keys.push_back(std::make_pair(tagsdc, elt.toString().toStdString())); - gdcm::SmartPointer 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 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 vvQPacsConnection::getFileNames() +{ + std::vector 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 > vvQPacsConnection::fillMoveKeys() +{ + std::vector< std::pair > 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 diff --git a/vv/vvQPacsConnection.h b/vv/vvQPacsConnection.h index 9609065..e62886a 100644 --- a/vv/vvQPacsConnection.h +++ b/vv/vvQPacsConnection.h @@ -7,6 +7,7 @@ #include #include #include +#include "vvDicomServerQueryFactory.h" /** * \ingroup GUI @@ -22,6 +23,7 @@ ~vvQPacsConnection(){} void refreshNetworks(); + std::vector getFileNames(); public slots: void selectStudies(const QModelIndex &index); @@ -53,15 +55,17 @@ public slots: QStandardItemModel *Imagesmodel; void convertDataSet(std::vector i_ds, QStandardItemModel *i_model, std::vector< std::pair > keys); void manageSeriesFilter(bool i_enable); + std::vector< std::pair > 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 //=====================================================================