From bd214ab6c4b46616c15d5ba79b42be6d59709985 Mon Sep 17 00:00:00 2001 From: cervenansky Date: Tue, 9 Jul 2013 11:26:58 +0200 Subject: [PATCH] remove double patients in PatientTree --- vv/vvQPacsConnection.cxx | 59 +++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/vv/vvQPacsConnection.cxx b/vv/vvQPacsConnection.cxx index 3c7a5e5..a535e09 100644 --- a/vv/vvQPacsConnection.cxx +++ b/vv/vvQPacsConnection.cxx @@ -28,7 +28,7 @@ vvQPacsConnection::vvQPacsConnection(QWidget *i_parent) ui.networkCombo->addItems(getDicomServers()); connect(ui.networkCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(chooseServer(int))); - connect(ui.scanButton,SIGNAL(clicked()),this,SLOT(on_scanButton_clicked())); + //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())); @@ -86,38 +86,41 @@ void vvQPacsConnection::on_scanButton_clicked() theLevel = gdcm::ePatient; theRoot = gdcm::ePatientRootType;//ePatientRootType; gdcm::SmartPointer 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::iterator it_ds = theDataSet.begin(); - - for(; it_ds != theDataSet.end(); it_ds++) + bool cfindWork = gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), theQuery, theDataSet, "CREATIS", m_nickname.c_str()); + if( cfindWork) { - QList items; - const gdcm::DataSet ds = (*it_ds); - std::vector< std::pair >::iterator it_key = keys.begin(); - int ind = 0; - for(; it_key != keys.end(); it_key++, ind++) + std::vector::iterator it_ds = theDataSet.begin(); + + 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 + QList items; + const gdcm::DataSet ds = (*it_ds); + std::vector< std::pair >::iterator it_key = keys.begin(); + int ind = 0; + for(; it_key != keys.end(); it_key++, ind++) { - item->setText(tr("")); + 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); } - if(ind ==0) - { - item->setCheckable(true); - } - items.push_back(item); + Patientmodel->appendRow(items); } - Patientmodel->appendRow(items); - } - } + } // end cfindwork + } // end didItwork } -- 2.47.1