From: cervenansky Date: Tue, 9 Jul 2013 09:14:19 +0000 (+0200) Subject: modify settings save X-Git-Tag: v1.4.0~2^2~24 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=1bebf5dcaeaef53f13b21e8d4ea33055114e3ea4;p=clitk.git modify settings save --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f64d0aa..20e162e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index acbc86c..9c991ff 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -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 diff --git a/vv/qt_ui/vvMainWindow.ui b/vv/qt_ui/vvMainWindow.ui index c86d6c8..444b00f 100644 --- a/vv/qt_ui/vvMainWindow.ui +++ b/vv/qt_ui/vvMainWindow.ui @@ -872,6 +872,7 @@ + @@ -881,7 +882,6 @@ - diff --git a/vv/qt_ui/vvPacsConnection.ui b/vv/qt_ui/vvPacsConnection.ui index 6e50ca1..2cc6b45 100644 --- a/vv/qt_ui/vvPacsConnection.ui +++ b/vv/qt_ui/vvPacsConnection.ui @@ -6,8 +6,8 @@ 0 0 - 923 - 783 + 933 + 802 @@ -130,8 +130,8 @@ ... - - ../icons/basket_download.png../icons/basket_download.png + + :/common/icons/basket_download.png:/common/icons/basket_download.png @@ -143,8 +143,8 @@ - 70 - 130 + 90 + 140 311 271 @@ -183,8 +183,8 @@ - 390 - 130 + 410 + 150 451 271 @@ -211,8 +211,8 @@ - 90 - 440 + 110 + 450 281 311 @@ -221,8 +221,8 @@ - 410 - 440 + 450 + 450 411 311 @@ -231,8 +231,8 @@ - 70 - 420 + 90 + 430 321 341 @@ -249,8 +249,8 @@ - 380 - 420 + 420 + 430 451 341 @@ -350,7 +350,7 @@ - 0 + 1 @@ -533,12 +533,12 @@ 680 0 - 231 - 131 + 251 + 151 - 0 + 1 @@ -563,13 +563,13 @@ 180 - 40 - 41 + 90 + 61 23 - OK + Save @@ -636,6 +636,19 @@ + + + + 180 + 10 + 61 + 23 + + + + Remove + + @@ -686,8 +699,8 @@ ... - - bullet_info.pngbullet_info.png + + :/common/icons/bullet_info.png:/common/icons/bullet_info.png @@ -706,11 +719,11 @@ - ... + - - ../icons/edit.png../icons/edit.png + + :/common/icons/edit.png:/common/icons/edit.png @@ -760,6 +773,46 @@ optionsButton label_email_2 + + scanButton + text_ID + clearButton + text_NAME + importButton + seriesTreeView + imagesTreeView + text_PHYS + text_SDESC + tabFilter + tabNetwork + helpButton + optionsButton + patientTreeView + studyTreeView + check_MR + check_CR + check_OT + check_RF + check_SC + check_CT + check_US + check_NM + check_DR + check_SR + check_XA + check_MG + check_ModAll + comboDate + dateEdit + dateBetweenEdit + networkCombo + NetworkButton + NameEdit + AETitleEdit + AdressEdit + PortEdit + removeNetworkButton + diff --git a/vv/vvIcons.qrc b/vv/vvIcons.qrc index dbc93e3..0737e3c 100644 --- a/vv/vvIcons.qrc +++ b/vv/vvIcons.qrc @@ -41,7 +41,7 @@ icons/standardbutton-cancel-16.png icons/identity.png icons/basket_download.png - icons/bullet_info.png + icons/edit.png icons/bullet_info.png diff --git a/vv/vvQPacsConnection.cxx b/vv/vvQPacsConnection.cxx index 9cc4c9c..3c7a5e5 100644 --- a/vv/vvQPacsConnection.cxx +++ b/vv/vvQPacsConnection.cxx @@ -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 > keys = getKeys(); + if (didItWork) + { + std::vector< std::pair > 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 theDataSet; - 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(); + std::vector theDataSet; + 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++) - { - 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++) + 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 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->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 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 diff --git a/vv/vvQPacsConnection.h b/vv/vvQPacsConnection.h index 3fbb1f7..9609065 100644 --- a/vv/vvQPacsConnection.h +++ b/vv/vvQPacsConnection.h @@ -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; diff --git a/vv/vvUtils.cxx b/vv/vvUtils.cxx index 2dc0a96..86b20db 100644 --- a/vv/vvUtils.cxx +++ b/vv/vvUtils.cxx @@ -48,7 +48,7 @@ FileListType GetRecentlyOpenedImages() return result; } -/// Add new Dicom Server +/// Add a 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 > 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 getDicomServer(QString nickname) { std::map< std::string, std::string >results; diff --git a/vv/vvUtils.h b/vv/vvUtils.h index 3d57f68..6aabdbe 100644 --- a/vv/vvUtils.h +++ b/vv/vvUtils.h @@ -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();