]> Creatis software - clitk.git/commitdiff
Merge branch 'master' into wipe
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Tue, 17 Jan 2017 14:15:25 +0000 (15:15 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Tue, 17 Jan 2017 14:15:25 +0000 (15:15 +0100)
Conflicts:
vv/qt_ui/vvMainWindow.ui
vv/vvIcons.qrc

1  2 
vv/CMakeLists.txt
vv/qt_ui/vvMainWindow.ui
vv/vvIcons.qrc
vv/vvMainWindow.cxx
vv/vvMainWindow.h

diff --combined vv/CMakeLists.txt
index d15070bca32a96a5436de56fad57c12bfc8f6c37,14b441ee0d752656c17647ef4522cf63593b8db4..7d74f721cadc1d815ebcef9803b13145d13ab98c
@@@ -7,8 -7,7 +7,7 @@@ if(COMMAND cmake_policy
    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
@@@ -70,7 -69,6 +69,7 @@@ set(vv_COMMON_WITH_U
    vvToolSimpleInputSelectorWidget
    vvToolInputSelectorWidget
    vvRegisterForm
 +  vvWipeImage
  )
  
  # All others sources
@@@ -92,8 -90,8 +91,8 @@@ set(vv_SRC
    vvSlicerManager.cxx
    vvSlicerManagerCommand.cxx
    vvUtils.cxx
- #  vvMaximumIntensityProjection.cxx
-   vvMesh.cxx
+ #  vvMaximumIntensityProjection.cxx 
+  vvMesh.cxx
    vvMeshActor.cxx
    vvMeshReader.cxx
    vvMidPosition.cxx
  
  #=========================================================
  # Qt related commands
  if(vv_QT_VERSION VERSION_GREATER "4")
    find_package(Qt5Widgets REQUIRED)
    find_package(Qt5Network REQUIRED)
@@@ -177,6 -174,28 +175,28 @@@ if(vv_QT_VERSION VERSION_GREATER "4"
  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)
+   SET(vv_SRCS ${vv_SRCS}
+     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
@@@ -290,12 -309,10 +310,10 @@@ endif(
  
  #=========================================================
  # Use CxImage to create animated gifs
- if(CLITK_EXPERIMENTAL)
-   set(vvCxImage clitkCxImage)
-   set(vv_SRCS ${vv_SRCS} vvAnimatedGIFWriter.cxx)
-   include_directories(${CLITK_SOURCE_DIR}/utilities/CxImage)
-   add_subdirectory(${CLITK_SOURCE_DIR}/utilities/CxImage ${PROJECT_BINARY_DIR}/utilities/CxImage)
- endif(CLITK_EXPERIMENTAL)
+ set(vvCxImage clitkCxImage)
+ set(vv_SRCS ${vv_SRCS} vvAnimatedGIFWriter.cxx)
+ include_directories(${CLITK_SOURCE_DIR}/utilities/CxImage)
+ add_subdirectory(${CLITK_SOURCE_DIR}/utilities/CxImage ${PROJECT_BINARY_DIR}/utilities/CxImage)
  #=========================================================
  
  #-----------------------------------------------------------------------------
diff --combined vv/qt_ui/vvMainWindow.ui
index 91774e8c075a810b1bcd22b3245aef50229b1ecc,ec4051a3b58bfc22032c84286e8acacc6de3f2a5..10c8400cf89eb43aa870c2edde34df15f169d90e
      <addaction name="actionAdd_overlay_image_to_current_image"/>
      <addaction name="actionAdd_fusion_image"/>
      <addaction name="actionAdd_USSequence_toCT"/>
 +    <addaction name="actionAdd_wipe_image"/>
     </widget>
     <widget class="QMenu" name="menuScreenshots">
      <property name="title">
      <addaction name="separator"/>
      <addaction name="actionOpen_Dicom"/>
      <addaction name="actionOpen_VTK_contour"/>
+     <addaction name="actionConnect_Pacs"/>
      <addaction name="separator"/>
      <addaction name="actionSave_As"/>
      <addaction name="separator"/>
      <bool>true</bool>
     </property>
    </action>
 +  <action name="actionAdd_wipe_image">
 +   <property name="icon">
 +    <iconset resource="../vvIcons.qrc">
 +     <normaloff>:/common/icons/wipe.png</normaloff>:/common/icons/wipe.png</iconset>
 +   </property>
 +   <property name="text">
 +    <string>Add wipe Image</string>
 +   </property>
 +   <property name="iconVisibleInMenu">
 +    <bool>true</bool>
 +   </property>
 +  </action>
+   <action name="actionConnect_Pacs">
+    <property name="text">
+     <string>Connect Pacs</string>
+    </property>
+   </action>
++   </property>
++  </action>
   </widget>
   <customwidgets>
    <customwidget>
diff --combined vv/vvIcons.qrc
index 8c8d0a5fbdd40441a3f447fcb16eb3dd8b792e82,a5e31ccdfbfc6853ade30da993a50c4498b868ee..dba9116341b25d23cb79b4c97c5cdc317df8e1f9
@@@ -41,6 -41,8 +41,9 @@@
      <file>icons/standardbutton-apply-16.png</file>
      <file>icons/standardbutton-cancel-16.png</file>
      <file>icons/identity.png</file>
 +    <file>icons/wipe.png</file>
+       <file>icons/basket_download.png</file>
+       <file>icons/edit.png</file>
+       <file>icons/bullet_info.png</file>
    </qresource>
  </RCC>
diff --combined vv/vvMainWindow.cxx
index 2403de46585a734557f7be9983d1276acb26ea79,e70269cbda681d32292cb37f291d633f65546ed9..335177a5327969bf87d6f0de12d20056330a25d2
@@@ -48,6 -48,9 +48,9 @@@ It is distributed under dual licenc
  #include "vvMeshReader.h"
  #include "vvSaveState.h"
  #include "vvReadState.h"
+ #if CLITK_USE_PACS_CONNECTION
+ #include "vvQPacsConnection.h"
+ #endif
  #include "clitkConfiguration.h"
  #include "clitkMatrix.h"
  #ifdef Q_OS_OSX
@@@ -79,9 -82,7 +82,7 @@@
  #include <vtkPNGWriter.h>
  #include <vtkJPEGWriter.h>
  #include <vtkGenericMovieWriter.h>
- #ifdef CLITK_EXPERIMENTAL
- #  include <vvAnimatedGIFWriter.h>
- #endif
+ #include <vvAnimatedGIFWriter.h>
  #ifdef VTK_USE_VIDEO_FOR_WINDOWS
  #  include <vtkAVIWriter.h>
  #endif
  #define COLUMN_RELOAD_IMAGE 6
  #define COLUMN_IMAGE_NAME 7
  
 -#ifdef CLITK_PRIVATE_FEATURES
 -#define EXTENSIONS "Images ( *.bmp *.dcm *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz *.usf *.svl)"
 -#else
 -#define EXTENSIONS "Images ( *.bmp *.dcm *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz)"
 -#endif
 +#include <extensions.h>
  
  
  /*Data Tree values
@@@ -127,6 -132,8 +128,8 @@@ vvMainWindow::vvMainWindow():vvMainWind
  { 
    setupUi(this); // this sets up the GUI
  
+   setDicomClient();
    //Qt::WindowFlags flags = windowFlags();
    //setWindowFlags(flags | Qt::WindowStaysOnTopHint);
  
    contextActions.push_back(actionAdd_USSequence_toCT);
  #endif
  
 +  contextMenu.addAction(actionAdd_wipe_image);
 +  contextActions.push_back(actionAdd_wipe_image);
 +
  
    contextMenu.addSeparator();
    QAction* actionResetMatrix = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/identity.png")),
    documentation = new vvDocumentation();
    help_dialog = new vvHelpDialog();
    dicomSeriesSelector = new vvDicomSeriesSelector();
+ #if CLITK_USE_PACS_CONNECTION
+      PacsConnection = new vvQPacsConnection();
+ #endif
  
    inverseButton->setEnabled(0);
    actionAdd_overlay_image_to_current_image->setEnabled(0);
    actionAdd_VF_to_current_Image->setEnabled(0);
    actionAdd_fusion_image->setEnabled(0);
    actionAdd_USSequence_toCT->setEnabled(0);
 +  actionAdd_wipe_image->setEnabled(0);
  
    //init the sliders
    verticalSliders.push_back(NOVerticalSlider);
    connect(actionWarp_image_with_vector_field,SIGNAL(triggered()),this,SLOT(WarpImage()));
    connect(actionLoad_images,SIGNAL(triggered()),this,SLOT(OpenImages()));
    connect(actionOpen_Dicom,SIGNAL(triggered()),this,SLOT(OpenDicom()));
+ #if CLITK_USE_PACS_CONNECTION
+   connect(actionConnect_Pacs,SIGNAL(triggered()),this,SLOT(ConnectPacs()));
+ #endif
    //  connect(actionOpen_Dicom_Struct,SIGNAL(triggered()),this,SLOT(OpenDCStructContour()));
    connect(actionOpen_VTK_contour,SIGNAL(triggered()),this,SLOT(OpenVTKContour()));
    connect(actionOpen_Multiple_Images_As_One,SIGNAL(triggered()),this,SLOT(MergeImages()));
    connect(actionRead_saved_state,SIGNAL(triggered()),this,SLOT(ReadSavedState()));
    connect(actionExit,SIGNAL(triggered()),this,SLOT(close()));
    connect(actionAdd_VF_to_current_Image,SIGNAL(triggered()),this,SLOT(OpenField()));
 +  connect(actionAdd_wipe_image,SIGNAL(triggered()),this,SLOT(SelectWipeImage()));
    connect(actionAdd_fusion_image,SIGNAL(triggered()),this,SLOT(SelectFusionImage()));
    connect(actionAdd_overlay_image_to_current_image,SIGNAL(triggered()), this,SLOT(SelectOverlayImage()));
    connect(actionAdd_USSequence_toCT,SIGNAL(triggered()), this,SLOT(SelectFusionSequence()));
      menuExperimental->menuAction()->setVisible(false);
  #endif
  
+ #if !CLITK_USE_PACS_CONNECTION
+     actionConnect_Pacs->setVisible(false);
+ #endif
    QTimer * timerMemory = new QTimer(this);
    //timerMemory->setInterval(5);
    connect(timerMemory, SIGNAL(timeout()), this, SLOT(UpdateMemoryUsage()));
@@@ -759,7 -771,24 +772,24 @@@ void vvMainWindow::OpenDicom(
      files = *(dicomSeriesSelector->GetFilenames());
      LoadImages(files, vvImageReader::DICOM);
    }
- }
+ }  
+ #if CLITK_USE_PACS_CONNECTION
+ void vvMainWindow::ConnectPacs()
+ {
+   std::vector<std::string> files;
+   //std::cout << "dicomSeriesSelector " << std::endl;
+ if (PacsConnection->exec() == QDialog::Accepted) {
+       for (int i = 0; i < PacsConnection->getSeriesCount(); i++)
+       {
+               files = PacsConnection->getFileNames(i);
+               LoadImages(files, vvImageReader::DICOM);
+       }
+       PacsConnection->clearMove();
+   }
+   }
+ #endif
  //------------------------------------------------------------------------------
  
  //------------------------------------------------------------------------------
@@@ -1053,7 -1082,6 +1083,7 @@@ void vvMainWindow::ImageInfoChanged(
    actionSave_As->setEnabled(1);
    actionAdd_VF_to_current_Image->setEnabled(1);
    actionAdd_fusion_image->setEnabled(1);
 +  actionAdd_wipe_image->setEnabled(1);
    actionAdd_overlay_image_to_current_image->setEnabled(1);
    actionAdd_USSequence_toCT->setEnabled(1);
    actionNorth_East_Window->setEnabled(1);
@@@ -2140,42 -2168,6 +2170,42 @@@ void vvMainWindow::AddROI(int index, QS
  }
  //------------------------------------------------------------------------------
  
 +//------------------------------------------------------------------------------
 +void vvMainWindow::SelectWipeImage()
 +{ 
 +  int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
 +  
 +
 +  if (!(CheckAddedImage(index, "wipe")))
 +    return;
 +
 +  vvWipeImage::Pointer wipeImage = vvWipeImage::New();
 +  wipeImage->Initialize(mInputPathName, mSlicerManagers);
 +  wipeImage->selectWipeImage(index, GetTree());
 +  QTreeWidgetItem *item = DataTree->itemAt(index, COLUMN_CLOSE_IMAGE);
 +  //connect(item,SIGNAL(clickedInto(QTreeWidgetItem*, int)), this,SLOT(CloseImage(QTreeWidgetItem*, int)));
 +  UpdateTree();
 +  ImageInfoChanged();
 +  for(int i=0; i<4; i++)
 +        DisplaySliders(index, i);
 +  WindowLevelChanged();
 +
 +  /*QString Extensions = EXTENSIONS;
 +  Extensions += ";;All Files (*)";
 +  QStringList files = QFileDialog::getOpenFileNames(this,tr("Load Wipe image"),mInputPathName,Extensions);
 +  if (files.isEmpty())
 +    return;
 +
 +  std::vector<std::string> vecFileNames;
 +  for (int i = 0; i < files.size(); i++) {
 +    vecFileNames.push_back(files[i].toStdString());
 +  }*/
 +
 +  //AddWipeImage(index,vecFileNames,vvImageReader::IMAGE);
 +}
 +//------------------------------------------------------------------------------
 +
 +
  //------------------------------------------------------------------------------
  void vvMainWindow::SelectFusionImage()
  { 
@@@ -3348,9 -3340,7 +3378,7 @@@ void vvMainWindow::SaveScreenshot(QVTKW
  #ifdef VTK_USE_MPEG2_ENCODER
    Extensions += ";;Video( *.mpg)";
  #endif
- #ifdef CLITK_EXPERIMENTAL
    Extensions += ";;Video( *.gif)";
- #endif
  
    int smIndex=GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
    QString fileName = QFileDialog::getSaveFileName(this,
    if (!fileName.isEmpty()) {
      vtkSmartPointer<vtkWindowToImageFilter> w2i = vtkSmartPointer<vtkWindowToImageFilter>::New();
      w2i->SetInput(widget->GetRenderWindow());
+     w2i->SetMagnification(1);
+     w2i->SetInputBufferTypeToRGBA(); //also record the alpha (transparency) channel
      w2i->Update();
      vtkImageData *image = w2i->GetOutput();
  
  
      // Video
      vtkGenericMovieWriter *vidwriter = NULL;
- #if CLITK_EXPERIMENTAL == 1
      if (ext==".gif") {
        vvAnimatedGIFWriter *gif = vvAnimatedGIFWriter::New();
        vidwriter = gif;
        msgBox.addButton(tr("No"), QMessageBox::RejectRole);
        gif->SetDither(msgBox.exec() == QMessageBox::AcceptRole);
      }
- #endif
  #ifdef VTK_USE_VIDEO_FOR_WINDOWS
      if (ext==".avi") {
        vtkAVIWriter *mpg = vtkAVIWriter::New();
diff --combined vv/vvMainWindow.h
index d587a7f91ab9a203bd22fe78fed76c1c27fbc34b,8908b24004ca7fca8bae8c6f0e3d76fa5f9968a1..81bc7c42705fa310d5ec72425c9e6c6e5ea5be3e
@@@ -1,7 -1,7 +1,7 @@@
  /*=========================================================================
    Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
  
-   Authors belong to: 
+   Authors belong to:
    - University of LYON              http://www.universite-lyon.fr/
    - Léon Bérard cancer center       http://www.centreleonberard.fr
    - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
@@@ -26,7 -26,6 +26,7 @@@
  #include "vvToolManager.h"
  #include "vvImageReader.h"
  #include "vvMesh.h"
 +#include "vvWipeImage.h"
  #include "clitkMemoryUsage.h"
  
  #include "vtkSmartPointer.h"
@@@ -40,6 -39,9 +40,9 @@@ class vtkImageData
  class vtkRenderer;
  class vtkMatrix4x4;
  class vvDicomSeriesSelector;
+ #if CLITK_USE_PACS_CONNECTION
+ class vvQPacsConnection;
+ #endif
  class vvSlicer;
  class QTreeWidget;
  
@@@ -92,6 -94,9 +95,9 @@@ public slots
    void SliceImages();
    void MergeImagesWithTime();
    void OpenDicom();
+ #if CLITK_USE_PACS_CONNECTION
+   void ConnectPacs();
+ #endif
    ///Open a vtkPolyData surface mesh and display it over the current image
    void OpenVTKContour();
    void SaveAs();
    void ReloadImage();
    void OpenField();
    void SelectOverlayImage();
 +  void SelectWipeImage();
    void SelectFusionImage();
    //select the file(s) from the disk containing the image sequence to fuse
    void SelectFusionSequence();
    void UpdateMemoryUsage();
    void show();
    
 +  static vvMainWindow* Instance(){return mSingleton;}
 +  
  protected:
    
    void createRecentlyOpenedFilesMenu();
@@@ -197,9 -199,11 +203,13 @@@ private
    vvHelpDialog *help_dialog;
    vvDocumentation *documentation;
    vvDicomSeriesSelector *dicomSeriesSelector;
 +  
 +  vvWipeImage::Pointer mWipeImage;
  
+ #if CLITK_USE_PACS_CONNECTION
+   vvQPacsConnection *PacsConnection;
+ #endif
    bool viewMode;
    bool playMode;
  
    // vvMainWindowToolInfo * mCurrentToolInfo;
    // std::vector<vvToolCreatorBase*> mListOfRunningTool;
  
 -  static vvMainWindow * mSingleton;
 +  static vvMainWindow* mSingleton;
  
    int mCurrentTime;