From: tbaudier Date: Fri, 22 Jul 2016 12:58:01 +0000 (+0200) Subject: Ensure compilation with VTK6/Qt5 and newer version of GDCM X-Git-Tag: v1.4.0~2^2~4 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c45f077f35553cdc72396626ac601080093d273b;p=clitk.git Ensure compilation with VTK6/Qt5 and newer version of GDCM --- c45f077f35553cdc72396626ac601080093d273b diff --cc CMakeLists.txt index 20e162e,f0ed562..3bb8fc5 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@@ -5,28 -5,36 +5,36 @@@ cmake_minimum_required(VERSION 2.8 cmake_policy(VERSION 2.8) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) + cmake_policy(SET CMP0007 NEW) endif(COMMAND cmake_policy) - IF(NOT DEFINED CLITK_SOURCE_DIR) - SET(CLITK_SOURCE_DIR ${PROJECT_SOURCE_DIR}) - ENDIF(NOT DEFINED CLITK_SOURCE_DIR) + if(NOT DEFINED CLITK_SOURCE_DIR) + set(CLITK_SOURCE_DIR ${PROJECT_SOURCE_DIR}) + endif(NOT DEFINED CLITK_SOURCE_DIR) + # Default build type + IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + ENDIF(NOT CMAKE_BUILD_TYPE) #========================================================= - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - IF(MSVC) - SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj" ) - SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj" ) - ENDIF(MSVC) + if(MSVC) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj" ) + endif(MSVC) #========================================================= - INCLUDE(${CLITK_SOURCE_DIR}/cmake/common.cmake) - INCLUDE(${CLITK_SOURCE_DIR}/cmake/dependencies.cmake) - INCLUDE(${CLITK_SOURCE_DIR}/cmake/build_opt.cmake) + include(${CLITK_SOURCE_DIR}/cmake/common.cmake) + 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) - ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/segmentation ${PROJECT_BINARY_DIR}/segmentation) - ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/registration ${PROJECT_BINARY_DIR}/registration) + add_subdirectory(${CLITK_SOURCE_DIR}/common ${PROJECT_BINARY_DIR}/common) + add_subdirectory(${CLITK_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools) + add_subdirectory(${CLITK_SOURCE_DIR}/segmentation ${PROJECT_BINARY_DIR}/segmentation) + add_subdirectory(${CLITK_SOURCE_DIR}/registration ${PROJECT_BINARY_DIR}/registration) + add_subdirectory(${CLITK_SOURCE_DIR}/cluster_tools ${PROJECT_BINARY_DIR}/cluster_tools) diff --cc common/CMakeLists.txt index 28199ad,5a700ac..e17c4dc --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@@ -64,16 -64,16 +64,16 @@@ endif(CLITK_MEMORY_INFO #========================================================= - IF (CLITK_USE_SYSTEM_GDCM) - FIND_PACKAGE(GDCM REQUIRED) + if(CLITK_USE_SYSTEM_GDCM) + find_package(GDCM REQUIRED) include(${GDCM_USE_FILE}) - TARGET_LINK_LIBRARIES(clitkCommon vtkgdcm gdcmDICT gdcmMSFF gdcmMEXD) - ENDIF() - target_link_libraries(clitkCommon vtkgdcm gdcmDICT gdcmMSFF) ++ target_link_libraries(clitkCommon vtkgdcm gdcmDICT gdcmMSFF gdcmMEXD) + endif() #========================================================= - TARGET_LINK_LIBRARIES(clitkCommon ${VTK_LIBRARIES} ${ITK_LIBRARIES}) + target_link_libraries(clitkCommon ${VTK_LIBRARIES} ${ITK_LIBRARIES}) - ADD_LIBRARY(clitkDicomRTStruct STATIC + add_library(clitkDicomRTStruct STATIC clitkDicomRT_Contour.cxx clitkDicomRT_ROI.cxx clitkDicomRT_StructureSet.cxx diff --cc vv/CMakeLists.txt index 9986789,a0a227f..f43f41a --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@@ -4,12 -4,14 +4,13 @@@ cmake_minimum_required(VERSION 2.4 # To avoid warning with some version if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) + cmake_policy(SET CMP0007 NEW) endif(COMMAND cmake_policy) #========================================================= - - +OPTION(CLITK_USE_PACS_CONNECTION "USE PACS CONNECTION" OFF) #========================================================= #List of vv tools to compile - SET(vv_TOOLS + set(vv_TOOLS vvToolMedianFilter vvToolRigidReg vvToolCropImage @@@ -105,93 -110,150 +109,171 @@@ set(vv_SRC #========================================================= # Qt related commands - FIND_PACKAGE(Qt4 REQUIRED) - + if(vv_QT_VERSION VERSION_GREATER "4") + find_package(Qt5Widgets REQUIRED) + find_package(Qt5Network REQUIRED) + find_package(Qt5Designer REQUIRED) + else() + find_package(Qt4 REQUIRED) + endif() - QT4_WRAP_CPP(vv_SRCS - vvMainWindowBase.h - QTreePushButton.h - vvDocumentation.h - vvHelpDialog.h - vvQDicomSeriesSelector.h - vvSlicerManager.h - vvStructureSetActor.h - vvROIActor.h - vvToolCreatorBase.h - ) + if(vv_QT_VERSION VERSION_GREATER "4") + link_directories(${QT5Widgets_LIBRARIES}) + link_directories(${QT5Network_LIBRARIES}) + link_directories(${QT5Designer_LIBRARIES}) + else() + link_directories(${QT_LIBRARY_DIR}) + endif() - 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/vvPacsConnection.ui - # qt_ui/vvPacsSettingsDialog.ui - ) + if(vv_QT_VERSION VERSION_GREATER "4") + qt5_wrap_cpp(vv_SRCS + vvMainWindowBase.h + QTreePushButton.h + vvDocumentation.h + vvHelpDialog.h + vvQDicomSeriesSelector.h + vvSlicerManager.h + vvSlicer.h + vvStructureSetActor.h + vvROIActor.h + vvToolCreatorBase.h + ) + else() + QT4_WRAP_CPP(vv_SRCS + vvMainWindowBase.h + QTreePushButton.h + vvDocumentation.h + vvHelpDialog.h + vvQDicomSeriesSelector.h + vvSlicerManager.h + vvSlicer.h + vvStructureSetActor.h + vvROIActor.h + vvToolCreatorBase.h + ) + endif() - QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc) + if(vv_QT_VERSION VERSION_GREATER "4") + qt5_wrap_ui(vv_UI_CXX + qt_ui/vvHelpDialog.ui + qt_ui/vvDocumentation.ui + qt_ui/vvDicomSeriesSelector.ui + qt_ui/vvDummyWindow.ui #For testing + ) + else() + QT4_WRAP_UI(vv_UI_CXX + qt_ui/vvHelpDialog.ui + qt_ui/vvDocumentation.ui + qt_ui/vvDicomSeriesSelector.ui + qt_ui/vvDummyWindow.ui #For testing + ) + endif() + + if(vv_QT_VERSION VERSION_GREATER "4") + QT5_add_resources(vv_SRCS vvIcons.qrc) + else() + QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc) + endif() + +# Add DICOM SERVER gui selector if the adequate GDCM is available - IF(CLITK_USE_PACS_CONNECTION) ++if(CLITK_USE_PACS_CONNECTION) + SET(vv_SRCS ${vv_SRCS} - vvQPacsConnection.cxx - vvPacsSettingsDialog.cxx - vvDicomServerQueryFactory.cxx - ) - 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_PACS_CONNECTION) - - # Add the autotools in the header vvToolsList.h for initialization of the dummy - # variables in vv.cxx for the tools contained in vvLib - if(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h) - foreach(tool ${vv_TOOLS}) - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n") - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n") - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n") ++ vvQPacsConnection.cxx ++ vvPacsSettingsDialog.cxx ++ vvDicomServerQueryFactory.cxx ++ ) ++ if(vv_QT_VERSION VERSION_GREATER "4") ++ qt5_wrap_cpp(vv_SRCS vvQPacsConnection.h ++ vvPacsSettingsDialog.h) ++ qt5_wrap_ui(vv_UI_CXX ++ qt_ui/vvPacsConnection.ui ++ qt_ui/vvPacsSettingsDialog.ui) ++ else() ++ QT4_WRAP_CPP(vv_SRCS vvQPacsConnection.h ++ vvPacsSettingsDialog.h) ++ QT4_WRAP_UI(vv_UI_CXX ++ qt_ui/vvPacsConnection.ui ++ qt_ui/vvPacsSettingsDialog.ui) ++ endif() ++endif(CLITK_USE_PACS_CONNECTION) + + # Add the autotools in the header vvToolsList.h for initialization of the dummy + # variables in vv.cxx for the tools contained in vvLib + if(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h) + foreach(tool ${vv_TOOLS}) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n") + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n") + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n") + endforeach(tool) + endif(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h) + + # Add the autotools and the common files ui + foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI}) + set(vv_SRCS ${vv_SRCS} ${tool}.cxx) + if(vv_QT_VERSION VERSION_GREATER "4") + QT5_WRAP_CPP(vv_SRCS ${tool}.h) + QT5_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui) + else() + QT4_WRAP_CPP(vv_SRCS ${tool}.h) + QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui) + endif() endforeach(tool) - endif(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h) - - # Add the autotools and the common files ui - foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI}) - SET(vv_SRCS ${vv_SRCS} ${tool}.cxx) - QT4_WRAP_CPP(vv_SRCS ${tool}.h) - QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui) - endforeach(tool) - - # Add the common source files - foreach(tool ${vv_COMMON}) - SET(vv_SRCS ${vv_SRCS} ${tool}.cxx) - QT4_WRAP_CPP(vv_SRCS ${tool}.h) - endforeach(tool) - - # if Windows and Qt was built as a static lib then don't set QT_DLL flag - SET(QT_STATIC 0) - IF (WIN32) - IF(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl) - FILE(READ ${QT_LIBRARY_DIR}/QtCore.prl QT_CORE_PRL) - IF(${QT_CORE_PRL} MATCHES "static") - SET(QT_STATIC 1) - ENDIF(${QT_CORE_PRL} MATCHES "static") - ENDIF(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl) - ENDIF(WIN32) - IF(NOT QT_STATIC) - ADD_DEFINITIONS(-DQT_DLL) - ENDIF(NOT QT_STATIC) - - ADD_DEFINITIONS(-DQT_THREAD_SUPPORT) + + # Add the common source files + foreach(tool ${vv_COMMON}) + set(vv_SRCS ${vv_SRCS} ${tool}.cxx) + if(vv_QT_VERSION VERSION_GREATER "4") + QT5_WRAP_CPP(vv_SRCS ${tool}.h) + else() + QT4_WRAP_CPP(vv_SRCS ${tool}.h) + endif() + endforeach(tool) + + # if Windows and Qt was built as a static lib then don't set QT_DLL flag + set(QT_STATIC 0) + if(WIN32) + if(vv_QT_VERSION VERSION_GREATER "4") + if(EXISTS ${Qt5Widgets_LIBRARIES}/QtCore.prl) + file(READ ${Qt5Widgets_LIBRARIES}/QtCore.prl QT_CORE_PRL) + if(${QT_CORE_PRL} MATCHES "static") + set(QT_STATIC 1) + endif(${QT_CORE_PRL} MATCHES "static") + endif(EXISTS ${Qt5Widgets_LIBRARIES}/QtCore.prl) + else() + if(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl) + file(READ ${QT_LIBRARY_DIR}/QtCore.prl QT_CORE_PRL) + if(${QT_CORE_PRL} MATCHES "static") + set(QT_STATIC 1) + endif(${QT_CORE_PRL} MATCHES "static") + endif(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl) + endif() + endif(WIN32) + if(NOT QT_STATIC) + add_definitions(-DQT_DLL) + endif(NOT QT_STATIC) - INCLUDE_DIRECTORIES( - ${QT_INCLUDES} - ${QT_INCLUDE_DIR} - ${QT_QTGUI_INCLUDE_DIR} - ${QT_QTCORE_INCLUDE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ) + add_definitions(-DQT_THREAD_SUPPORT) + if(vv_QT_VERSION VERSION_GREATER "4") + include_directories( + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Network_INCLUDE_DIRS} + ${Qt5Designer_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ) + else() + include_directories( + ${QT_INCLUDES} + ${QT_INCLUDE_DIR} + ${QT_QTGUI_INCLUDE_DIR} + ${QT_QTCORE_INCLUDE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ) + endif() #========================================================= #========================================================= diff --cc vv/qt_ui/vvPacsConnection.ui index e6c044a,0000000..3347fec mode 100644,000000..100644 --- a/vv/qt_ui/vvPacsConnection.ui +++ b/vv/qt_ui/vvPacsConnection.ui @@@ -1,862 -1,0 +1,862 @@@ + + + vvPacsConnection + + + + 0 + 0 + 933 + 802 + + + + + Calibri + 9 + 75 + true + + + + Form + + + + false + + + + 110 + 10 + 91 + 16 + + + + Patient ID + + + + + + 110 + 30 + 101 + 21 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + + + + 10 + 40 + 75 + 23 + + + + SCAN + + + + + + 10 + 70 + 75 + 23 + + + + CLEAR + + + + + + 250 + 30 + 101 + 21 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + + + false + + + + 250 + 10 + 91 + 16 + + + + Patient name + + + + + + 10 + 160 + 51 + 51 + + + + ... + + + + :/common/icons/basket_download.png:/common/icons/basket_download.png + + + + 32 + 32 + + + + + + + 90 + 140 + 311 + 271 + + + + + 11 + + + + Patients + + + + true + + + + 20 + 20 + 281 + 231 + + + + Qt::ScrollBarAlwaysOn + + + true + + + false + + + + + + + 410 + 150 + 451 + 271 + + + + + 11 + + + + Studies + + + + + 40 + 20 + 411 + 231 + + + + + + + + 110 + 450 + 281 + 311 + + + + + + + 450 + 450 + 411 + 311 + + + + + + + 90 + 430 + 321 + 341 + + + + + 11 + + + + Series + + + + + + 420 + 430 + 451 + 341 + + + + + 11 + + + + Images + + + + + false + + + + 110 + 80 + 101 + 21 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + + + false + + + + 110 + 60 + 91 + 16 + + + + Physician Ref. + + + + + false + + + + 250 + 60 + 91 + 16 + + + + Study Description + + + + + false + + + + 250 + 80 + 101 + 21 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + + + true + + + + 390 + 0 + 271 + 131 + + + + 0 + + + + false + + + Modalities + + + + + 0 + 10 + 264 + 72 + + + + + + + + + MR + + + true + + + + + + + CR + + + true + + + + + + + OT + + + true + + + + + + + RF + + + true + + + + + + + SC + + + true + + + + + + + CT + + + true + + + + + + + + + + + US + + + true + + + + + + + NM + + + true + + + + + + + DR + + + true + + + + + + + SR + + + true + + + + + + + XA + + + true + + + + + + + MG + + + true + + + + + + + + + false + + + All + + + true + + + + + + + + + false + + + Date + + + + + 20 + 20 + 101 + 22 + + + + + Before + + + + + After + + + + + Between + + + + + + + 130 + 20 + 110 + 22 + + + + + + + 130 + 50 + 110 + 22 + + + + + + + + + 680 + 0 + 251 + 151 + + + + 0 + + + + Network + + + + + 20 + 40 + 191 + 22 + + + + + + + Network management + + + + + 180 + 90 + 61 + 23 + + + + Save + + - ++ + + + 0 + 0 + 179 + 120 + + + + + + + false + + + Name + + + + + + + + + + + + + false + + + Adress + + + + + + + + + + false + + + Port + + + + + + + + + + false + + + AE Title + + + + + + + + + 180 + 10 + 61 + 23 + + + + Remove + + + + + + + true + + + + 10 + 210 + 71 + 16 + + + + Import Data + + + + + true + + + + 10 + 530 + 51 + 20 + + + + Help + + + Qt::AlignCenter + + + + + + 10 + 480 + 51 + 51 + + + + ... + + + + :/common/icons/bullet_info.png:/common/icons/bullet_info.png + + + + 32 + 32 + + + + + + + 10 + 400 + 51 + 51 + + + + + + + + :/common/icons/edit.png:/common/icons/edit.png + + + + 32 + 32 + + + + + + true + + + + 20 + 450 + 41 + 21 + + + + Options + + + groupBox_4 + groupBox_3 + label_ID + patientID + scanButton + clearButton + patientName + label_NAME + importButton + groupBox + groupBox_2 + seriesTreeView + imagesTreeView + text_PHYS + label_PHYS + label_SDESC + text_SDESC + tabFilter + tabNetwork + label_2 + label_help + helpButton + optionsButton + label_email_2 + + + scanButton + patientID + clearButton + patientName + 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 --cc vv/vvMainWindow.cxx index a566c3a,1bc0759..ba3f313 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@@ -47,11 -48,11 +48,14 @@@ It is distributed under dual licenc #include "vvMeshReader.h" #include "vvSaveState.h" #include "vvReadState.h" +#ifdef CLITK_USE_PACS_CONNECTION +#include "vvQPacsConnection.h" +#endif #include "clitkConfiguration.h" #include "clitkMatrix.h" + #ifdef Q_OS_OSX + # include "vvOSXHelper.h" + #endif // ITK include #include @@@ -124,9 -128,12 +131,14 @@@ //------------------------------------------------------------------------------ vvMainWindow::vvMainWindow():vvMainWindowBase() - { + { setupUi(this); // this sets up the GUI + + setDicomClient(); ++ + //Qt::WindowFlags flags = windowFlags(); + //setWindowFlags(flags | Qt::WindowStaysOnTopHint); + mInputPathName = ""; mMenuTools = menuTools; // mMenuSegmentation = menuSegmentation; diff --cc vv/vvQPacsConnection.cxx index 8f40ae6,0000000..89ac841 mode 100644,000000..100644 --- a/vv/vvQPacsConnection.cxx +++ b/vv/vvQPacsConnection.cxx @@@ -1,436 -1,0 +1,436 @@@ +#include "vvQPacsConnection.h" +#include "gdcmCompositeNetworkFunctions.h" +#include +#include +#include +#include +#include +#include "vvPacsSettingsDialog.h" +#include "vvUtils.h" +#include +#include +#include + + +vvQPacsConnection::vvQPacsConnection(QWidget *i_parent) + :QDialog(i_parent) +{ + ui.setupUi(this); + setWindowTitle(QString::fromUtf8("PACS CONNECTIONHHHH")); + createTreeView(); + ui.tabFilter->setTabText(0,QString(tr("Modality"))); + ui.tabFilter->setTabText(1,QString(tr("Date"))); + + ui. tabNetwork->setTabText(0,QString(tr("Network"))); + ui. tabNetwork->setTabText(1,QString(tr("Configuration"))); + ui.check_ModAll->setEnabled(true); + ui.networkCombo->addItem(""); + ui.networkCombo->addItems(getDicomServers()); + + // Connection + connect(ui.networkCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(chooseServer(int))); + connect(ui.removeNetworkButton,SIGNAL(clicked()),this,SLOT(removeServer())); + connect(ui.NetworkButton,SIGNAL(clicked()),this,SLOT(modifyServer())); + + update(); +} + +// remote a Dicom Server in VV settings +void vvQPacsConnection::removeServer() +{ + removeDicomServer(m_nickname); + ui.networkCombo->removeItem(ui.networkCombo->findText(QString(m_nickname.c_str()))); + m_nickname=""; + refreshNetworks(); +} + +// modify a Dicom Server in VV settings +void vvQPacsConnection::modifyServer() +{ + AddDicomServer(ui.NameEdit->text().toStdString(),ui.AETitleEdit->text().toStdString(),ui.AdressEdit->text().toStdString(),ui.PortEdit->text().toStdString()); + removeServer(); +} + +// refresh the list of Dicom Servers available from VV settings +void vvQPacsConnection::refreshNetworks() +{ + ui.networkCombo->clear(); + ui.networkCombo->addItem(QString()); + ui.networkCombo->addItems(getDicomServers()); + 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() +{ + Patientmodel->removeRows(0, Patientmodel->rowCount(),QModelIndex()); + Studymodel->removeRows(0, Studymodel->rowCount(),QModelIndex()); + Seriesmodel->removeRows(0, Seriesmodel->rowCount(),QModelIndex()); + Imagesmodel->removeRows(0, Imagesmodel->rowCount(),QModelIndex()); +} + +void vvQPacsConnection::on_scanButton_clicked() +{ + cleanTree(); + manageStudiesFilter(true); + + // test first if echo works + bool didItWork = gdcm::CompositeNetworkFunctions::CEcho(m_adress.c_str(), atoi(m_port.c_str()), getDicomClientAETitle().c_str(), m_nickname.c_str() ); + if (didItWork) + { + m_level =gdcm::ePatient; + std::vector theDataSet; + f_query = mQFactory.getQueryPatient(ui.patientName->toPlainText().toStdString(), ui.patientID->toPlainText().toStdString()); + + bool cfindWork = gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), + gdcm::CompositeNetworkFunctions::ConstructQuery(f_query.theRoot, f_query.theLevel ,f_query.keys), + theDataSet, getDicomClientAETitle().c_str() , m_nickname.c_str()); + if( cfindWork) + { + convertDataSet(theDataSet,Patientmodel,mQFactory.getPatientKeys("","")); + } // end cfindwork + } // end didItwork +} + + +/// show Options DialogBox to set a new Dicom Server +void vvQPacsConnection::on_optionsButton_clicked() +{ + vvPacsSettingsDialog *dg = new vvPacsSettingsDialog(this); + dg->show(); +} + +void vvQPacsConnection::convertDataSet(std::vector i_ds, QStandardItemModel *i_model, std::vector< std::pair > keys) +{ + + std::vector::iterator it_ds = i_ds.begin(); + for(; it_ds != i_ds.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++) + { + 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); + } + i_model->appendRow(items); + } +} + +// TreeViews creation +void vvQPacsConnection::createTreeView() +{ + // Patient Tree View + Patientmodel = new QStandardItemModel(0,2,this); + QStringList Patientlist; + Patientlist.push_back(tr("PATIENT NAME")); + Patientlist.push_back(tr("PATIENT ID")); + Patientmodel->setHorizontalHeaderLabels(Patientlist); + ui.patientTreeView->setModel(Patientmodel); + ui.patientTreeView->setEnabled(true); + connect(ui.patientTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectStudies(QModelIndex))); + + // Study Tree View + Studymodel = new QStandardItemModel(0,3,this); + QStringList Studylist; + Studylist.push_back(tr("DESCRIPTION")); + Studylist.push_back(tr("DATE")); + Studylist.push_back(tr("HOUR")); + Studylist.push_back(tr("STUDY ID")); + Studymodel->setHorizontalHeaderLabels(Studylist); + ui.studyTreeView->setModel(Studymodel); + connect(ui.studyTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectSeries(QModelIndex))); + + + // Series Tree View + Seriesmodel = new QStandardItemModel(0,2,this); + QStringList Serieslist; + Serieslist.push_back(tr("MODALITY")); + Serieslist.push_back(tr("DESCRIPTION")); + Serieslist.push_back(tr("no. accept.")); + Seriesmodel->setHorizontalHeaderLabels(Serieslist); + ui.seriesTreeView->setModel(Seriesmodel); + connect(ui.seriesTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectImages(QModelIndex))); + connect(ui.imagesTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectImage(QModelIndex))); + // Images Tree View + 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); +} + +// clean the different model Trees +void vvQPacsConnection::cleanTree() +{ + Patientmodel->removeRows(0,Patientmodel->rowCount()); + Studymodel->removeRows(0,Patientmodel->rowCount()); + Seriesmodel->removeRows(0,Patientmodel->rowCount()); + Imagesmodel->removeRows(0,Patientmodel->rowCount()); + +} + +void vvQPacsConnection::selectStudies(const QModelIndex &index) +{ + + m_patient= Patientmodel->data(index.sibling(index.row(),1)).toString().toStdString(); + Studymodel->removeRows(0, Studymodel->rowCount(),QModelIndex()); + Seriesmodel->removeRows(0, Seriesmodel->rowCount(),QModelIndex()); + Imagesmodel->removeRows(0, Imagesmodel->rowCount(),QModelIndex()); + manageSeriesFilter(true); + convertDataSet( findQuery( mQFactory.getQueryforStudy(m_patient, false)) , Studymodel, mQFactory.getQueryKeysforStudy("",true)); +} + + +void vvQPacsConnection::clearMove() +{ + +} + +void vvQPacsConnection::selectSeries(const QModelIndex &index) +{ + m_study= Studymodel->data(index.sibling(index.row(),3)).toString().toStdString(); + Seriesmodel->removeRows(0, Seriesmodel->rowCount()); + Imagesmodel->removeRows(0, Imagesmodel->rowCount()); + convertDataSet( findQuery( mQFactory.getQueryforSeries(m_patient,m_study, false)), Seriesmodel, mQFactory.getSeriesKeys("","",true)); + +} + +void vvQPacsConnection::selectImages(const QModelIndex &index) +{ + m_series = Seriesmodel->data(index.sibling(index.row(),2)).toString().toStdString(); + Imagesmodel->removeRows(0, Imagesmodel->rowCount(),QModelIndex()); + convertDataSet( findQuery( mQFactory.getQueryforImages(m_patient,m_study, m_series, false) ), Imagesmodel, mQFactory.getQueryKeysforImages("","","",true)); + +} + +void vvQPacsConnection::selectImage(const QModelIndex &index) +{ + std::string _image = Imagesmodel->data(index.sibling(index.row(),1)).toString().toStdString(); + mQFactory.setQueryforImage(m_patient,m_study, m_series, _image); + +} + + +std::vector vvQPacsConnection::findQuery(vvQuery i_query) +{ + std::vector theDataSet; + gdcm::CompositeNetworkFunctions::CFind(m_adress.c_str(), atoi(m_port.c_str()), + gdcm::CompositeNetworkFunctions::ConstructQuery(i_query.theRoot, i_query.theLevel,i_query.keys), theDataSet, + getDicomClientAETitle().c_str(), m_nickname.c_str()); + return theDataSet; +} + +void vvQPacsConnection::manageStudiesFilter(bool i_enable) +{ + ui.text_PHYS->setEnabled(i_enable); + ui.text_SDESC->setEnabled(i_enable); + ui.dateTab->setEnabled(i_enable); + +} + +void vvQPacsConnection::manageSeriesFilter(bool i_enable) +{ + ui.modalityTab->setEnabled(i_enable); +} + + +std::vector< std::pair > vvQPacsConnection::getStudyKeys(const std::string i_val) +{ + std::vector< std::pair > keys; + // 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, "")); + // Study Instance UID + gdcm::Tag tagsid(0x0020,0x000d); + keys.push_back(std::make_pair(tagsid, i_val)); + + return keys; +} + +std::vector< std::pair > vvQPacsConnection::getKeys() +{ + std::vector< std::pair > keys; + // Patient Name + gdcm::Tag tag(0x0010,0x0010); + keys.push_back(std::make_pair(tag, "")); + + //// Patient ID + gdcm::Tag tagpid(0x0010,0x0020); + keys.push_back(std::make_pair(tagpid, "")); + + // Modality + gdcm::Tag tagmod(0x0008,0x0061); + keys.push_back(std::make_pair(tagmod, "")); + + // date of birth + gdcm::Tag tagdb(0x0010,0x0030); + keys.push_back(std::make_pair(tagdb, "")); + + // Study Date + gdcm::Tag tagsd(0x0020,0x000D); + keys.push_back(std::make_pair(tagsd, "")); + + //// Study Time + //gdcm::Tag tagst(8,30); + //keys.push_back(std::make_pair(tagst, "")); + + //// Study Description + //gdcm::Tag tagsdc(8,1030); + //keys.push_back(std::make_pair(tagsdc, "")); + - //// Accession n° ++ //// Accession + //gdcm::Tag tagacc(8,50); + //keys.push_back(std::make_pair(tagacc, "")); + + return keys; +} + +void vvQPacsConnection::on_check_ModAll_clicked(bool state) +{ + ui.check_MR->setEnabled(!state); + ui.check_CR->setEnabled(!state); + ui.check_OT->setEnabled(!state); + ui.check_RF->setEnabled(!state); + ui.check_SC->setEnabled(!state); + ui.check_CT->setEnabled(!state); + ui.check_US->setEnabled(!state); + ui.check_NM->setEnabled(!state); + ui.check_DR->setEnabled(!state); + ui.check_US->setEnabled(!state); + ui.check_NM->setEnabled(!state); + ui.check_DR->setEnabled(!state); + ui.check_SR->setEnabled(!state); + ui.check_XA->setEnabled(!state); + ui.check_MG->setEnabled(!state); + if(state) + { + ui.check_MR->setChecked(state); + ui.check_CR->setChecked(state); + ui.check_OT->setChecked(state); + ui.check_RF->setChecked(state); + ui.check_SC->setChecked(state); + ui.check_CT->setChecked(state); + ui.check_US->setChecked(state); + ui.check_NM->setChecked(state); + ui.check_DR->setChecked(state); + ui.check_US->setChecked(state); + ui.check_NM->setChecked(state); + ui.check_DR->setChecked(state); + ui.check_SR->setChecked(state); + ui.check_XA->setChecked(state); + ui.check_MG->setChecked(state); + } + +} + +void vvQPacsConnection::chooseServer(int index) +{ + std::map < std::string, std:: string> values = getDicomServer(ui.networkCombo->currentText()); + m_port = values["PORT"]; + m_aetitle = values["AETITLE"]; + m_adress= values["ADRESS"]; + m_nickname = values["nickname"]; + ui.AdressEdit->setText(QString(m_adress.c_str())); + ui.AETitleEdit->setText(QString(m_aetitle.c_str())); + ui.NameEdit->setText(QString(m_nickname.c_str())); + ui.PortEdit->setText(QString(m_port.c_str())); +} + +void vvQPacsConnection::on_importButton_clicked() + { + setCursor(QCursor(Qt::WaitCursor)); + QString path = QString::fromStdString(getCMoveDirectory()); + QDir dirpath (path); + if (dirpath.exists()) + { + QFileInfoList list = dirpath.entryInfoList( QDir::Files); + QFileInfoList::iterator it_file = dirpath.entryInfoList( QDir::Files).begin(); + for(int i = 0; i < list.length() ; i++) + { + QFile::remove(list.at(i).filePath()); + } + } + else + { + dirpath.mkdir(path); + } + bool didItWork = gdcm::CompositeNetworkFunctions::CMove(m_adress.c_str(),atoi(m_port.c_str()), - gdcm::CompositeNetworkFunctions::ConstructQuery(mQFactory.getMoveQuery().theRoot, mQFactory.getMoveQuery().theLevel ,mQFactory.getMoveQuery().keys,true), ++ gdcm::CompositeNetworkFunctions::ConstructQuery(mQFactory.getMoveQuery().theRoot, mQFactory.getMoveQuery().theLevel ,mQFactory.getMoveQuery().keys, gdcm::eMove), + getDicomClientPort(), getDicomClientAETitle().c_str(), m_aetitle.c_str(), path.toStdString().c_str() ); + gdcm::Directory theDir; + theDir.Load(path.toStdString().c_str()); + //m_files = theDir.GetFilenames(); + + typedef itk::GDCMSeriesFileNames NamesGeneratorType; + NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New(); + nameGenerator->SetUseSeriesDetails(true); + - //ds gérer recursive moi-meme pour progress ... ++ //ds gerer recursive moi-meme pour progress ... + nameGenerator->SetInputDirectory(path.toStdString()); + + // insert in table + typedef std::vector SeriesIdContainer; + const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs(); + std::map* > mListOfSeriesFilenames; + + + m_fileseries.clear(); + + for (unsigned int i=0; iGetFileNames(seriesUID[i])); + } + + accept(); + setCursor(QCursor(Qt::ArrowCursor)); + } + + + +std::vector vvQPacsConnection::getFileNames(int i_series) +{ + std::vector filenames; + gdcm::Directory::FilenamesType::iterator it = m_fileseries[i_series].begin(); + for (;it != m_fileseries[i_series].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(getPatientKeys("","")); + break; + } + + return keys; +} diff --cc vv/vvUtils.h index 4a7ffce,5854b5b..9a80462 --- a/vv/vvUtils.h +++ b/vv/vvUtils.h @@@ -33,26 -33,4 +33,26 @@@ QString getVVSettingsPath() ///by default nativeFormat 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(); + +// Set parameters for VV (AETITLE, port-scu) to allow c-move. +void setDicomClient(); + +// get VV-AETITLE for c-move parameters. +std::string getDicomClientAETitle(); + +// get VV-PORT-SCU for c-move parameters. +int getDicomClientPort(); + +// get the directory where the dicom files will be stored during c-move action. - std::string getCMoveDirectory() ++std::string getCMoveDirectory(); + +std::map getDicomServer(QString nickname); #endif