]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk into VTK6_Qt5
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Thu, 18 Feb 2016 06:38:49 +0000 (07:38 +0100)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Thu, 18 Feb 2016 06:38:49 +0000 (07:38 +0100)
87 files changed:
CMakeLists.txt
cmake/build_opt.cmake
common/clitkCommonGenericFilter.h
common/clitkDicomRTStruct2ImageFilter.cxx
common/clitkDicomRT_ROI.cxx
common/clitkDicomRT_ROI.h
common/clitkDicomRT_StructureSet.cxx
common/vvFromITK.h
common/vvImage.cxx
common/vvImage.h
common/vvImage.txx
common/vvImageReader.txx
itk/clitkMeshToBinaryImageFilter.txx
itk/itkVTKImageToImageFilter.txx
tools/CMakeLists.txt
tools/clitkDicom2Image.cxx
tools/clitkProfileImage.cxx [new file with mode: 0644]
tools/clitkProfileImage.ggo [new file with mode: 0644]
tools/clitkProfileImageGenericFilter.cxx [new file with mode: 0644]
tools/clitkProfileImageGenericFilter.h [new file with mode: 0644]
vv/CMakeLists.txt
vv/icons/profile.png [new file with mode: 0644]
vv/qt_ui/vvMainWindow.ui
vv/qt_ui/vvToolProfile.ui [new file with mode: 0644]
vv/qt_ui/vvToolROIManager.ui
vv/qt_ui/vvToolTest.ui [new file with mode: 0644]
vv/qt_ui/vvToolWidgetBase.ui
vv/vtkVOXImageWriter.cxx
vv/vtkVOXImageWriter.h
vv/vvAnimatedGIFWriter.cxx
vv/vvBinaryImageOverlayActor.cxx
vv/vvDeformableRegistration.cxx
vv/vvGlyph2D.cxx
vv/vvGlyph2D.h
vv/vvGlyphSource.cxx
vv/vvGlyphSource.h
vv/vvIcons.qrc
vv/vvImageContour.cxx
vv/vvIntensityValueSlider.h
vv/vvInteractorStyleNavigator.cxx
vv/vvInteractorStyleNavigator.h
vv/vvLabelImageLoaderWidget.h
vv/vvLandmarks.cxx
vv/vvLandmarks.h
vv/vvLandmarksGlyph.cxx
vv/vvLandmarksGlyph.h
vv/vvLandmarksPanel.cxx
vv/vvMainWindow.cxx
vv/vvMesh.cxx
vv/vvMeshActor.cxx
vv/vvMeshReader.cxx
vv/vvOSXHelper.h [new file with mode: 0644]
vv/vvOSXHelper.mm [new file with mode: 0644]
vv/vvQDicomSeriesSelector.cxx
vv/vvROIActor.cxx
vv/vvRegisterForm.cxx
vv/vvSegmentationDialog.cxx
vv/vvSegmentationDialog.h
vv/vvSlicer.cxx
vv/vvSlicer.h
vv/vvSlicerManager.cxx
vv/vvSlicerManager.h
vv/vvSlicerManagerCommand.cxx
vv/vvSurfaceViewerDialog.cxx
vv/vvSurfaceViewerDialog.h
vv/vvToolBinarize.cxx
vv/vvToolBinarize.h
vv/vvToolCropImage.cxx
vv/vvToolCropImage.h
vv/vvToolImageArithm.h
vv/vvToolInputSelectorWidget.h
vv/vvToolMIP.h
vv/vvToolMedianFilter.h
vv/vvToolProfile.cxx [new file with mode: 0644]
vv/vvToolProfile.h [new file with mode: 0644]
vv/vvToolROIManager.cxx
vv/vvToolROIManager.h
vv/vvToolResample.h
vv/vvToolRigidReg.cxx
vv/vvToolRigidReg.h
vv/vvToolSegmentation.cxx
vv/vvToolSegmentation.h
vv/vvToolSimpleInputSelectorWidget.h
vv/vvToolTest.cxx [new file with mode: 0644]
vv/vvToolTest.h [new file with mode: 0644]
vv/vvToolWidgetBase.cxx
vv/vvToolWidgetBase.h

index ee3b2a79fd307fd537fef992be4147c063fcaba7..f0ed562bcf53352e3006fdac359c121ed98ce537 100644 (file)
@@ -5,10 +5,17 @@ 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)
+# 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)
index 4a2ca009a14689b04d37c7512d3c7e9b9ba13bbb..502a05656364deaaa86b02eef2642a134b1c42d8 100644 (file)
@@ -19,12 +19,20 @@ endif(BUILD_DOXYGEN)
 
 # Compilation options
 option(CLITK_EXPERIMENTAL "Enable experimental software and features" OFF)
+mark_as_advanced(CLITK_EXPERIMENTAL)
 option(CLITK_BUILD_TOOLS "Build command-line tools" OFF)
 option(CLITK_BUILD_SEGMENTATION "Build command-line segmentation tools" OFF)
 option(CLITK_BUILD_REGISTRATION "Build command-line registration tools" OFF)
 
 option(CLITK_BUILD_VV "Build vv the 4D visualizer (requires VTK and QT)" ON)
+
 if(CLITK_BUILD_VV)
+ if(VTK_VERSION VERSION_LESS 6.0.0)
+    set(vv_QT_VERSION "4" CACHE INTERNAL "Expected Qt version")
+ else()
+    set(vv_QT_VERSION "5" CACHE INTERNAL "Expected Qt version")
+ endif()
+
   add_subdirectory(${CLITK_SOURCE_DIR}/vv ${PROJECT_BINARY_DIR}/vv)
 endif(CLITK_BUILD_VV)
 
index fe04c5dafb821b312681c6f1ddff5cb1bf184392..13491f7f3722ab41d905b7b5ae8e419466ab85fb 100644 (file)
@@ -61,7 +61,7 @@ namespace clitk {
 
     ImageTypesManager(FilterType * f) { mFilter = f;  }
     virtual void DoIt(int dim, int ncomp, std::string pixelname) {
-      // std::cout << "ImageTypesManager DoIt " << dim << " " << pixelname << std::endl;
+      //std::cout << "ImageTypesManager DoIt " << dim << " " << pixelname << std::endl;
       if (mMapOfImageTypeToFunction[dim][ncomp][pixelname])
         mMapOfImageTypeToFunction[dim][ncomp][pixelname]->Execute();
     }
index ad90bef4d56220dfff44e3f7dda190c75a0f9e87..fcc9e2be26da9c02cfdcb1a94f10e5ff67874745 100644 (file)
@@ -25,6 +25,7 @@
 #include "clitkImageCommon.h"
 
 // vtk
+#include <vtkVersion.h>
 #include <vtkPolyDataToImageStencil.h>
 #include <vtkSmartPointer.h>
 #include <vtkImageStencil.h>
@@ -199,20 +200,30 @@ void clitk::DicomRTStruct2ImageFilter::Update()
 
   // Create new output image
   mBinaryImage = vtkSmartPointer<vtkImageData>::New();
+#if VTK_MAJOR_VERSION <= 5
   mBinaryImage->SetScalarTypeToUnsignedChar();
+#endif
   mBinaryImage->SetOrigin(&origin[0]);
   mBinaryImage->SetSpacing(&mSpacing[0]);
   mBinaryImage->SetExtent(0, extend[0],
                           0, extend[1],
                           0, extend[2]);
+#if VTK_MAJOR_VERSION <= 5
   mBinaryImage->AllocateScalars();
+#else
+  mBinaryImage->AllocateScalars(VTK_UNSIGNED_CHAR, 1);
+#endif
 
   memset(mBinaryImage->GetScalarPointer(), 0,
          mBinaryImage->GetDimensions()[0]*mBinaryImage->GetDimensions()[1]*mBinaryImage->GetDimensions()[2]*sizeof(unsigned char));
 
   // Extrude
   vtkSmartPointer<vtkLinearExtrusionFilter> extrude=vtkSmartPointer<vtkLinearExtrusionFilter>::New();
+#if VTK_MAJOR_VERSION <= 5
   extrude->SetInput(mesh);
+#else
+  extrude->SetInputData(mesh);
+#endif
   ///We extrude in the -slice_spacing direction to respect the FOCAL convention (NEEDED !)
   extrude->SetVector(0, 0, -mSpacing[2]);
 
@@ -222,12 +233,24 @@ void clitk::DicomRTStruct2ImageFilter::Update()
   //http://www.nabble.com/Bug-in-vtkPolyDataToImageStencil--td23368312.html#a23370933
   sts->SetTolerance(0);
   sts->SetInformationInput(mBinaryImage);
+#if VTK_MAJOR_VERSION <= 5
   sts->SetInput(extrude->GetOutput());
+#else
+  sts->SetInputConnection(extrude->GetOutputPort(0));
+#endif
   //sts->SetInput(mesh);
 
   vtkSmartPointer<vtkImageStencil> stencil=vtkSmartPointer<vtkImageStencil>::New();
+#if VTK_MAJOR_VERSION <= 5
   stencil->SetStencil(sts->GetOutput());
+#else
+  stencil->SetStencilConnection(sts->GetOutputPort(0));
+#endif
+#if VTK_MAJOR_VERSION <= 5
   stencil->SetInput(mBinaryImage);
+#else
+  stencil->SetInputData(mBinaryImage);
+#endif
   stencil->ReverseStencilOn();
   stencil->Update();
 
index 1fd9fe1f1c6b806bd0f08be65c15d32d47a42f7f..b6af9c321d5d2a2921cc3e65b352d872b16cde48 100644 (file)
@@ -23,6 +23,7 @@
 #include <vtkImageClip.h>
 #include <vtkMarchingSquares.h>
 #include <vtkPolyDataWriter.h>
+#include <vtkVersion.h>
 
 #if GDCM_MAJOR_VERSION == 2
 #include "gdcmAttribute.h"
@@ -72,6 +73,14 @@ int clitk::DicomRT_ROI::GetROINumber() const
 //--------------------------------------------------------------------
 
 
+//--------------------------------------------------------------------
+void clitk::DicomRT_ROI::SetROINumber(int number)
+{
+  mNumber = number;
+}
+//--------------------------------------------------------------------
+
+
 //--------------------------------------------------------------------
 const std::string & clitk::DicomRT_ROI::GetName() const
 {
@@ -142,7 +151,7 @@ double clitk::DicomRT_ROI::GetForegroundValueLabelImage() const
 #if GDCM_MAJOR_VERSION == 2
 bool clitk::DicomRT_ROI::Read(gdcm::Item * itemInfo, gdcm::Item * itemContour)
 {
-  FATAL("Error : compile vv with itk4 + external gdcm");
+  //FATAL("Error : compile vv with itk4 + external gdcm");
   // Keep dicom item
   mItemInfo = itemInfo;
   mItemContour = itemContour;
@@ -276,7 +285,11 @@ void clitk::DicomRT_ROI::ComputeMeshFromContour()
 {
   vtkSmartPointer<vtkAppendPolyData> append = vtkSmartPointer<vtkAppendPolyData>::New();
   for(unsigned int i=0; i<mListOfContours.size(); i++) {
-    append->AddInput(mListOfContours[i]->GetMesh());
+#if VTK_MAJOR_VERSION <= 5
+       append->AddInput(mListOfContours[i]->GetMesh());
+#else
+       append->AddInputData(mListOfContours[i]->GetMesh());
+#endif
   }
   append->Update();
  
@@ -394,7 +407,12 @@ void clitk::DicomRT_ROI::ComputeContoursFromImage()
   
   // Get initial extend for the clipping
   vtkSmartPointer<vtkImageClip> clipper = vtkSmartPointer<vtkImageClip>::New();
+#if VTK_MAJOR_VERSION <= 5
   clipper->SetInput(image);
+#else
+  clipper->SetInputData(image);
+#endif
+  
   int* extent = image->GetExtent();
   DDV(extent, 6);
   //  std::vector<int> extend;
@@ -414,7 +432,11 @@ void clitk::DicomRT_ROI::ComputeContoursFromImage()
 
 
     vtkSmartPointer<vtkMarchingSquares> squares = vtkSmartPointer<vtkMarchingSquares>::New();
+#if VTK_MAJOR_VERSION <= 5
     squares->SetInput(image);
+#else
+    squares->SetInputData(image);
+#endif
     squares->SetImageRange(extent[0], extent[1], extent[2], extent[3], i, i);
     squares->SetValue(1, 1.0);
     squares->Update();
@@ -446,7 +468,11 @@ void clitk::DicomRT_ROI::ComputeContoursFromImage()
  
   vtkSmartPointer<vtkAppendPolyData> append = vtkSmartPointer<vtkAppendPolyData>::New();
   for(unsigned int i=0; i<n; i++) {
+#if VTK_MAJOR_VERSION <= 5
     append->AddInput(contours[i]);
+#else
+    append->AddInputData(contours[i]);
+#endif
   }
   append->Update();
  
@@ -455,7 +481,11 @@ void clitk::DicomRT_ROI::ComputeContoursFromImage()
   
   // Write vtk
   vtkPolyDataWriter * w = vtkPolyDataWriter::New();
+#if VTK_MAJOR_VERSION <= 5
   w->SetInput(mMesh);
+#else
+  w->SetInputData(mMesh);
+#endif
   w->SetFileName("toto.vtk");
   w->Write();
 
index 31d9db4d44849c2586fdbd30ab1be190cdd2fe53..80cbacc03c2ed00c13a3605cd30df9adba5244ca 100644 (file)
@@ -47,6 +47,7 @@ public:
         std::string filename);
 
   int GetROINumber() const;
+  void SetROINumber(int);
   const std::string & GetName() const;
   const std::string & GetFilename() const;
   const std::vector<double> & GetDisplayColor() const;
index 4945693f8694beaf84dd6ac39ef047dfaf9b12db..9fa96b39f2a55c0e25f9b0e97bfd64dca2718a8a 100644 (file)
@@ -311,66 +311,51 @@ void clitk::DicomRT_StructureSet::Write(const std::string & filename)
 //--------------------------------------------------------------------
 void clitk::DicomRT_StructureSet::Read(const std::string & filename)
 {
-#if CLITK_USE_SYSTEM_GDCM == 1
-  vtkSmartPointer<vtkGDCMPolyDataReader> reader = vtkGDCMPolyDataReader::New();
-  reader->SetFileName(filename.c_str());
-  reader->Update();
-  
-  // Get global information
-  vtkRTStructSetProperties * p = reader->GetRTStructSetProperties();  
-  mStudyID   = p->GetStudyInstanceUID();
-  mStudyDate = p->GetStructureSetDate();
-  mLabel     = p->GetStructureSetLabel();
-  mName      = p->GetStructureSetName();
-  mTime      = p->GetStructureSetTime();
-
-  int n = p->GetNumberOfStructureSetROIs();
-  for(unsigned int i=0; i<n; i++) {
-    // Get the roi number
-    int roinumber = p->GetStructureSetROINumber(i);
-    // Create the roi
-    DicomRT_ROI::Pointer roi = DicomRT_ROI::New();
-    roi->Read(reader, i);
-    // Insert in the map
-    mROIs[roinumber] = roi;
-  }
-  return;
-#endif // END version with system gdcm (vtkGDCMPolyDataReader)
-
 
-  // Open DICOM
-#if GDCM_MAJOR_VERSION == 2
-  FATAL("Error : compile vv with itk4 + external gdcm");
-
-  // Read gdcm file
-  mReader = new gdcm::Reader;
-  mReader->SetFileName(filename.c_str());
-  mReader->Read();
-  mFile = &(mReader->GetFile());
-  const gdcm::DataSet & ds = mFile->GetDataSet();
+//Try to avoid to use extern GDCM library
+    
+  //check the RS file is available before conversion
+  gdcm::Reader RTreader;
+  RTreader.SetFileName( filename.c_str() );
+  if( !RTreader.Read() ) 
+  {
+    std::cout << "Problem reading file: " << filename << std::endl;
+    return;
+  }
+  
+  const gdcm::DataSet& ds = RTreader.GetFile().GetDataSet();
   
-  // Check file type
-  //Verify if the file is a RT-Structure-Set dicom file
   gdcm::MediaStorage ms;
-  ms.SetFromFile(*mFile);
-  if( ms != gdcm::MediaStorage::RTStructureSetStorage )
-    {
-    std::cerr << "Error. the file " << filename
-              << " is not a Dicom Struct ? (must have a SOP Class UID [0008|0016] = 1.2.840.10008.5.1.4.1.1.481.3 ==> [RT Structure Set Storage])"
-              << std::endl;
-    exit(0);
-    }
+  ms.SetFromFile( RTreader.GetFile() );
+    
+  // (3006,0020) SQ (Sequence with explicit length #=4)      # 370, 1 StructureSetROISequence  
+  gdcm::Tag tssroisq(0x3006,0x0020);
+  if( !ds.FindDataElement( tssroisq ) )
+  {
+    std::cout << "Problem locating 0x3006,0x0020 - Is this a valid RT Struct file?" << std::endl;
+    return;
+  }
+  gdcm::Tag troicsq(0x3006,0x0039);
+  if( !ds.FindDataElement( troicsq ) )
+  {
+    std::cout << "Problem locating 0x3006,0x0039 - Is this a valid RT Struct file?" << std::endl;
+    return;
+  }
 
-  gdcm::Attribute<0x8,0x60> modality;
-  modality.SetFromDataSet( ds );
-  if( modality.GetValue() != "RTSTRUCT" )
-    {
-    std::cerr << "Error. the file " << filename
-              << " is not a Dicom Struct ? (must have 0x0008,0x0060 = RTSTRUCT [RT Structure Set Storage])"
-              << std::endl;
-    exit(0);
-    }
+  const gdcm::DataElement &roicsq = ds.GetDataElement( troicsq );
 
+  gdcm::SmartPointer<gdcm::SequenceOfItems> sqi = roicsq.GetValueAsSQ();
+  if( !sqi || !sqi->GetNumberOfItems() )
+  {
+    return;
+  }
+  const gdcm::DataElement &ssroisq = ds.GetDataElement( tssroisq );
+  gdcm::SmartPointer<gdcm::SequenceOfItems> ssqi = ssroisq.GetValueAsSQ();
+  if( !ssqi || !ssqi->GetNumberOfItems() )
+  {
+    return;
+  }
+  
   // Read global info
   gdcm::Attribute<0x20,0x10> studyid;
   studyid.SetFromDataSet( ds );
@@ -395,22 +380,13 @@ void clitk::DicomRT_StructureSet::Read(const std::string & filename)
   // Temporary store the list of items
   std::map<int, gdcm::Item*> mMapOfROIInfo;
   std::map<int, gdcm::Item*> mMapOfROIContours;
-std::map<int, clitk::DicomRT_ROI::Pointer> mROIs;
-  std::map<int, std::string> mMapOfROIName;
-#if GDCM_MAJOR_VERSION == 2
-  gdcm::Reader * mReader;
-  gdcm::SmartPointer<gdcm::SequenceOfItems> mROIInfoSequenceOfItems;
-  gdcm::SmartPointer<gdcm::SequenceOfItems> mROIContoursSequenceOfItems;  
-#endif
-  gdcm::File * mFile;
-
+  
 
   //----------------------------------
   // Read all ROI Names and number
   // 0x3006,0x0020 = [ Structure Set ROI Sequence ]
-  gdcm::Tag tssroisq(0x3006,0x0020);
-  const gdcm::DataElement &ssroisq = ds.GetDataElement( tssroisq );
+  //gdcm::Tag tssroisq(0x3006,0x0020);
+  //const gdcm::DataElement &ssroisq = ds.GetDataElement( tssroisq );
   mROIInfoSequenceOfItems = ssroisq.GetValueAsSQ();
   gdcm::SmartPointer<gdcm::SequenceOfItems> & roi_seq = mROIInfoSequenceOfItems;
   assert(roi_seq); // TODO error message
@@ -441,8 +417,8 @@ std::map<int, clitk::DicomRT_ROI::Pointer> mROIs;
   //----------------------------------
   // Read all ROI item
   // 0x3006,0x0039 = [ ROI Contour Sequence ]
-  gdcm::Tag troicsq(0x3006,0x0039);
-  const gdcm::DataElement &roicsq = ds.GetDataElement( troicsq );
+  //gdcm::Tag troicsq(0x3006,0x0039);
+  //const gdcm::DataElement &roicsq = ds.GetDataElement( troicsq );
   gdcm::SmartPointer<gdcm::SequenceOfItems> roi_contour_seq = roicsq.GetValueAsSQ();
   mROIContoursSequenceOfItems = roi_contour_seq;
   assert(roi_contour_seq); // TODO error message
@@ -462,82 +438,12 @@ std::map<int, clitk::DicomRT_ROI::Pointer> mROIs;
   for(std::map<int, gdcm::Item*>::iterator i = mMapOfROIInfo.begin(); i != mMapOfROIInfo.end(); i++) {
     int nb = i->first;//ReadROINumber(i);//mROIIndex[i];
     // Create the roi
-    DicomRT_ROI::Pointer roi = DicomRT_ROI::New();
-    roi->Read(mMapOfROIInfo[nb], mMapOfROIContours[nb]);
-    //    mListOfROI.push_back(roi);
-    //    mMapOfROIIndex[nb] = i;
-    mROIs[nb] = roi;
-  }
-
-  //----------------------------------------------------------------------------------------
-  //----------------------------------------------------------------------------------------
-  //----------------------------------------------------------------------------------------
-#else
-  mFile = new gdcm::File;
-  mFile->SetFileName(filename.c_str());
-  mFile->SetMaxSizeLoadEntry(16384); // Needed ...
-  mFile->SetLoadMode(gdcm::LD_NOSHADOW); // don't load shadow tags (in order to save memory)
-  mFile->Load();
-  
-  // Check file type
-  //Verify if the file is a RT-Structure-Set dicom file
-  if (!gdcm::Util::DicomStringEqual(mFile->GetEntryValue(0x0008,0x0016),"1.2.840.10008.5.1.4.1.1.481.3")) {  //SOP clas UID
-    std::cerr << "Error. the file " << filename
-              << " is not a Dicom Struct ? (must have a SOP Class UID [0008|0016] = 1.2.840.10008.5.1.4.1.1.481.3 ==> [RT Structure Set Storage])"
-              << std::endl;
-    exit(0);
-  }
-  if (!gdcm::Util::DicomStringEqual(mFile->GetEntryValue(0x0008,0x0060),"RTSTRUCT")) {  //SOP clas UID
-    std::cerr << "Error. the file " << filename
-              << " is not a Dicom Struct ? (must have 0x0008,0x0060 = RTSTRUCT [RT Structure Set Storage])"
-              << std::endl;
-    exit(0);
-  }
-
-  // Read global info
-  mStudyID   = mFile->GetValEntry(0x0020,0x0010)->GetValue();
-  mStudyTime = mFile->GetValEntry(0x008,0x0020)->GetValue();
-  mStudyDate = mFile->GetValEntry(0x008,0x0030)->GetValue();
-  mLabel     = mFile->GetValEntry(0x3006,0x002)->GetValue();
-  if (!mFile->GetValEntry(0x3006,0x004)) {
-    mName = "Anonymous";
-  }
-  else {
-    mName = mFile->GetValEntry(0x3006,0x004)->GetValue();
-  }
-  mTime      = mFile->GetValEntry(0x3006,0x009)->GetValue();
-
-  //----------------------------------
-  // Read all ROI Names and number
-  // 0x3006,0x0020 = [ Structure Set ROI Sequence ]
-  gdcm::SeqEntry * roi_seq=mFile->GetSeqEntry(0x3006,0x0020);
-  assert(roi_seq); // TODO error message
-  for (gdcm::SQItem* r=roi_seq->GetFirstSQItem(); r!=0; r=roi_seq->GetNextSQItem()) {
-    std::string name = r->GetEntryValue(0x3006,0x0026);      // 0x3006,0x0026 = [ROI Name]
-    int nb = atoi(r->GetEntryValue(0x3006,0x0022).c_str());  // 0x3006,0x0022 = [ROI Number]
-    // Check if such a number already exist
-    if (mMapOfROIName.find(nb) != mMapOfROIName.end()) {
-      std::cerr << "WARNING. A Roi already exist with the number "
-                << nb << ". I replace." << std::endl;
-    }
-    // Add in map
-    mMapOfROIName[nb] = name;
-  }
-
-  //----------------------------------
-  // Read all ROI
-  // 0x3006,0x0039 = [ ROI Contour Sequence ]
-  gdcm::SeqEntry * roi_contour_seq=mFile->GetSeqEntry(0x3006,0x0039);
-  assert(roi_contour_seq); // TODO error message
-  int n=0;
-  for (gdcm::SQItem* r=roi_contour_seq->GetFirstSQItem(); r!=0; r=roi_contour_seq->GetNextSQItem()) {
-    DicomRT_ROI::Pointer roi = DicomRT_ROI::New();
-    roi->Read(mMapOfROIName, r);
-    mROIs[roi->GetROINumber()] = roi;
-    n++;
+    mROIs[nb] = DicomRT_ROI::New();
+    mROIs[nb]->Read(mMapOfROIInfo[nb], mMapOfROIContours[nb]);
   }
+    
+  return;
 
-#endif
 }
 //--------------------------------------------------------------------
 
index 30e1bfe6325c3205a6cb47dee118483ce8c120a0..69e41a6da39cb4b76f49938d01baf3cb0f7fa3fa 100644 (file)
@@ -58,6 +58,7 @@ static inline void ReadTimeSequence (vvImage::Pointer& vv_image, typename itk::I
     filter->SetInput(input);
     filter->ReleaseDataFlagOn();
     vv_image->AddItkImage<ItkImageType>(filter->GetOutput());
+    vv_image->ComputeScalarRangeBase<PixelType, Dim-1>(filter->GetOutput());
   }
   vv_image->SetTimeSpacing(input->GetSpacing()[Dim-1]);
   vv_image->SetTimeOrigin(input->GetOrigin()[Dim-1]);
@@ -73,9 +74,10 @@ struct vvImageFromITK_Impl
 
     if (time_sequence) //The time sequence case: create a series of VTK images
       ReadTimeSequence<Dim,PixelType>(vv_image, input, time_sequence);
-    else //Dim == 1,2,3 and not time_sequence
+    else //Dim == 1,2,3 and not time_sequence
       vv_image->AddItkImage<InputImageType>(input);
-
+      vv_image->ComputeScalarRangeBase<PixelType, Dim>(input);
+    }
     return vv_image;
   }
 };
index 9842d4a7f2f64945580c53a6779b82957f561e55..47a0e3464bd1d6e995b8a3103bab742566a5459b 100644 (file)
 // vtk
 #include <vtkImageData.h>
 #include <vtkTransform.h>
+#include <vtkDataObject.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkInformation.h>
+#include <vtkVersion.h>
 
 // std
 #include <cassert>
@@ -45,6 +49,8 @@ void vvImage::Init()
   mTimeSpacing = 1;
   mTimeOrigin = 0;
   mImageDimension = 0;
+  mrange[0] = std::numeric_limits<int>::max();;//min
+  mrange[1] = std::numeric_limits<int>::min();;//max
 }
 //--------------------------------------------------------------------
 
@@ -71,7 +77,11 @@ void vvImage::AddVtkImage(vtkImageData* input)
   // mItkToVtkConverters is therefore not being updated, but 
   // up to here it's not being used anyway...
   mImageDimension = 0;
+#if VTK_MAJOR_VERSION <= 5
   int* extent = input->GetWholeExtent();
+#else
+  int* extent = input->GetInformation()->Get(vtkDataObject::DATA_EXTENT());
+#endif
   if (extent[4] != extent[5])
     mImageDimension = 3;
   else if (extent[3] != extent[4])
@@ -107,15 +117,8 @@ int vvImage::GetNumberOfDimensions() const
 //--------------------------------------------------------------------
 void vvImage::GetScalarRange(double* range)
 {
-  assert(mVtkImages.size());
-  double * temp = mVtkImages[0]->GetScalarRange();
-  range[0]=temp[0];
-  range[1]=temp[1];
-  for (unsigned int i=1; i<mVtkImages.size(); i++) {
-    temp = mVtkImages[i]->GetScalarRange();
-    if (temp[0] < range[0]) range[0]=temp[0];
-    if (temp[1] > range[1]) range[1]=temp[1];
-  }
+  range[0]=mrange[0];
+  range[1]=mrange[1];
 }
 //--------------------------------------------------------------------
 
index 10ffc865fa2ed353605e4844abd6c456e5e678ee..d18ee9865303e217099ba4c40b5247c437ed66e7 100644 (file)
@@ -22,6 +22,8 @@
 #include <vector>
 #include <itkObjectFactory.h>
 #include <itkProcessObject.h>
+#include <itkMinimumMaximumImageCalculator.h>
+#include <itkCastImageFilter.h>
 
 #define VTK_EXCLUDE_STRSTREAM_HEADERS
 #include <vtkSmartPointer.h>
@@ -37,6 +39,10 @@ public :
   typedef itk::SmartPointer<Self> Pointer;
   typedef itk::ProcessObject::Pointer ConverterPointer;
   itkNewMacro(Self);
+  
+  struct DimensionDispatchBase {};
+  template< unsigned int VDimension >
+  struct DimensionDispatch:public DimensionDispatchBase {};
 
   void Init();
   void Reset();
@@ -47,6 +53,9 @@ public :
   int GetNumberOfDimensions() const;
   int GetNumberOfSpatialDimensions();
   void GetScalarRange(double* range);
+  template<class TPixelType, unsigned int VImageDimension> void ComputeScalarRangeBase(itk::Image<TPixelType,VImageDimension> *input);
+  template<class TPixelType, unsigned int VImageDimension> void ComputeScalarRange(DimensionDispatchBase, itk::Image<TPixelType,VImageDimension> *input);
+  template<class TPixelType, unsigned int VImageDimension> void ComputeScalarRange(DimensionDispatch< 1 >, itk::Image<TPixelType,VImageDimension> *input);
   unsigned long GetActualMemorySize();
   std::vector<double> GetSpacing();
   std::vector<double> GetOrigin() const;
@@ -77,6 +86,7 @@ private:
   double mTimeOrigin;
   double mTimeSpacing;
   unsigned int mImageDimension;
+  double mrange[2];
 };
 //------------------------------------------------------------------------------
 
index a6d37c8cbbd8f0447f69c990235fa0963afedb53..8574bfd530eeae686fe062a3e54e5019bcdfa34b 100644 (file)
@@ -16,6 +16,7 @@
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ===========================================================================*/
 #include <itkImageToVTKImageFilter.h>
+#include <itkPixelTraits.h>
 
 //--------------------------------------------------------------------
 template<class TItkImageType>
@@ -24,7 +25,7 @@ void vvImage::AddItkImage(TItkImageType *input)
   // Update input before conversion to enable exceptions thrown by the ITK pipeline.
   // Otherwise, vtkImageImport catches the exception for us.
   input->Update();
-
+  
   // Convert from ITK object to VTK object
   mImageDimension = TItkImageType::ImageDimension;
   typedef itk::ImageToVTKImageFilter <TItkImageType> ConverterType;
@@ -40,11 +41,21 @@ void vvImage::AddItkImage(TItkImageType *input)
   matrix->Identity();
   for(unsigned int i=0; i<input->GetImageDimension(); i++) {
     for(unsigned int j=0; j<input->GetImageDimension(); j++) {
+#if VTK_MAJOR_VERSION <= 6
       (*matrix)[i][j] = input->GetDirection()[i][j];
       // Direction is used around the image origin in ITK
       (*matrix)[i][3] -= (*matrix)[i][j] * input->GetOrigin()[j];
+#else
+      (*matrix).SetElement(i, j, input->GetDirection()[i][j]);
+      // Direction is used around the image origin in ITK
+      (*matrix).SetElement(i, 3, (*matrix).GetElement(i,3) - (*matrix).GetElement(i,j) * input->GetOrigin()[j]);
+#endif
     }
+#if VTK_MAJOR_VERSION <= 6
     (*matrix)[i][3] += input->GetOrigin()[i];
+#else
+    (*matrix).SetElement(i, 3, (*matrix).GetElement(i,3) + input->GetOrigin()[i]);
+#endif
   }
 
   // GetDirection provides the forward transform, vtkImageReslice wants the inverse
@@ -56,4 +67,45 @@ void vvImage::AddItkImage(TItkImageType *input)
   mDictionary.push_back(&(input->GetMetaDataDictionary()));
 }
 //--------------------------------------------------------------------
+/** Dispatch the computation of scalar range between vector and scalar image */
+template<class TPixelType, unsigned int VImageDimension>
+void vvImage::ComputeScalarRangeBase(itk::Image<TPixelType,VImageDimension> *input)
+{ 
+ itkStaticConstMacro(Dimension1, unsigned int, itk::PixelTraits< TPixelType >::Dimension);
+ ComputeScalarRange(DimensionDispatch< Dimension1 >(), input);
+}
+
+//--------------------------------------------------------------------
+/** Compute the scalar range for a vector pixel type */
+/** TO DO*/
+template<class TPixelType, unsigned int VImageDimension>
+void vvImage::ComputeScalarRange(DimensionDispatchBase, itk::Image<TPixelType,VImageDimension> *input)
+{
+     cout << "try" << endl;
+}
+
+//--------------------------------------------------------------------
+/** Compute the scalar range for a scalar pixel type */
+template<class TPixelType, unsigned int VImageDimension>
+void vvImage::ComputeScalarRange(DimensionDispatch< 1 >, itk::Image<TPixelType,VImageDimension> *input)
+{  
+  typedef typename itk::Image<TPixelType,VImageDimension> TItkImageType;
+  typedef itk::MinimumMaximumImageCalculator <TItkImageType> ImageCalculatorFilterType;
+  
+  typename ImageCalculatorFilterType::Pointer imageCalculatorFilter = ImageCalculatorFilterType::New ();
+  TPixelType tempMin, tempMax;
+  double tempRange[2];
+  imageCalculatorFilter->SetImage(input);
+  imageCalculatorFilter->Compute();
+  tempMin= imageCalculatorFilter->GetMinimum();
+  tempMax= imageCalculatorFilter->GetMaximum();
+
+  tempRange[0] = (double) tempMin;
+  tempRange[1] = (double) tempMax;
+
+  if (tempRange[0] < mrange[0]) mrange[0]=tempRange[0];
+  if (tempRange[1] > mrange[1]) mrange[1]=tempRange[1];
+}
+//--------------------------------------------------------------------
 
index 02b2193367dd2d7b3107e286dfccc3d32fc946ee..a797bf465bb9f0c9103aac948bbdab4586e5ba65 100644 (file)
@@ -86,6 +86,7 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
       reader->SetFileName(*i);
       try {
         mImage->AddItkImage<InputImageType>(reader->GetOutput());
+        mImage->ComputeScalarRangeBase<InputPixelType, VImageDimension-1>(reader->GetOutput());
       } catch ( itk::ExceptionObject & err ) {
         std::cerr << "Error while reading " << mInputFilenames[0].c_str()
                   << " " << err << std::endl;
@@ -125,6 +126,7 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
 #endif
     try {
       mImage->AddItkImage<SlicedImageType>(filter->GetOutput());
+      mImage->ComputeScalarRangeBase<InputPixelType, VImageDimension-1>(filter->GetOutput());
     } catch ( itk::ExceptionObject & err ) {
       std::cerr << "Error while slicing " << mInputFilenames[0].c_str()
                 << "(slice #" << mSlice << ") " << err << std::endl;
index cd9a3bafbbc2a421b780a7f837df371429345b98..3c3ccdb23d28337b838f71ebe9b4f71df765d46d 100644 (file)
@@ -20,6 +20,7 @@
 #include <vtkLinearExtrusionFilter.h>
 #include <vtkImageStencil.h>
 #include <vtkMetaImageWriter.h>
+#include <vtkVersion.h>
 
 #include "itkVTKImageImport.h"
 #include "vtkImageExport.h"
@@ -68,6 +69,7 @@ GenerateData()
 {
   // GO
   vtkSmartPointer<vtkImageData> binary_image=vtkSmartPointer<vtkImageData>::New();
+#if VTK_MAJOR_VERSION <= 5
   binary_image->SetScalarTypeToUnsignedChar();
 
   // Set spacing
@@ -91,6 +93,29 @@ GenerateData()
   
   // Allocate data
   binary_image->AllocateScalars();
+#else
+  // Set spacing
+  PointType samp_origin = m_LikeImage->GetOrigin();
+  SpacingType spacing=m_LikeImage->GetSpacing();
+  double * spacing2 = new double[3];
+  spacing2[0] = spacing[0];
+  spacing2[1] = spacing[1];
+  spacing2[2] = spacing[2];
+  binary_image->SetSpacing(spacing2);
+
+  // Set origin
+  /// Put the origin on a voxel to avoid small skips
+  binary_image->SetOrigin(samp_origin[0], samp_origin[1], samp_origin[2]);
+
+  // Compute image bounds
+  binary_image->SetExtent(0,m_LikeImage->GetLargestPossibleRegion().GetSize()[0],
+                          0,m_LikeImage->GetLargestPossibleRegion().GetSize()[1],
+                          0,m_LikeImage->GetLargestPossibleRegion().GetSize()[2] 
+                          );
+  
+  // Allocate data
+  binary_image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);
+#endif
   memset(binary_image->GetScalarPointer(),0,
          binary_image->GetDimensions()[0]*binary_image->GetDimensions()[1]*binary_image->GetDimensions()[2]*sizeof(unsigned char));
 
@@ -105,10 +130,18 @@ GenerateData()
   if (m_Extrude)
   {
     vtkSmartPointer<vtkLinearExtrusionFilter> extrude=vtkSmartPointer<vtkLinearExtrusionFilter>::New();
+#if VTK_MAJOR_VERSION <= 5
     extrude->SetInput(m_Mesh);
+#else
+    extrude->SetInputData(m_Mesh);
+#endif
     // We extrude in the -slice_spacing direction to respect the FOCAL convention 
     extrude->SetVector(0, 0, -m_LikeImage->GetSpacing()[2]);
+#if VTK_MAJOR_VERSION <= 5
     sts->SetInput(extrude->GetOutput());
+#else
+    sts->SetInputConnection(extrude->GetOutputPort());
+#endif
     
     // When extrude ScaleFactor indicate the extrusion scaling (default = 1)
     /*
@@ -118,12 +151,21 @@ GenerateData()
     */ 
   }
   else
+#if VTK_MAJOR_VERSION <= 5
     sts->SetInput(m_Mesh);
+#else
+    sts->SetInputData(m_Mesh);
+#endif
 
   // Stencil
   vtkSmartPointer<vtkImageStencil> stencil=vtkSmartPointer<vtkImageStencil>::New();
+#if VTK_MAJOR_VERSION <= 5
   stencil->SetStencil(sts->GetOutput());
   stencil->SetInput(binary_image);
+#else
+  stencil->SetStencilData(sts->GetOutput());
+  stencil->SetInputData(binary_image);
+#endif
 
   // Convert VTK to ITK
   vtkImageExport * m_Exporter = vtkImageExport::New();
@@ -143,7 +185,11 @@ GenerateData()
   m_Importer->SetBufferPointerCallback( m_Exporter->GetBufferPointerCallback());
   m_Importer->SetCallbackUserData( m_Exporter->GetCallbackUserData());
 
+#if VTK_MAJOR_VERSION <= 5
   m_Exporter->SetInput( stencil->GetOutput() );
+#else
+  m_Exporter->SetInputData( stencil->GetOutput() );
+#endif
   m_Importer->Update();
 
   // writeImage<ImageType>(m_Importer->GetOutput(), "f.mhd");
index 27a6595385a3fc2ef2daf2b8d36b318c0edc07e9..5fddba28f6d49f17db81cd18ae91f8435a234e88 100644 (file)
@@ -77,7 +77,11 @@ void
 VTKImageToImageFilter<TOutputImage>
 ::SetInput( vtkImageData * inputImage )
 {
+#if VTK_MAJOR_VERSION <= 5
   m_Exporter->SetInput( inputImage );
+#else
+  m_Exporter->SetInputData( inputImage );
+#endif
 }
 
 
index 3bf89482b7c98064a3fc9a5ba1f975f2009f7806..fbab5f54cfd300f8eb61f1780f30565328020af9 100644 (file)
@@ -9,6 +9,9 @@ add_library(clitkImageConvertLib clitkImageConvertGenericFilter.cxx ${clitkImage
 WRAP_GGO(clitkBinarizeImage_GGO_C clitkBinarizeImage.ggo)
 add_library(clitkBinarizeImageLib clitkBinarizeImageGenericFilter.cxx ${clitkBinarizeImage_GGO_C})
 
+WRAP_GGO(clitkProfileImage_GGO_C clitkProfileImage.ggo)
+add_library(clitkProfileImageLib clitkProfileImageGenericFilter.cxx ${clitkProfileImage_GGO_C})
+
 WRAP_GGO(clitkImageArithm_GGO_C clitkImageArithm.ggo)
 add_library(clitkImageArithmImageLib clitkImageArithmGenericFilter.cxx ${clitkImageArithm_GGO_C})
 
@@ -58,6 +61,10 @@ if(CLITK_BUILD_TOOLS)
   add_executable(clitkBinarizeImage clitkBinarizeImage.cxx)
   target_link_libraries(clitkBinarizeImage clitkBinarizeImageLib clitkCommon)
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkBinarizeImage)
+  
+  add_executable(clitkProfileImage clitkProfileImage.cxx)
+  target_link_libraries(clitkProfileImage clitkProfileImageLib clitkCommon)
+  set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkProfileImage)
 
   WRAP_GGO(clitkVFResample_GGO_C clitkVFResample.ggo)
   add_executable(clitkVFResample clitkVFResample.cxx clitkVFResampleGenericFilter.cxx ${clitkVFResample_GGO_C})
index b25b001dea3a19c75edec04b1bcf790891c5cf6a..a6323da9de5ba6ad89c75ab8372049ef569b3200 100644 (file)
@@ -23,6 +23,7 @@
 #include "vvImageReader.h"
 #include "vvImageWriter.h"
 #include <gdcmFile.h>
+#include <vtkVersion.h>
 #include <vtkImageChangeInformation.h>
 #if GDCM_MAJOR_VERSION == 2
   #include <gdcmImageHelper.h>
@@ -191,7 +192,11 @@ int main(int argc, char * argv[])
       std::vector<int> size = image->GetSize();
       origin[0] = -spacing[0]*size[0]/2.0;
       origin[1] = -spacing[1]*size[1]/2.0;
+#if VTK_MAJOR_VERSION <= 5
       modifier->SetInput(vtk_image);
+#else
+      modifier->SetInputData(vtk_image);
+#endif
       modifier->SetOutputOrigin(origin[0], origin[1], locs[sliceIndex[0]]);
       modifier->Update();
       vvImage::Pointer focal_image = vvImage::New();
diff --git a/tools/clitkProfileImage.cxx b/tools/clitkProfileImage.cxx
new file mode 100644 (file)
index 0000000..c8332c9
--- /dev/null
@@ -0,0 +1,41 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  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
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+
+// clitk
+#include "clitkProfileImage_ggo.h"
+#include "clitkProfileImageGenericFilter.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+  // Init command line
+  GGO(clitkProfileImage, args_info);
+  CLITK_INIT;
+
+  // Filter
+  typedef clitk::ProfileImageGenericFilter FilterType;
+  FilterType::Pointer filter = FilterType::New();
+
+  filter->SetArgsInfo(args_info);
+
+  CLITK_TRY_CATCH_EXIT(filter->Update());
+
+  return EXIT_SUCCESS;
+} // This is the end, my friend
+//--------------------------------------------------------------------
diff --git a/tools/clitkProfileImage.ggo b/tools/clitkProfileImage.ggo
new file mode 100644 (file)
index 0000000..773790d
--- /dev/null
@@ -0,0 +1,16 @@
+#File clitkProfileImage.ggo
+package "clitkProfileImage"
+version "1.0"
+purpose "Save the profile between 2 points of the input image in the output text file"
+
+option "config"                -       "Config file"                           string  no
+option "verbose"       v       "Verbose"                                   flag        off
+option "imagetypes" -   "Display allowed image types"   flag   off
+
+option "input"      i   "Input image filename"          string  yes
+option "output"     o   "Output texte filename"         string  yes
+option "point1"     f   "First point (mm)"              double     yes multiple(-4)
+option "point2"     s   "Second point (mm)"             double     yes multiple(-4)
+
+
+
diff --git a/tools/clitkProfileImageGenericFilter.cxx b/tools/clitkProfileImageGenericFilter.cxx
new file mode 100644 (file)
index 0000000..02394d3
--- /dev/null
@@ -0,0 +1,189 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  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
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef clitkProfileImageGenericFilter_cxx
+#define clitkProfileImageGenericFilter_cxx
+
+/* =================================================
+ * @file   clitkProfileImageGenericFilter.cxx
+ * @author Thomas Baudier <thomas.baudier@creatis.insa-lyon.fr>
+ * @date   22 dec 2015
+ *
+ * @brief
+ *
+ ===================================================*/
+
+#include "clitkProfileImageGenericFilter.h"
+
+// itk include
+#include <itkLineIterator.h>
+#include <itkPoint.h>
+
+#include <clitkCommon.h>
+
+
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+ProfileImageGenericFilter::ProfileImageGenericFilter():
+  ImageToImageGenericFilter<Self>("ProfileImage")
+{
+  InitializeImageType<2>();
+  InitializeImageType<3>();
+  InitializeImageType<4>();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<unsigned int Dim>
+void ProfileImageGenericFilter::InitializeImageType()
+{
+  ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+vtkFloatArray* ProfileImageGenericFilter::GetArrayX()
+{
+  return(mArrayX);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+vtkFloatArray* ProfileImageGenericFilter::GetArrayY()
+{
+  return(mArrayY);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+vtkFloatArray* ProfileImageGenericFilter::GetCoord()
+{
+  return(mCoord);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+void ProfileImageGenericFilter::SetArgsInfo(const args_info_type & a)
+{
+  mArgsInfo=a;
+  if (mArgsInfo.verbose_given)
+    SetIOVerbose(mArgsInfo.verbose_flag);
+  if (mArgsInfo.imagetypes_given && mArgsInfo.imagetypes_flag)
+    this->PrintAvailableImageTypes();
+
+  if (mArgsInfo.input_given) {
+    SetInputFilename(mArgsInfo.input_arg);
+  }
+  if (mArgsInfo.output_given) {
+    SetOutputFilename(mArgsInfo.output_arg);
+  }
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+// Update with the number of dimensions and the pixeltype
+//--------------------------------------------------------------------
+template<class InputImageType>
+void
+ProfileImageGenericFilter::UpdateWithInputImageType()
+{
+
+  // Reading input
+  typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
+  typedef typename InputImageType::PixelType PixelType;
+  typedef typename InputImageType::IndexType IndexType;
+
+  mArrayX = vtkSmartPointer<vtkFloatArray>::New();
+  mArrayY = vtkSmartPointer<vtkFloatArray>::New();
+  mCoord = vtkSmartPointer<vtkFloatArray>::New();
+  mCoord->SetNumberOfComponents(InputImageType::ImageDimension);
+  
+  /*typename InputImageType::Pointer outputImage;
+  outputImage = InputImageType::New();
+  outputImage->SetRegions(input->GetLargestPossibleRegion());
+  outputImage->Allocate();
+  outputImage->FillBuffer(0); */
+  
+  //Iterator
+  IndexType pointBegin, pointEnd;
+  
+  for (int i = 0; i < mArgsInfo.point1_given; ++i) {
+    pointBegin[i] = mArgsInfo.point1_arg[i];
+    pointEnd[i] = mArgsInfo.point2_arg[i];
+  }
+  
+  itk::LineConstIterator<InputImageType> itProfile(input, pointBegin, pointEnd);
+  itProfile.GoToBegin();
+  int lineNumber(1);
+  double *tuple;
+  double distance;
+  tuple = new double[InputImageType::ImageDimension];
+  itk::Point<double, InputImageType::ImageDimension> transformedFirstPoint;
+  itk::Point<double, InputImageType::ImageDimension> transformedCurrentPoint;
+  
+  input->TransformIndexToPhysicalPoint(itProfile.GetIndex(), transformedFirstPoint);
+  
+  while (!itProfile.IsAtEnd())
+  {    
+    // Fill in the table the intensity value
+    mArrayY->InsertNextTuple1(itProfile.Get());
+        
+    for (int i=0; i<InputImageType::ImageDimension; ++i) {
+        tuple[i] = itProfile.GetIndex()[i];
+    }
+
+    input->TransformIndexToPhysicalPoint(itProfile.GetIndex(), transformedCurrentPoint);
+    distance = transformedFirstPoint.EuclideanDistanceTo(transformedCurrentPoint);
+
+    // Fill in the table the distance value
+    mArrayX->InsertNextTuple1(distance);
+    
+    // Fille in the table the voxel coordinate value
+    mCoord->InsertNextTuple(tuple);
+    ++lineNumber;
+    ++itProfile;
+  }
+  
+  /*
+  itk::LineIterator<InputImageType> otProfile(outputImage, pointBegin, pointEnd);
+  otProfile.GoToBegin();  
+  while (!otProfile.IsAtEnd())
+  {    
+    otProfile.Set(1.0);
+    ++otProfile;
+  }
+  
+  this->template SetNextOutput<InputImageType>(outputImage): */
+  
+  delete [] tuple;
+}
+//--------------------------------------------------------------------
+
+
+}//end clitk
+
+#endif  //#define clitkProfileImageGenericFilter_cxx
diff --git a/tools/clitkProfileImageGenericFilter.h b/tools/clitkProfileImageGenericFilter.h
new file mode 100644 (file)
index 0000000..573a41c
--- /dev/null
@@ -0,0 +1,79 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  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
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+
+#ifndef clitkProfileImageGenericFilter_h
+#define clitkProfileImageGenericFilter_h
+
+#include "clitkIO.h"
+#include "clitkImageToImageGenericFilter.h"
+#include "clitkProfileImage_ggo.h"
+
+#include <vtkIntArray.h>
+#include <vtkFloatArray.h>
+
+//--------------------------------------------------------------------
+namespace clitk 
+{
+  
+  class ITK_EXPORT ProfileImageGenericFilter: 
+    public ImageToImageGenericFilter<ProfileImageGenericFilter>
+  {
+    
+  public:
+    //--------------------------------------------------------------------
+    typedef ProfileImageGenericFilter         Self;
+    typedef itk::SmartPointer<Self>           Pointer;
+    typedef itk::SmartPointer<const Self>     ConstPointer;
+    typedef args_info_clitkProfileImage       args_info_type;
+   
+    //--------------------------------------------------------------------
+    // Method for creation through the object factory
+    // and Run-time type information (and related methods)
+    itkNewMacro(Self);  
+    itkTypeMacro(ProfileImageGenericFilter, LightObject);
+
+    //--------------------------------------------------------------------
+    void SetArgsInfo(const args_info_type & a);
+
+    //--------------------------------------------------------------------
+    // Main function called each time the filter is updated
+    template<class InputImageType>  
+    void UpdateWithInputImageType();
+    
+    vtkFloatArray* GetArrayX();
+    vtkFloatArray* GetArrayY();
+    vtkFloatArray* GetCoord();
+
+  protected:
+    ProfileImageGenericFilter();
+    template<unsigned int Dim> void InitializeImageType();
+    args_info_type mArgsInfo;
+    
+  
+    vtkSmartPointer<vtkFloatArray> mArrayX;
+    vtkSmartPointer<vtkFloatArray> mArrayY;
+    vtkSmartPointer<vtkFloatArray> mCoord;
+    
+    
+  }; // end class
+  //--------------------------------------------------------------------
+    
+} // end namespace clitk
+//--------------------------------------------------------------------
+
+#endif // #define clitkProfileImageGenericFilter_h
index df4081e5883ac1f69f813e40d278065651842b5d..c61497546f75320380adbb17de22be78d44e2c5e 100644 (file)
@@ -4,6 +4,7 @@ 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)
 #=========================================================
 
@@ -21,7 +22,9 @@ set(vv_TOOLS
   vvToolConvert ## with dummy vvToolConvert.ui
   vvToolROIManager
   vvToolSegmentation
+  vvToolProfile
   ## these ones are for tests (not working)
+  # vvToolTest
   # vvToolFoo
   # vvToolFooWithWidgetBase
   # vvToolPlastimatch
@@ -35,6 +38,7 @@ set(vv_TOOLS
 # Future issues : when tool depend on other tools ... how to manage that ?
 #  >> add the relevant $_LIBS variable to the tool that has dependencies?
 set(vvToolBinarize_LIBS clitkBinarizeImageLib)
+set(vvToolProfile_LIBS clitkProfileImageLib)
 set(vvToolResample_LIBS clitkResampleImageLib)
 set(vvToolConvert_LIBS clitkImageConvertLib)
 set(vvToolExtractPatient_LIBS clitkSegmentationGgoLib)
@@ -106,79 +110,159 @@ set(vv_SRCS
 
 #=========================================================
 # Qt related commands
-find_package(Qt4 REQUIRED)
-link_directories(${QT_LIBRARY_DIR})
+if(vv_QT_VERSION VERSION_GREATER "4")
+  find_package(Qt5Widgets REQUIRED)
+  find_package(Qt5Network REQUIRED)
+  find_package(Qt5Designer REQUIRED)
 
-
-QT4_WRAP_CPP(vv_SRCS
-  vvMainWindowBase.h
-  QTreePushButton.h
-  vvDocumentation.h
-  vvHelpDialog.h
-  vvQDicomSeriesSelector.h
-  vvSlicerManager.h
-  vvStructureSetActor.h
-  vvROIActor.h
-  vvToolCreatorBase.h
-  )
-
-QT4_WRAP_UI(vv_UI_CXX
-  qt_ui/vvHelpDialog.ui
-  qt_ui/vvDocumentation.ui
-  qt_ui/vvDicomSeriesSelector.ui
-  qt_ui/vvDummyWindow.ui #For testing
-  )
-
-QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
-
-# 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")
+  link_directories(${QT5Widgets_LIBRARIES})
+  link_directories(${QT5Network_LIBRARIES})
+  link_directories(${QT5Designer_LIBRARIES})
+  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
+    )
+  
+  qt5_wrap_ui(vv_UI_CXX
+    qt_ui/vvHelpDialog.ui
+    qt_ui/vvDocumentation.ui
+    qt_ui/vvDicomSeriesSelector.ui
+    qt_ui/vvDummyWindow.ui #For testing
+    )
+  
+  QT5_add_resources(vv_SRCS vvIcons.qrc)
+  
+  # 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)
+      QT5_WRAP_CPP(vv_SRCS ${tool}.h)
+      QT5_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
   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)
-
-include_directories(
-  ${QT_INCLUDES}
-  ${QT_INCLUDE_DIR}
-  ${QT_QTGUI_INCLUDE_DIR}
-  ${QT_QTCORE_INCLUDE_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_SOURCE_DIR}
-)
+  
+  # Add the common source files
+  foreach(tool ${vv_COMMON})
+      set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
+      QT5_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 ${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)
+  endif(WIN32)
+  if(NOT QT_STATIC)
+    add_definitions(-DQT_DLL)
+  endif(NOT QT_STATIC)
+  add_definitions(-DQT_THREAD_SUPPORT)
+  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()
+  find_package(Qt4 REQUIRED)
+  link_directories(${QT_LIBRARY_DIR})
+  
+  
+  QT4_WRAP_CPP(vv_SRCS
+    vvMainWindowBase.h
+    QTreePushButton.h
+    vvDocumentation.h
+    vvHelpDialog.h
+    vvQDicomSeriesSelector.h
+    vvSlicerManager.h
+    vvStructureSetActor.h
+    vvROIActor.h
+    vvToolCreatorBase.h
+    )
+  
+  QT4_WRAP_UI(vv_UI_CXX
+    qt_ui/vvHelpDialog.ui
+    qt_ui/vvDocumentation.ui
+    qt_ui/vvDicomSeriesSelector.ui
+    qt_ui/vvDummyWindow.ui #For testing
+    )
+  
+  QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
+  
+  # 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)
+      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)
+  
+  include_directories(
+    ${QT_INCLUDES}
+    ${QT_INCLUDE_DIR}
+    ${QT_QTGUI_INCLUDE_DIR}
+    ${QT_QTCORE_INCLUDE_DIR}
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${CMAKE_CURRENT_SOURCE_DIR}
+  )
+endif()
 #=========================================================
 
 #=========================================================
@@ -206,7 +290,11 @@ endforeach(tool)
 #=========================================================
 #Add Foundation Libraries (this should be after our libraries, since we depend
 #on them)
+if(vv_QT_VERSION VERSION_GREATER "4")
+set(foundationLibraries clitkCommon ${ITK_LIBRARIES} ${VTK_LIBRARIES})
+else()
 set(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
+endif()
 
 #=========================================================
 # Use CxImage to create animated gifs
@@ -236,9 +324,20 @@ if(APPLE)
 endif()
 #=========================================================
 #Create binary and libs for tests
+if(vv_QT_VERSION VERSION_GREATER "4")
+set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} Qt5::Widgets Qt5::Network Qt5::Designer ${APPLE_FRAMEWORKS})
+else()
 set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} ${QT_LIBRARIES} ${QT_QTNETWORK_LIBRARY} ${APPLE_FRAMEWORKS})
+endif()
 # QtNetwork is required by vvRegisterForm
 
+#-----------------------------------------------------------------------------
+# For retina displays, see
+# http://public.kitware.com/pipermail/vtkusers/2015-February/090117.html
+if(APPLE)
+  set(vv_SRCS ${vv_SRCS} vvOSXHelper.mm)
+endif()
+
 add_library(vvLib ${vv_SRCS} ${vv_UI_CXX})
 target_link_libraries(vvLib ${vvExternalLibs})
 
diff --git a/vv/icons/profile.png b/vv/icons/profile.png
new file mode 100644 (file)
index 0000000..656113a
Binary files /dev/null and b/vv/icons/profile.png differ
index 5cf4b33b473fdff99dead3057a7ea2bd0babc21d..ec68254bd471c4aaddef81bfaaf72a4907525e1f 100644 (file)
      <x>0</x>
      <y>0</y>
      <width>1008</width>
-     <height>20</height>
+     <height>27</height>
     </rect>
    </property>
    <property name="defaultUp">
    <property name="text">
     <string>Navigation Help</string>
    </property>
-   <property name="shortcut">
-    <string>F1</string>
-   </property>
    <property name="iconVisibleInMenu">
     <bool>true</bool>
    </property>
+   <property name="priority">
+    <enum>QAction::NormalPriority</enum>
+   </property>
   </action>
   <action name="actionOpen_Dicom_Struct">
    <property name="icon">
diff --git a/vv/qt_ui/vvToolProfile.ui b/vv/qt_ui/vvToolProfile.ui
new file mode 100644 (file)
index 0000000..bc3c9c8
--- /dev/null
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvToolProfile</class>
+ <widget class="QWidget" name="vvToolProfile">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>505</width>
+    <height>452</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Profile image</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_3">
+     <item>
+      <layout class="QGridLayout" name="gridLayout_2">
+       <property name="horizontalSpacing">
+        <number>6</number>
+       </property>
+       <item row="2" column="1">
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QPushButton" name="mSelectPoint2Button">
+           <property name="text">
+            <string>Select point 2</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="Point2">
+           <property name="text">
+            <string>Center of voxel2 (vox):</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="2" column="3">
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QLabel" name="mPosPoint2Label">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>200</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="3" column="3">
+        <layout class="QHBoxLayout" name="horizontalLayout_6">
+         <item>
+          <widget class="QToolButton" name="mCancelPointsButton">
+           <property name="text">
+            <string>Cancel</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mSaveProfileButton">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>Save Profile</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="1" column="1">
+        <layout class="QHBoxLayout" name="horizontalLayout_7">
+         <item>
+          <widget class="QPushButton" name="mSelectPoint1Button">
+           <property name="text">
+            <string>Select point 1</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="Point1">
+           <property name="text">
+            <string>Center of voxel1 (vox):</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="1" column="3">
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QLabel" name="mPosPoint1Label">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>200</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_2">
+     <item>
+      <widget class="Line" name="line_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QVTKWidget" name="ProfileWidget" native="true">
+       <property name="minimumSize">
+        <size>
+         <width>0</width>
+         <height>300</height>
+        </size>
+       </property>
+       <property name="mouseTracking">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QVTKWidget</class>
+   <extends>QWidget</extends>
+   <header>QVTKWidget.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
index f4848dba1b53f0ae5688b3455835f86b2af38c8a..8e0d3c23864336aa29dad45e1faea6145b0861fc 100644 (file)
               </sizepolicy>
              </property>
              <property name="text">
-              <string>        </string>
+              <string/>
              </property>
             </widget>
            </item>
              </property>
             </spacer>
            </item>
+           <item>
+            <widget class="QPushButton" name="mRemoveButton">
+             <property name="text">
+              <string>1</string>
+             </property>
+             <property name="icon">
+              <iconset resource="../vvIcons.qrc">
+               <normaloff>:/common/icons/standardbutton-cancel-16.png</normaloff>:/common/icons/standardbutton-cancel-16.png</iconset>
+             </property>
+            </widget>
+           </item>
            <item>
             <widget class="QLabel" name="mROInameLabel_3">
              <property name="sizePolicy">
           <bool>false</bool>
          </property>
          <property name="text">
-          <string/>
+          <string>All</string>
          </property>
          <property name="icon">
           <iconset resource="../vvIcons.qrc">
-           <normaloff>:/common/icons/exit.png</normaloff>:/common/icons/exit.png</iconset>
+           <normaloff>:/common/icons/standardbutton-cancel-16.png</normaloff>:/common/icons/standardbutton-cancel-16.png</iconset>
          </property>
         </widget>
        </item>
diff --git a/vv/qt_ui/vvToolTest.ui b/vv/qt_ui/vvToolTest.ui
new file mode 100644 (file)
index 0000000..01279b5
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvToolTest</class>
+ <widget class="QWidget" name="vvToolTest">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>433</width>
+    <height>222</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Test sphere</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="Line" name="line_3">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index 944fea4a290d3255b532f947624187311cac05f9..69a68967b6209f21416124f0f2b02ba4cd769af0 100644 (file)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>179</width>
+    <width>194</width>
     <height>62</height>
    </rect>
   </property>
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
-     <widget class="vvToolInputSelectorWidget" name="mToolInputSelectionWidget" native="true"/>
+     <widget class="vvToolInputSelectorWidget" name="mToolInputSelectionWidget" native="true">
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>200</height>
+       </size>
+      </property>
+     </widget>
      <widget class="QWidget" name="mToolWidget" native="true">
       <property name="sizePolicy">
        <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
index 4d7c92cc63b1f25fb3b7f4685c1e65dace9ecffb..7ffecb5edbe6e4b3671005864ce82b435c31788d 100644 (file)
 #include "vtkObjectFactory.h"
 #include "vtkStreamingDemandDrivenPipeline.h"
 #include "vtkDataSetAttributes.h"
-
-#include <vtkstd/string>
+#include <vtkVersion.h>
+#include <vtkAlgorithm.h>
 
 #include <sys/stat.h>
 
 //----------------------------------------------------------------------------
-vtkCxxRevisionMacro(vtkVOXImageWriter, "DummyRevision");
 vtkStandardNewMacro(vtkVOXImageWriter);
 
 //----------------------------------------------------------------------------
@@ -55,9 +54,11 @@ vtkVOXImageWriter::~vtkVOXImageWriter()
 void vtkVOXImageWriter::Write( )
 {
   this->SetErrorCode(vtkErrorCode::NoError);
-
+#if VTK_MAJOR_VERSION <= 5
   this->GetInput()->UpdateInformation();
-
+#else
+  this->UpdateInformation();
+#endif
   // Error checking
   if (this->GetInput() == NULL ) {
     vtkErrorMacro(<<"Write:Please specify an input!");
@@ -70,7 +71,11 @@ void vtkVOXImageWriter::Write( )
   }
 
   int nDims = 3;
+#if VTK_MAJOR_VERSION <= 5
   int * ext = this->GetInput()->GetWholeExtent();
+#else
+  int * ext = this->GetInformation()->Get(vtkDataObject::DATA_EXTENT());
+#endif
   if ( ext[4] == ext[5] ) {
     nDims = 2;
     if ( ext[2] == ext[3] ) {
@@ -134,12 +139,15 @@ void vtkVOXImageWriter::Write( )
   origin[1] += ext[2] * spacing[1];
   origin[2] += ext[4] * spacing[2];
 
+#if VTK_MAJOR_VERSION <= 5
   this->GetInput()->SetUpdateExtent(ext[0], ext[1],
                                     ext[2], ext[3],
                                     ext[4], ext[5]);
   this->GetInput()->UpdateData();
-
-
+#else
+  this->SetUpdateExtent(ext);
+  this->Update();
+#endif
   this->SetFileDimensionality(nDims);
 
   this->InvokeEvent(vtkCommand::StartEvent);
index d64fbf0292c46fde3da17ba411f8f15f44787bbf..a4ce3e334a0fd601e8bf05d2ad6960ea4d3500ba 100644 (file)
@@ -24,7 +24,7 @@
 class vtkVOXImageWriter : public vtkImageWriter
 {
 public:
-    vtkTypeRevisionMacro(vtkVOXImageWriter,vtkImageWriter);
+    vtkTypeMacro(vtkVOXImageWriter,vtkImageWriter);
     void PrintSelf(ostream& os, vtkIndent indent);
 
     // Description:
index 1efd50dcc1cc5f27be12899c980d41815be88587..0ab7cb806d5c7aa7100ea1e620b73169f3763c2a 100644 (file)
@@ -1,6 +1,9 @@
 #include "vvAnimatedGIFWriter.h"
 #include "clitkDD.h"
 
+#include <vtkVersion.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkInformation.h>
 #include <vtkImageData.h>
 #include <vtkImageQuantizeRGBToIndex.h>
 #include <vtkImageAppend.h>
@@ -39,14 +42,25 @@ void vvAnimatedGIFWriter::Start()
 void vvAnimatedGIFWriter::Write()
 {
   // get the data
+#if VTK_MAJOR_VERSION <= 5
   this->GetInput()->UpdateInformation();
   int *wExtent = this->GetInput()->GetWholeExtent();
   this->GetInput()->SetUpdateExtent(wExtent);
   this->GetInput()->Update();
+#else
+  this->UpdateInformation();
+  int *wExtent = this->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT());
+  this->SetUpdateExtent(wExtent);
+  this->Update();
+#endif
 
   RGBslices.push_back( vtkSmartPointer<vtkImageData>::New() );
   RGBslices.back()->ShallowCopy(this->GetInput());
+#if VTK_MAJOR_VERSION <= 5
   RGBvolume->AddInput(RGBslices.back());
+#else
+  RGBvolume->AddInputData(RGBslices.back());
+#endif
 }
 
 //---------------------------------------------------------------------------
@@ -57,12 +71,20 @@ void vvAnimatedGIFWriter::End()
   // Quantize to 8 bit colors
   vtkSmartPointer<vtkImageQuantizeRGBToIndex> quant = vtkSmartPointer<vtkImageQuantizeRGBToIndex>::New();
   quant->SetNumberOfColors(256);
+#if VTK_MAJOR_VERSION <= 5
   quant->SetInput(RGBvolume->GetOutput());
+#else
+  quant->SetInputConnection(RGBvolume->GetOutputPort());
+#endif
   quant->Update();
 
   // Convert to 8 bit image
   vtkSmartPointer<vtkImageCast> cast =  vtkSmartPointer<vtkImageCast>::New();
+#if VTK_MAJOR_VERSION <= 5
   cast->SetInput( quant->GetOutput() );
+#else
+  cast->SetInputConnection( quant->GetOutputPort() );
+#endif
   cast->SetOutputScalarTypeToUnsignedChar();
   cast->Update();
 
index b4a4a3df204dfcd5ce4980939010c8bfd1bd756f..40fba13bdb92ce2c592aa85cd4a61f89d79d864a 100644 (file)
@@ -18,6 +18,9 @@
 
 #include "vvBinaryImageOverlayActor.h"
 #include "vvImage.h"
+#include <vtkVersion.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkInformation.h>
 #include <vtkImageActor.h>
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
 #include <vtkProperty.h>
 #include <vtkImageMapToRGBA.h>
 #include <vtkLookupTable.h>
+#include <vtkImageMapper3D.h>
 
 //------------------------------------------------------------------------------
 vvBinaryImageOverlayActor::vvBinaryImageOverlayActor()
-{
+{ 
   mTSlice = -1;
   mSlice = 0;
   mColor.resize(3);
@@ -49,7 +53,7 @@ vvBinaryImageOverlayActor::vvBinaryImageOverlayActor()
 
 //------------------------------------------------------------------------------
 vvBinaryImageOverlayActor::~vvBinaryImageOverlayActor()
-{
+{ 
   mImageActorList.clear();
 }
 //------------------------------------------------------------------------------
@@ -57,7 +61,7 @@ vvBinaryImageOverlayActor::~vvBinaryImageOverlayActor()
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::RemoveActors()
-{
+{ 
   for (unsigned int i = 0; i < mImageActorList.size(); i++) {
     if (mSlicer != 0) {
       if (mSlicer != NULL) {
@@ -75,7 +79,7 @@ void vvBinaryImageOverlayActor::RemoveActors()
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::SetColor(double r, double g, double b)
-{
+{ 
   mColor[0] = r;
   mColor[1] = g;
   mColor[2] = b;
@@ -85,7 +89,7 @@ void vvBinaryImageOverlayActor::SetColor(double r, double g, double b)
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::SetSlicer(vvSlicer * slicer)
-{
+{ 
   mSlicer = slicer;
 }
 //------------------------------------------------------------------------------
@@ -93,7 +97,7 @@ void vvBinaryImageOverlayActor::SetSlicer(vvSlicer * slicer)
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
-{
+{ 
   if (!mSlicer) {
     std::cerr << "ERROR. Please use setSlicer before setSlicer in vvBinaryImageOverlayActor." << std::endl;
     exit(0);
@@ -107,7 +111,11 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
   for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
     // how many intensity ?
     vtkSmartPointer<vtkImageMapToRGBA> mOverlayMapper = vtkSmartPointer<vtkImageMapToRGBA>::New();
+#if VTK_MAJOR_VERSION <= 5
     mOverlayMapper->SetInput(mImage->GetVTKImages()[0]); // DS TODO : to change if it is 4D !!!
+#else
+    mOverlayMapper->SetInputData(mImage->GetVTKImages()[0]); // DS TODO : to change if it is 4D !!!
+#endif
 
     double range[2];
     mImage->GetVTKImages()[0]->GetScalarRange(range);
@@ -133,7 +141,11 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
     mOverlayMapper->SetLookupTable(mColorLUT);
 
     vtkSmartPointer<vtkImageActor> mOverlayActor = vtkSmartPointer<vtkImageActor>::New();
+#if VTK_MAJOR_VERSION <= 5
     mOverlayActor->SetInput(mOverlayMapper->GetOutput());
+#else
+    mOverlayActor->GetMapper()->SetInputConnection(mOverlayMapper->GetOutputPort());
+#endif
     mOverlayActor->SetPickable(0);
     mOverlayActor->SetVisibility(IsVisible);
     //mOverlayActor->SetOpacity(1.0);  
@@ -152,7 +164,7 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::SetOpacity(double d)
-{
+{ 
   mAlpha = d;
 }
 //------------------------------------------------------------------------------
@@ -194,7 +206,7 @@ void vvBinaryImageOverlayActor::SetOpacity(double d)
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::SetImage(vvImage::Pointer image, double bg, bool modeBG)
-{
+{ 
   mImage = image;
   if (modeBG) {
     mBackgroundValue = bg;
@@ -210,7 +222,7 @@ void vvBinaryImageOverlayActor::SetImage(vvImage::Pointer image, double bg, bool
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::HideActors()
-{
+{ 
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
   for(unsigned int i=0; i<mImageActorList.size(); i++) {
@@ -224,7 +236,7 @@ void vvBinaryImageOverlayActor::HideActors()
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::ShowActors()
-{
+{ 
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
   mTSlice = mSlicer->GetTSlice();
@@ -240,7 +252,7 @@ void vvBinaryImageOverlayActor::ShowActors()
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::UpdateColor()
-{
+{ 
   mColorLUT->SetTableValue(1, mColor[0], mColor[1], mColor[2], mAlpha); // FG
   for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
     // how many intensity ?
@@ -248,14 +260,18 @@ void vvBinaryImageOverlayActor::UpdateColor()
     mOverlayMapper->SetLookupTable(mColorLUT);
 
     vtkImageActor * mOverlayActor = mImageActorList[numImage];
+#if VTK_MAJOR_VERSION <= 5
     mOverlayActor->SetInput(mOverlayMapper->GetOutput());
+#else
+    mOverlayActor->SetInputData(mOverlayMapper->GetOutput());
+#endif
   }
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::UpdateSlice(int slicer, int slice, bool force)
-{
+{ 
   if (!mSlicer) return;
 
   if (!force) {
@@ -276,7 +292,11 @@ void vvBinaryImageOverlayActor::UpdateSlice(int slicer, int slice, bool force)
   int maskExtent[6];
   ComputeExtent(orientation, mSlice, imageExtent, maskExtent);
   ComputeExtent(maskExtent, maskExtent, mSlicer->GetImage()->GetFirstVTKImageData(), mImage->GetFirstVTKImageData());
+#if VTK_MAJOR_VERSION <= 5
   mSlicer->ClipDisplayedExtent(maskExtent, mMapperList[mTSlice]->GetInput()->GetWholeExtent());
+#else
+  mSlicer->ClipDisplayedExtent(maskExtent, mMapperList[mTSlice]->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
+#endif
   SetDisplayExtentAndCameraPosition(orientation, mSlice, maskExtent, mImageActorList[mTSlice], mDepth);
 
   // set previous slice
@@ -291,7 +311,7 @@ void vvBinaryImageOverlayActor::ComputeExtent(int orientation,
                                              int slice,
                                              int * inExtent,
                                              int * outExtent)
-{
+{ 
   switch (orientation) {
   case vtkImageViewer2::SLICE_ORIENTATION_XY:
     for(int i=0; i<4; i++) outExtent[i] = inExtent[i];
@@ -313,7 +333,7 @@ void vvBinaryImageOverlayActor::ComputeExtent(int orientation,
 
 //----------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::ComputeExtent(int * inExtent, int * outExtent, vtkImageData * image, vtkImageData * overlay)
-{
+{ 
   for(int i=0; i<3; i++) {
     double a = (image->GetOrigin()[i] + inExtent[i*2]*image->GetSpacing()[i] - 
                 overlay->GetOrigin()[i]) / overlay->GetSpacing()[i];
@@ -341,7 +361,7 @@ void vvBinaryImageOverlayActor::SetDisplayExtentAndCameraPosition(int orientatio
                                                                  int * extent,
                                                                  vtkImageActor * actor,
                                                                  double position)
-{
+{ 
   /* FIXME
      Error according to camera orientation
    */
index 5d429a8b71f1c15d9486320f47ba53612be0fdc8..12a2959aa33679b8ab5f6bde9349e0d859eeba5c 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "vtkVOXImageWriter.h"
 #include <vtkImageData.h>
+#include <vtkVersion.h>
 
 #include "clitkCommon.h"
 #include "vvSlicerManager.h"
@@ -133,7 +134,11 @@ void vvDeformableRegistration::run()
   for (unsigned int i=0; i<images.size(); i++) {
     std::stringstream filename;
     filename << temp_dir << "/temp_" << i << ".vox";
+#if VTK_MAJOR_VERSION <= 5
     vox->SetInput(images[i]);
+#else
+    vox->SetInputData(images[i]);
+#endif
     vox->SetFileName(filename.str().c_str());
     if (i==refimage)
       ref_file=filename.str();
index 594996011266e8b19df3f6ddd071611f71727f37..1856dd272602231ebce81c60c099174390e7c24b 100644 (file)
@@ -17,6 +17,7 @@
 ===========================================================================**/
 #include "vvGlyph2D.h"
 
+#include <vtkVersion.h>
 #include "vtkCell.h"
 #include "vtkDataSet.h"
 #include "vtkFloatArray.h"
@@ -32,7 +33,6 @@
 #include "vtkTransform.h"
 #include "vtkUnsignedCharArray.h"
 
-vtkCxxRevisionMacro(vvGlyph2D, "DummyRevision");
 vtkStandardNewMacro(vvGlyph2D);
 
 vvGlyph2D::vvGlyph2D()
@@ -171,9 +171,14 @@ int vvGlyph2D::RequestData(
     defaultPointIds[0] = 0;
     defaultPointIds[1] = 1;
     defaultSource->SetPoints(defaultPoints);
-    defaultSource->InsertNextCell(VTK_LINE, 2, defaultPointIds);
+    defaultSource->InsertNextCell(VTK_LINE, 2, defaultPointIds); 
+#if VTK_MAJOR_VERSION <= 5
     defaultSource->SetUpdateExtent(0, 1, 0);
     this->SetSource(defaultSource);
+#else
+    this->SetUpdateExtent(0, 1, 0);
+    this->SetSourceData(defaultSource);
+#endif
     defaultSource->Delete();
     defaultSource = NULL;
     defaultPoints->Delete();
index 6ffd68deeb7e555fff9380b49cbe9d5960836647..377bf34433e2571c82ef93d5c657fcebaf17b8d2 100644 (file)
@@ -22,7 +22,7 @@
 class vvGlyph2D : public vtkGlyph3D
 {
 public:
-    vtkTypeRevisionMacro(vvGlyph2D,vtkGlyph3D);
+    vtkTypeMacro(vvGlyph2D,vtkGlyph3D);
     void PrintSelf(ostream& os, vtkIndent indent);
 
     // Description
index 949ecf19010f09571ab7d9d8eb3e550953b168df..3a6763b480aab632c7c199a151f8902e6466a4f5 100644 (file)
@@ -26,7 +26,6 @@
 #include "vtkPolyData.h"
 #include "vtkUnsignedCharArray.h"
 
-vtkCxxRevisionMacro(vvGlyphSource, "DummyRevision");
 vtkStandardNewMacro(vvGlyphSource);
 
 
index a9bebf9944d3d2eb58c425c59fd2f84256b40974..c3db9a06c7dc6a0a03f694407cc03ca1afc5d487 100644 (file)
@@ -25,7 +25,7 @@ class vvGlyphSource: public vtkGlyphSource2D
 {
 public:
     static vvGlyphSource *New();
-    vtkTypeRevisionMacro(vvGlyphSource,vtkGlyphSource2D);
+    vtkTypeMacro(vvGlyphSource,vtkGlyphSource2D);
     void PrintSelf(ostream& os, vtkIndent indent);
 
     void SetGlyphTypeToSpecificArrow() {
index 15a864843ba26c5767d6a665b72bd65063f245ca..e1604607aa8af0e2f57effbd728d23a04408047c 100644 (file)
@@ -12,6 +12,7 @@
     <file>icons/8b.png</file>
     <file>icons/1b.png</file>
     <file>icons/binarize.png</file>
+    <file>icons/profile.png</file>
     <file>icons/resample.png</file>
     <file>icons/crop.png</file>
     <file>icons/splashscreen2.png</file>
index 4fecf93e9371f52703dfc9634899547f74965f11..2ece6c5f33a85cd20c589231bb288475df70c902 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "vvImageContour.h"
 #include "vvImage.h"
+#include <vtkVersion.h>
 #include <vtkImageActor.h>
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
 #include <vtkImageData.h>
 #include <vtkPolyDataMapper.h>
 #include <vtkProperty.h>
+#include <vtkInformation.h>
 
 //------------------------------------------------------------------------------
 vvImageContour::vvImageContour()
-{
+{ 
   mTSlice = -1;
   mSlice = 0;
   mHiddenImageIsUsed = false;
@@ -44,7 +46,7 @@ vvImageContour::vvImageContour()
 
 //------------------------------------------------------------------------------
 vvImageContour::~vvImageContour()
-{
+{ 
   mSquaresActorList.clear();
 }
 //------------------------------------------------------------------------------
@@ -52,7 +54,7 @@ vvImageContour::~vvImageContour()
 
 //------------------------------------------------------------------------------
 void vvImageContour::RemoveActors()
-{
+{ 
   for (unsigned int i = 0; i < mSquaresActorList.size(); i++) {
     if (mSlicer != 0) {
       if (mSlicer!= NULL) {
@@ -69,7 +71,8 @@ void vvImageContour::RemoveActors()
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::SetSlicer(vvSlicer * slicer) {
+void vvImageContour::SetSlicer(vvSlicer * slicer) 
+{ 
   mSlicer = slicer;  
   // Create an actor for each time slice
   for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
@@ -80,9 +83,14 @@ void vvImageContour::SetSlicer(vvSlicer * slicer) {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::SetImage(vvImage::Pointer image) {
+void vvImageContour::SetImage(vvImage::Pointer image) 
+{ 
   for (unsigned int numImage = 0; numImage < image->GetVTKImages().size(); numImage++) {
+#if VTK_MAJOR_VERSION <= 5
     mClipperList[numImage]->SetInput(image->GetVTKImages()[numImage]);
+#else
+    mClipperList[numImage]->SetInputData(image->GetVTKImages()[numImage]);
+#endif
   }
   mHiddenImageIsUsed = true;
   mHiddenImage = image;
@@ -91,7 +99,8 @@ void vvImageContour::SetImage(vvImage::Pointer image) {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::SetPreserveMemoryModeEnabled(bool b) {
+void vvImageContour::SetPreserveMemoryModeEnabled(bool b) 
+{ 
   // FastCache mode work only if threshold is always the same
   if (mDisplayModeIsPreserveMemory == b) return;
   mDisplayModeIsPreserveMemory = b;
@@ -111,9 +120,11 @@ void vvImageContour::SetPreserveMemoryModeEnabled(bool b) {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::SetColor(double r, double g, double b) {
+void vvImageContour::SetColor(double r, double g, double b) 
+{ 
   for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
     mSquaresActorList[i]->GetProperty()->SetColor(r,g,b);
+    mSquaresActorList[i]->GetProperty()->SetOpacity(0.995); //in order to get VTK to turn on the alpha-blending in OpenGL
   }
 }
 //------------------------------------------------------------------------------
@@ -121,7 +132,7 @@ void vvImageContour::SetColor(double r, double g, double b) {
 
 //------------------------------------------------------------------------------
 void vvImageContour::SetLineWidth(double w)
-{
+{ 
   for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
     mSquaresActorList[i]->GetProperty()->SetLineWidth(w);
   }
@@ -130,7 +141,8 @@ void vvImageContour::SetLineWidth(double w)
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::HideActors() {
+void vvImageContour::HideActors() 
+{ 
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
   for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
@@ -141,7 +153,8 @@ void vvImageContour::HideActors() {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::ShowActors() {
+void vvImageContour::ShowActors() 
+{ 
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
   mTSlice = mSlicer->GetTSlice();
@@ -166,7 +179,8 @@ void vvImageContour::SetDepth(double d)
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvImageContour::Update(double value) {
+void vvImageContour::Update(double value) 
+{ 
   if (!mSlicer) return;
   if (mPreviousValue == value) {
     if (mPreviousSlice == mSlicer->GetSlice()) {
@@ -202,7 +216,8 @@ void vvImageContour::Update(double value) {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::UpdateWithPreserveMemoryMode() {
+void vvImageContour::UpdateWithPreserveMemoryMode() 
+{ 
   // Only change actor visibility if tslice change
   mPreviousTslice = mTSlice;
   mTSlice = mSlicer->GetTSlice();
@@ -218,14 +233,15 @@ void vvImageContour::UpdateWithPreserveMemoryMode() {
   if (mPreviousTslice != mTSlice) {
     if (mPreviousTslice != -1) mSquaresActorList[mPreviousTslice]->VisibilityOff();
   }
-  
+
   mSlicer->Render();
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::InitializeCacheMode() {
+void vvImageContour::InitializeCacheMode() 
+{ 
 clitkExceptionMacro("TODO : not implemented yet");
   mPreviousSlice = mPreviousOrientation = 0;
   int dim = mSlicer->GetImage()->GetNumberOfDimensions();
@@ -243,7 +259,8 @@ clitkExceptionMacro("TODO : not implemented yet");
 
 
 //------------------------------------------------------------------------------
-int vvImageContour::ComputeCurrentOrientation() {
+int vvImageContour::ComputeCurrentOrientation() 
+{ 
   // Get extent of image in the slicer
   int* extent = mSlicer->GetImageActor()->GetDisplayExtent();
 
@@ -261,7 +278,8 @@ int vvImageContour::ComputeCurrentOrientation() {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::UpdateWithFastCacheMode() {
+void vvImageContour::UpdateWithFastCacheMode() 
+{ 
 clitkExceptionMacro("TODO : not implemented yet");
 
   // Compute orientation
@@ -289,22 +307,37 @@ clitkExceptionMacro("TODO : not implemented yet");
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::CreateNewActor(int numImage) {
+void vvImageContour::CreateNewActor(int numImage) 
+{ 
   vtkSmartPointer<vtkActor> squaresActor = vtkSmartPointer<vtkActor>::New();
   vtkSmartPointer<vtkImageClip> clipper = vtkSmartPointer<vtkImageClip>::New();
   vtkSmartPointer<vtkMarchingSquares> squares = vtkSmartPointer<vtkMarchingSquares>::New();
   vtkSmartPointer<vtkPolyDataMapper> squaresMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
 
-  if (mHiddenImageIsUsed)
+  if (mHiddenImageIsUsed) {
+#if VTK_MAJOR_VERSION <= 5
     clipper->SetInput(mHiddenImage->GetVTKImages()[0]);
-  else
+#else
+    clipper->SetInputData(mHiddenImage->GetVTKImages()[0]);
+#endif
+  } else {
+#if VTK_MAJOR_VERSION <= 5
     clipper->SetInput(mSlicer->GetImage()->GetVTKImages()[numImage]);
-  
+#else
+    clipper->SetInputData(mSlicer->GetImage()->GetVTKImages()[numImage]);
+#endif
+  }
+#if VTK_MAJOR_VERSION <= 5
   squares->SetInput(clipper->GetOutput());
   squaresMapper->SetInput(squares->GetOutput());
+#else
+  squares->SetInputConnection(clipper->GetOutputPort(0));
+  squaresMapper->SetInputConnection(squares->GetOutputPort(0));
+#endif
   squaresMapper->ScalarVisibilityOff();
   squaresActor->SetMapper(squaresMapper);
   squaresActor->GetProperty()->SetColor(1.0,0,0);
+  squaresActor->GetProperty()->SetOpacity(0.995); //in order to get VTK to turn on the alpha-blending in OpenGL
   squaresActor->SetPickable(0);
   squaresActor->VisibilityOff();
   mSlicer->GetRenderer()->AddActor(squaresActor);
@@ -322,10 +355,11 @@ void vvImageContour::UpdateActor(vtkActor * actor,
                                  vtkPolyDataMapper * mapper, 
                                  vtkMarchingSquares * squares, 
                                  vtkImageClip * clipper, 
-                                 double threshold, int orientation, int slice) {
+                                 double threshold, int orientation, int slice) 
+{ 
   // Set parameter for the MarchigSquare
   squares->SetValue(0, threshold);
-
+  squares->Update();
   // Get image extent
   int* extent = mSlicer->GetImageActor()->GetDisplayExtent();
 
@@ -362,10 +396,10 @@ void vvImageContour::UpdateActor(vtkActor * actor,
     extent2 = extent;
     actor->VisibilityOn();
   }
+  
   clipper->SetOutputWholeExtent(extent2[0],extent2[1],extent2[2],
                                 extent2[3],extent2[4],extent2[5]);
-
+                                
   if (mHiddenImageIsUsed) delete extent2;
 
   // Move the actor to be visible
@@ -374,7 +408,6 @@ void vvImageContour::UpdateActor(vtkActor * actor,
   // DD(mDepth);
   // position[orientation] = -mDepth;
   // actor->SetPosition(position);
-  
   mapper->Update();
 }
 //------------------------------------------------------------------------------
index 41b3ef105f16b21ee80fcf8103dc071736aa82c6..10550102f0496f0e0c42551f9fa40643f8a5d1a5 100644 (file)
 #define VVINTENSITYVALUESLIDER_H
 
 // qt
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include <QDialog>
 
 // clitk 
index ac37a8fd22c95442157365a2a03ad3409d662ed1..8ddc4df78c71c06a24a8466ac40664ede6a9ef4a 100644 (file)
@@ -29,8 +29,6 @@
 #include <vtkRendererCollection.h>
 #include "clitkCommon.h"
 
-
-vtkCxxRevisionMacro(vvInteractorStyleNavigator, "DummyRevision");
 vtkStandardNewMacro(vvInteractorStyleNavigator);
 
 //----------------------------------------------------------------------------
index 5b3da5d19be2aaf67fab33d31e1c2fe8aeb307fc..e0de7c0fc0fda275f06fa261b45b17f46747c391 100644 (file)
@@ -29,7 +29,7 @@ class vvInteractorStyleNavigator : public vtkInteractorStyle
 {
 public:
     static vvInteractorStyleNavigator *New();
-    vtkTypeRevisionMacro(vvInteractorStyleNavigator, vtkInteractorStyle);
+    vtkTypeMacro(vvInteractorStyleNavigator, vtkInteractorStyle);
     void PrintSelf(ostream& os, vtkIndent indent);
 
     // Description:
index 62ae8892184e89b381946c040c0cb8ecd4633701..3447dba0b29c9e2a441f9ec84ad4c5be8b4c2e11 100644 (file)
 #include "vvImage.h"
 
 // qt
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include <QDialog>
 #include "ui_vvLabelImageLoaderWidget.h"
 
index fed697ebc2a218943ac125b4676e15ac1f3afd70..dc38cd228f69b27981960e24b220bf3fafa5c4eb 100644 (file)
@@ -23,6 +23,7 @@
 #include <string>
 #include <locale.h>
 
+#include <vtkVersion.h>
 #include "vtkPolyData.h"
 #include "vtkPoints.h"
 #include "vtkFloatArray.h"
@@ -117,6 +118,41 @@ void vvLandmarks::RemoveLastLandmark()
 //--------------------------------------------------------------------
 
 
+//--------------------------------------------------------------------
+void vvLandmarks::RemoveLandmarkWithLabel(vtkStdString label, int time)
+{
+  if (label != "P1" && label != "P2")
+    return;
+  // erase a vtkPoint by shifiting the array .
+  // not a problem here because there are no 
+  // pologyons linking the points
+  int t = time;//mLandmarks[index].coordinates[3];
+  int npoints = mPoints[t]->GetNumberOfPoints();
+  
+  //search of the index corresponding to the label
+  int index(0);
+  while (mLabels[t]->GetValue(index) != label)
+    ++index;
+  
+  for (int i = index; i < npoints - 1; i++) {
+    mPoints[t]->InsertPoint(i, mPoints[t]->GetPoint(i+1));
+       std::string str_i;                   // string which will contain the result
+       std::ostringstream convert;      // stream used for the conversion
+       convert << i;                        // insert the textual representation of 'i' in the characters in the stream
+       str_i = convert.str();           // set 'str_i' to the contents of the stream
+       mLabels[t]->SetValue(i,mLabels[t]->GetValue(i+1));
+    }
+  mPoints[t]->SetNumberOfPoints(npoints-1);
+  mLabels[t]->SetNumberOfValues(npoints-1);
+  mLabels[t]->Modified();
+  mPolyData->Modified();
+
+  mLandmarks[t].erase(mLandmarks[t].begin() + index);
+  mIds[t]->RemoveLastTuple();
+}
+//--------------------------------------------------------------------
+
+
 //--------------------------------------------------------------------
 void vvLandmarks::RemoveLandmark(int index)
 {
@@ -451,7 +487,11 @@ void vvLandmarks::SetTime(int time)
     mPolyData->GetPointData()->SetScalars(mIds[time]);
     mPolyData->GetPointData()->AddArray(mLabels[time]);
     mPolyData->Modified();
+#if VTK_MAJOR_VERSION <= 5
     mPolyData->Update();
+#else
+    //mPolyData->Update();
+#endif
     mTime = time;
   }
 }
index 7920d6f9357787b3ccea6ff27b2e80214a4932d1..6f7e91ff99c6635f83303c0e69c7c924a887c745 100644 (file)
@@ -44,6 +44,7 @@ public :
 
     void AddLandmark(float x,float y,float z,float t,double value);
     void RemoveLastLandmark();
+    void RemoveLandmarkWithLabel(vtkStdString, int);
     void RemoveLandmark(int index);
     void RemoveAll();
     
@@ -51,6 +52,7 @@ public :
     float* GetCoordinates(int index);
     double GetPixelValue(int index);
     std::string GetComments(int index);
+    vtkStringArray* GetLabels() { return mLabels[mTime]; }
     unsigned int GetNumberOfPoints() { return (unsigned int) mLandmarks[mTime].size(); }
     //int GetNumberOfSources(){return mText.size();}
 
index d3d80c288ec0264cb326d81409d6f0d770361637..d25173132f7d7993fe86f6c8745b8f9e5dc3fd65 100644 (file)
@@ -27,7 +27,6 @@
 #include "vtkUnsignedCharArray.h"
 #include <cassert>
 
-vtkCxxRevisionMacro(vvLandmarksGlyph, "DummyRevision");
 vtkStandardNewMacro(vvLandmarksGlyph);
 
 #define vtkfont_width 9
index 8b5020d30ac8776530000dde03e30fa8435f3d29..a8fe029552af7aa1b479a332f742308522a3dca3 100644 (file)
@@ -23,7 +23,7 @@
 class vvLandmarksGlyph : public vtkTextSource
 {
 public:
-    vtkTypeRevisionMacro(vvLandmarksGlyph,vtkTextSource);
+    vtkTypeMacro(vvLandmarksGlyph,vtkTextSource);
     void PrintSelf(ostream& os, vtkIndent indent);
 
     // Description:
index 2d3e1a5503ca4f0702e13947935035afd690d16f..f23631cb1ca734fd41e3e946145c0bb64ceb6563 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <QtGui>
 #include <Qt>
+#include <QFileDialog>
 #include "QTreePushButton.h"
 #include "vvLandmarks.h"
 
@@ -29,7 +30,7 @@
 
 //====================================================================
 vvLandmarksPanel::vvLandmarksPanel(QWidget * parent):QWidget(parent)
-{
+{ 
   setupUi(this);
 
   tableWidget->verticalHeader()->hide();
@@ -47,7 +48,7 @@ vvLandmarksPanel::vvLandmarksPanel(QWidget * parent):QWidget(parent)
 }
 
 void vvLandmarksPanel::Load()
-{
+{ 
   QString file = QFileDialog::getOpenFileName(this,tr("Load Landmarks"),
                  mCurrentPath.c_str(),tr("Landmarks ( *.txt *.pts)"));
   if (!file.isEmpty()) {
@@ -57,17 +58,17 @@ void vvLandmarksPanel::Load()
 }
 
 bool vvLandmarksPanel::LoadFromFile(std::vector<std::string> files)
-{
+{ 
   if (!mCurrentLandmarks->LoadFile(files))
     return false;
   
-  SetCurrentLandmarks(mCurrentLandmarks,2);
+  SetCurrentLandmarks(mCurrentLandmarks,0);
   emit UpdateRenderWindows();
   return true;
 }
 
 void vvLandmarksPanel::Save()
-{
+{ 
   QString file = QFileDialog::getSaveFileName(this,
                  tr("Save Landmarks"),
                  mCurrentPath.c_str(),tr("Landmarks ( *.txt)"));
@@ -80,7 +81,7 @@ void vvLandmarksPanel::Save()
 }
 
 void vvLandmarksPanel::SelectPoint()
-{
+{ 
   if (tableWidget->rowCount() > 0) {
     QList<QTableWidgetItem *> items = tableWidget->selectedItems();
     if (!items.empty()) {
@@ -99,7 +100,7 @@ void vvLandmarksPanel::SelectPoint()
 
 
 void vvLandmarksPanel::RemoveSelectedPoints()
-{
+{ 
   if (tableWidget->rowCount() > 0) {
     QList<QTableWidgetItem *> items = tableWidget->selectedItems();
     if (items.empty()) {
@@ -123,7 +124,7 @@ void vvLandmarksPanel::RemoveSelectedPoints()
 }
 
 void vvLandmarksPanel::RemoveAllPoints()
-{
+{ 
   mCurrentLandmarks->RemoveAll();
   tableWidget->clearContents();
   tableWidget->setRowCount(0);
@@ -131,12 +132,12 @@ void vvLandmarksPanel::RemoveAllPoints()
 }
 
 void vvLandmarksPanel::AddPoint()
-{
+{ 
   AddPoint(mCurrentLandmarks->GetNumberOfPoints()-1);
 }
 
 void vvLandmarksPanel::AddPoint(int landmarksIndex)
-{
+{ 
   int rowIndex = tableWidget->rowCount();
 //   DD(rowIndex);
   tableWidget->setRowCount(rowIndex+1);
@@ -175,10 +176,9 @@ void vvLandmarksPanel::AddPoint(int landmarksIndex)
 }
 
 void vvLandmarksPanel::SetCurrentLandmarks(vvLandmarks* lm,int time)
-{
+{ 
   if (time != lm->GetTime())
     return;
-  
   loadButton->setEnabled(1);
   saveButton->setEnabled(1);
   removeButton->setEnabled(1);
@@ -186,7 +186,8 @@ void vvLandmarksPanel::SetCurrentLandmarks(vvLandmarks* lm,int time)
   tableWidget->clearContents();
   tableWidget->setRowCount(0);
   for (unsigned int i = 0; i < mCurrentLandmarks->GetNumberOfPoints(); i++) {
-      AddPoint(i);
+      if ((mCurrentLandmarks->GetLabels()->GetValue(i) != "P1") && (mCurrentLandmarks->GetLabels()->GetValue(i) != "P2"))
+        AddPoint(i);
   }
   //if (time > 1)
   //tableWidget->setColumnHidden(4,1);
@@ -196,14 +197,14 @@ void vvLandmarksPanel::SetCurrentLandmarks(vvLandmarks* lm,int time)
 }
 
 void vvLandmarksPanel::SetCurrentImage(std::string filename)
-{
+{ 
   QString image = "<b>CurrentImage : </b>";
   image += vtksys::SystemTools::GetFilenameWithoutLastExtension(filename).c_str();
   nameLabel->setText(image);
 }
 
 void vvLandmarksPanel::CommentsChanged(int row, int column)
-{
+{ 
   if (column == 6) {
     mCurrentLandmarks->ChangeComments(row,std::string(tableWidget->item(row,column)->text().toStdString()));
     tableWidget->resizeColumnsToContents();
index af39d3e15fb1eda8910f965b8d31566d16f93bd2..45f848a5e19144af25b08af1311ab3caaac9ddc4 100644 (file)
@@ -23,6 +23,7 @@ It is distributed under dual licence
 #include "QTreePushButton.h"
 #include <QUrl>
 #include <QSettings>
+#include <QShortcut>
 
 // VV include
 #include "vvMainWindow.h"
@@ -49,6 +50,9 @@ It is distributed under dual licence
 #include "vvReadState.h"
 #include "clitkConfiguration.h"
 #include "clitkMatrix.h"
+#ifdef Q_OS_OSX
+# include "vvOSXHelper.h"
+#endif
 
 // ITK include
 #include <itkImage.h>
@@ -58,6 +62,9 @@ It is distributed under dual licence
 #include <itkNumericSeriesFileNames.h>
 
 // VTK include
+#include <vtkImageMapper3D.h>
+#include <vtkInformation.h>
+#include <vtkVersion.h>
 #include <vtkImageData.h>
 #include <vtkImageActor.h>
 #include <vtkCornerAnnotation.h>
@@ -121,9 +128,12 @@ It is distributed under dual licence
 
 //------------------------------------------------------------------------------
 vvMainWindow::vvMainWindow():vvMainWindowBase()
-{
+{ 
   setupUi(this); // this sets up the GUI
 
+  //Qt::WindowFlags flags = windowFlags();
+  //setWindowFlags(flags | Qt::WindowStaysOnTopHint);
+
   mInputPathName = "";
   mMenuTools = menuTools;
   //  mMenuSegmentation = menuSegmentation;
@@ -194,21 +204,6 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
     tr("Reset transformation to identity"));
   connect(actionResetMatrix, SIGNAL(triggered()), this,SLOT(ResetTransformationToIdentity()));
 
-  // TRIAL DS
-  /*
-  QMenu * m = new QMenu(menubar);
-  m->setTitle("TOTO");
-  //  m->setObjectName(QString::fromUtf8("TOTOTO"));
-  contextMenu.addMenu(m);
-  QAction * a = m->addAction(QIcon(QString::fromUtf8(":/common/icons/GPSup.png")),
-  tr("BIDON"));
-  QAction * b = m->addAction(QIcon(QString::fromUtf8(":/common/icons/GPSup.png")),
-  tr("BIDON2"));
-  m->addAction(a);
-  m->addAction(b);
-  connect(a,SIGNAL(triggered()),this,SLOT(AddFusionImage()));
-  */
-
   //init the DataTree
   mSlicerManagers.resize(0);
 
@@ -293,6 +288,11 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   connect(actionAdd_overlay_image_to_current_image,SIGNAL(triggered()), this,SLOT(SelectOverlayImage()));
   connect(actionAdd_USSequence_toCT,SIGNAL(triggered()), this,SLOT(SelectFusionSequence()));
   connect(actionNavigation_Help,SIGNAL(triggered()),this,SLOT(ShowHelpDialog()));
+
+  QShortcut *shortcutHelp = new QShortcut(QKeySequence(QKeySequence::HelpContents),this);
+  shortcutHelp->setContext(Qt::ApplicationShortcut);
+  QObject::connect(shortcutHelp, SIGNAL(activated()), this, SLOT(ShowHelpDialog()));
+
   connect(actionDocumentation,SIGNAL(triggered()),this,SLOT(ShowDocumentation()));
   connect(actionRegister_vv,SIGNAL(triggered()),this,SLOT(PopupRegisterForm()));
 
@@ -360,6 +360,13 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   SOViewWidget->hide();
   SEViewWidget->hide();
 
+#ifdef Q_OS_OSX
+  disableGLHiDPI(NOViewWidget->winId());
+  disableGLHiDPI(NEViewWidget->winId());
+  disableGLHiDPI(SOViewWidget->winId());
+  disableGLHiDPI(SEViewWidget->winId());
+#endif
+
   //Recently opened files
   std::list<std::string> recent_files = GetRecentlyOpenedImages();
   recentlyOpenedFilesMenu=NULL;
@@ -380,17 +387,17 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   //timerMemory->setInterval(5);
   connect(timerMemory, SIGNAL(timeout()), this, SLOT(UpdateMemoryUsage()));
   timerMemory->start(2000);
-
 }
+
 //------------------------------------------------------------------------------
 void vvMainWindow::show()
-{
+{ 
   vvMainWindowBase::show();
   PopupRegisterForm(true);
 }
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateMemoryUsage()
-{
+{ 
   //  clitk::PrintMemory(true);
   if (clitk::GetMemoryUsageInMb() == 0) infoPanel->setMemoryInMb("NA");
   else infoPanel->setMemoryInMb(QString::number(clitk::GetMemoryUsageInMb())+" MiB");
@@ -400,7 +407,7 @@ void vvMainWindow::UpdateMemoryUsage()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::createRecentlyOpenedFilesMenu()
-{
+{ 
   recentlyOpenedFilesMenu = new QMenu("Recently opened files...");
   recentlyOpenedFilesMenu->setIcon(QIcon(QString::fromUtf8(":/common/icons/open.png")));
   menuFile->insertMenu(actionOpen_Image_With_Time,recentlyOpenedFilesMenu);
@@ -412,7 +419,7 @@ void vvMainWindow::createRecentlyOpenedFilesMenu()
 //------------------------------------------------------------------------------
 
 void vvMainWindow::updateRecentlyOpenedFilesMenu(const std::list<std::string> &recent_files)
-{
+{ 
   if(recentlyOpenedFilesMenu==NULL) {
     createRecentlyOpenedFilesMenu();
   } else {
@@ -429,11 +436,11 @@ void vvMainWindow::updateRecentlyOpenedFilesMenu(const std::list<std::string> &r
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ComputeMidPosition()
-{
+{ 
   bool ok;
   int index=GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
-  int ref = QInputDialog::getInteger(this,"Chose reference phase","Reference phase",0,0,\
-    mSlicerManagers[index]->GetImage()->GetVTKImages().size()-1,1,&ok);
+  int ref = QInputDialog::getInt(this,"Chose reference phase","Reference phase",0,0,\
+mSlicerManagers[index]->GetImage()->GetVTKImages().size()-1,1,&ok);
   if (ok) {
     vvMidPosition midp;
     midp.slicer_manager = mSlicerManagers[index];
@@ -454,7 +461,7 @@ void vvMainWindow::ComputeMidPosition()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::AddContour(int image_index, vvMesh::Pointer contour, bool propagation)
-{
+{ 
   QTreeWidgetItem *item = new QTreeWidgetItem();
   item->setData(0,Qt::UserRole,"filename.vtk");
   item->setData(1,Qt::UserRole,tr("contour"));
@@ -501,7 +508,7 @@ void vvMainWindow::AddContour(int image_index, vvMesh::Pointer contour, bool pro
 
 //------------------------------------------------------------------------------
 void vvMainWindow::OpenVTKContour()
-{
+{ 
   if (mSlicerManagers.size() > 0) {
     QString Extensions = "Images ( *.vtk *.obj)";
     Extensions += ";;All Files (*)";
@@ -524,7 +531,7 @@ void vvMainWindow::OpenVTKContour()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::AddDCStructContour(int index, QString file)
-{
+{ 
   vvMeshReader reader;
   reader.SetFilename(file.toStdString());
   vvStructSelector selector;
@@ -548,7 +555,7 @@ void vvMainWindow::AddDCStructContour(int index, QString file)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::OpenDCStructContour()
-{
+{ 
   if (mSlicerManagers.size() > 0) {
     QString Extensions = "Dicom Files ( *.dcm RS*)";
     Extensions += ";;All Files (*)";
@@ -564,7 +571,7 @@ void vvMainWindow::OpenDCStructContour()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ComputeDeformableRegistration()
-{
+{ 
   if (mSlicerManagers.size() > 0) {
     int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
     vvDeformationDialog dialog(index,mSlicerManagers);
@@ -581,11 +588,11 @@ void vvMainWindow::ComputeDeformableRegistration()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::WarpImage()
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   if (!mSlicerManagers[index]->GetVF().IsNull()) {
     bool ok;
-    int ref = QInputDialog::getInteger(this,"Chose reference phase","Reference phase",0,0,\
+    int ref = QInputDialog::getInt(this,"Chose reference phase","Reference phase",0,0,\
       mSlicerManagers[index]->GetImage()->GetVTKImages().size()-1,1,&ok);
     if (ok) {
       WarpImage(mSlicerManagers[index],ref);
@@ -598,7 +605,7 @@ void vvMainWindow::WarpImage()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::WarpImage(vvSlicerManager* selected_slicer,int reference_phase)
-{
+{ 
   if (!selected_slicer->GetVF().IsNull()) {
     QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
     QFileInfo info(selected_slicer->GetFileName().c_str());
@@ -621,17 +628,20 @@ void vvMainWindow::WarpImage(vvSlicerManager* selected_slicer,int reference_phas
 
 //------------------------------------------------------------------------------
 vvMainWindow::~vvMainWindow()
-{
+{ 
   for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
     if (mSlicerManagers[i] != NULL)
       delete mSlicerManagers[i];
   }
+  delete documentation;
+  delete help_dialog;
+  delete dicomSeriesSelector;
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 QTabWidget * vvMainWindow::GetTab()
-{
+{ 
   return tabWidget;
 }
 //------------------------------------------------------------------------------
@@ -639,7 +649,7 @@ QTabWidget * vvMainWindow::GetTab()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::MergeImages()
-{
+{ 
   QString Extensions = EXTENSIONS;
   Extensions += ";;All Files (*)";
   QStringList files = QFileDialog::getOpenFileNames(this,tr("Merge Images"),mInputPathName,Extensions);
@@ -698,7 +708,7 @@ void vvMainWindow::MergeImages()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SliceImages()
-{
+{ 
   QString Extensions = EXTENSIONS;
   Extensions += ";;All Files (*)";
 
@@ -715,7 +725,7 @@ void vvMainWindow::SliceImages()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::MergeImagesWithTime()
-{
+{ 
   QString Extensions = EXTENSIONS;
   Extensions += ";;All Files (*)";
   QStringList files = QFileDialog::getOpenFileNames(this,tr("Merge Images With Time"),mInputPathName,Extensions);
@@ -737,7 +747,7 @@ void vvMainWindow::MergeImagesWithTime()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::OpenDicom()
-{
+{ 
   std::vector<std::string> files;
 
   //std::cout << "dicomSeriesSelector " << std::endl;
@@ -750,7 +760,7 @@ void vvMainWindow::OpenDicom()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::OpenImages()
-{
+{ 
   QString Extensions = EXTENSIONS;
   Extensions += ";;All Files (*)";
 
@@ -765,7 +775,7 @@ void vvMainWindow::OpenImages()
 }
 //------------------------------------------------------------------------------
 void vvMainWindow::OpenRecentImage()
-{
+{ 
   QAction * caller = qobject_cast<QAction*>(sender());
   std::vector<std::string> images;
   images.push_back(caller->text().toStdString());
@@ -777,7 +787,7 @@ void vvMainWindow::OpenRecentImage()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::OpenImageWithTime()
-{
+{ 
   QString Extensions = EXTENSIONS;
   Extensions += ";;All Files (*)";
 
@@ -796,7 +806,7 @@ void vvMainWindow::OpenImageWithTime()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::LoadedImageType filetype)
-{
+{ 
   //Separate the way to open images and dicoms
   int fileSize;
   if (filetype == vvImageReader::IMAGE || filetype == vvImageReader::IMAGEWITHTIME)
@@ -859,12 +869,11 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::Loa
       // Change filename if an image with the same already exist
       int number = GetImageDuplicateFilenameNumber(files[i] + std::string("_slice"));
 
-      if (filetype == vvImageReader::IMAGE || filetype == vvImageReader::IMAGEWITHTIME || filetype == vvImageReader::SLICED)
+      if (filetype == vvImageReader::IMAGE || filetype == vvImageReader::IMAGEWITHTIME || filetype == vvImageReader::SLICED) {
         SetImageSucceed = imageManager->SetImage(files[i],filetype, number, j);
-      else {
+      else {
         SetImageSucceed = imageManager->SetImages(files,filetype, number);
       }
-
       if (!SetImageSucceed) {
         QApplication::restoreOverrideCursor();
         QString error = "Cannot open file \n";
@@ -872,6 +881,7 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::Loa
         QMessageBox::information(this,tr("Reading problem"),error);
         delete imageManager;
       } else {
+
         mSlicerManagers.push_back(imageManager);
 
         //create an item in the tree with good settings
@@ -941,12 +951,12 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::Loa
         connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
           this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
         connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
-
         InitSlicers();
         numberofsuccesulreads++;
       }
     }
   }
+
   if (numberofsuccesulreads) {
     NOViewWidget->show();
     NEViewWidget->show();
@@ -971,7 +981,7 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::Loa
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateTree()
-{
+{ 
   DataTree->resizeColumnToContents(COLUMN_TREE);
   DataTree->resizeColumnToContents(COLUMN_UL_VIEW);
   DataTree->resizeColumnToContents(COLUMN_UR_VIEW);
@@ -985,7 +995,7 @@ void vvMainWindow::UpdateTree()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::CurrentImageChanged(std::string id)
-{
+{ 
   if (id == mCurrentSelectedImageId) return; // Do nothing
   int selected = 0;
   for (int i = 0; i < DataTree->topLevelItemCount(); i++) {
@@ -1012,7 +1022,7 @@ void vvMainWindow::CurrentImageChanged(std::string id)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::CurrentPickedImageChanged(std::string id)
-{
+{ 
   if (id == mCurrentPickedImageId) return; // Do nothing
   int selected = 0;
   for (int i = 0; i < DataTree->topLevelItemCount(); i++) {
@@ -1033,7 +1043,7 @@ void vvMainWindow::CurrentPickedImageChanged(std::string id)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ImageInfoChanged()
-{
+{ 
   contextActions[6]->setEnabled(1);
   contextActions[5]->setEnabled(1);
   actionSave_As->setEnabled(1);
@@ -1211,14 +1221,14 @@ void vvMainWindow::ImageInfoChanged()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ShowDocumentation()
-{
+{ 
   documentation->show();
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvMainWindow::PopupRegisterForm(bool checkCanPush)
-{
+{ 
   vvRegisterForm* registerForm = new vvRegisterForm(QUrl("http://www.creatis.insa-lyon.fr/~dsarrut/vvregister/write.php"), getVVSettingsPath(), getSettingsOptionFormat());
   if(!checkCanPush) {
     registerForm->show();
@@ -1233,14 +1243,14 @@ void vvMainWindow::PopupRegisterForm(bool checkCanPush)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ShowHelpDialog()
-{
+{ 
   help_dialog->show();
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ChangeViewMode()
-{
+{ 
   typedef struct _SIZE{
     QSplitter* splitter;
     QList<int> size1, size2;
@@ -1324,7 +1334,7 @@ void vvMainWindow::ChangeViewMode()
 
 //------------------------------------------------------------------------------
 QString vvMainWindow::GetSizeInBytes(unsigned long size)
-{
+{ 
   QString result = "";// QString::number(size);
   //result += " bytes (";
   if (size > 1000000000) {
@@ -1346,7 +1356,7 @@ QString vvMainWindow::GetSizeInBytes(unsigned long size)
 
 //------------------------------------------------------------------------------
 QString vvMainWindow::GetVectorDoubleAsString(std::vector<double> vectorDouble)
-{
+{ 
   QString result;
   for (unsigned int i= 0; i < vectorDouble.size(); i++) {
     if (i != 0)
@@ -1359,7 +1369,7 @@ QString vvMainWindow::GetVectorDoubleAsString(std::vector<double> vectorDouble)
 
 //------------------------------------------------------------------------------
 QString vvMainWindow::GetVectorIntAsString(std::vector<int> vectorInt)
-{
+{ 
   QString result;
   for (unsigned int i= 0; i < vectorInt.size(); i++) {
     if (i != 0)
@@ -1373,7 +1383,7 @@ QString vvMainWindow::GetVectorIntAsString(std::vector<int> vectorInt)
 //------------------------------------------------------------------------------
 //this actually returns the SlicerManager index!
 int vvMainWindow::GetSlicerIndexFromItem(QTreeWidgetItem* item)
-{
+{ 
   QString id = item->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString();
   for (int i = 0; i < DataTree->topLevelItemCount(); i++) {
     if (DataTree->topLevelItem(i)->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString() == id)
@@ -1385,7 +1395,7 @@ int vvMainWindow::GetSlicerIndexFromItem(QTreeWidgetItem* item)
 
 //------------------------------------------------------------------------------
 QTreeWidgetItem* vvMainWindow::GetItemFromSlicerManager(vvSlicerManager* sm)
-{
+{ 
   QString id = sm->GetId().c_str();
   for (int i = 0; i < DataTree->topLevelItemCount(); i++) {
     if (DataTree->topLevelItem(i)->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString() == id)
@@ -1397,7 +1407,7 @@ QTreeWidgetItem* vvMainWindow::GetItemFromSlicerManager(vvSlicerManager* sm)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::DisplayChanged(QTreeWidgetItem *clickedItem, int column)
-{
+{ 
   if ( column >= COLUMN_CLOSE_IMAGE || column <= 0)
     return;
 
@@ -1465,21 +1475,22 @@ void vvMainWindow::DisplayChanged(QTreeWidgetItem *clickedItem, int column)
 //------------------------------------------------------------------------------
 
 void vvMainWindow::InitSlicers()
-{
+{ 
   if (mSlicerManagers.size()) {
     mSlicerManagers.back()->GenerateDefaultLookupTable();
-
     mSlicerManagers.back()->SetSlicerWindow(0,NOViewWidget->GetRenderWindow());
     mSlicerManagers.back()->SetSlicerWindow(1,NEViewWidget->GetRenderWindow());
     mSlicerManagers.back()->SetSlicerWindow(2,SOViewWidget->GetRenderWindow());
     mSlicerManagers.back()->SetSlicerWindow(3,SEViewWidget->GetRenderWindow());
-    mSlicerManagers.back()->Render(); // SR: displayed #slice is wrong without this
+#if VTK_MAJOR_VERSION <= 5
+    mSlicerManagers.back()->Render(); // SR: displayed #slice is wrong without this / TB: With VTK6 and multiple images, all slicers are updated, not only the first
+#endif
   }
 }
 
 //------------------------------------------------------------------------------
 void vvMainWindow::InitDisplay()
-{
+{ 
   if (mSlicerManagers.size()) {
     //BE CAREFUL : this is absolutely necessary to set the interactor style
     //in order to have the same style instanciation for all SlicerManagers in
@@ -1490,14 +1501,14 @@ void vvMainWindow::InitDisplay()
       bool AlreadySelected = false;
       for (int i = 0; i < DataTree->topLevelItemCount(); i++) {
         mSlicerManagers[i]->SetInteractorStyleNavigator(j,style);
-
         //select the image only if previous are not selected
         if (DataTree->topLevelItem(i)->data(j+1,Qt::CheckStateRole).toInt() > 1) {
           mSlicerManagers[i]->UpdateSlicer(j,1);
           AlreadySelected = true;
         } else if (i == DataTree->topLevelItemCount()-1 && !AlreadySelected) {
-          if (DataTree->selectedItems().size() == 0)
+          if (DataTree->selectedItems().size() == 0) {
             DataTree->topLevelItem(i)->setSelected(1);
+          }
           DataTree->topLevelItem(i)->setData(j+1,Qt::CheckStateRole,2);
           mSlicerManagers[i]->UpdateSlicer(j,1);
           DisplaySliders(i,j);
@@ -1514,7 +1525,7 @@ void vvMainWindow::InitDisplay()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::DisplaySliders(int slicer, int window)
-{
+{ 
   if(!mSlicerManagers[slicer]->GetSlicer(window)->GetRenderer()->GetDraw())
     return;
 
@@ -1543,7 +1554,7 @@ void vvMainWindow::DisplaySliders(int slicer, int window)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column)
-{
+{ 
   int index = GetSlicerIndexFromItem(item);
 
   if (DataTree->topLevelItem(index) != item) {
@@ -1661,7 +1672,7 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ReloadImage(QTreeWidgetItem* item, int column)
-{
+{ 
   // int index = GetSlicerIndexFromItem(item);
   //   QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
   //   if (item->data(1,Qt::UserRole).toString() == "vector")
@@ -1701,28 +1712,28 @@ void vvMainWindow::ReloadImage(QTreeWidgetItem* item, int column)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::MousePositionChanged(int visibility,double x, double y, double z, double X, double Y, double Z , double value)
-{
+{ 
   infoPanel->setCurrentInfo(visibility,x,y,z,X,Y,Z,value);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvMainWindow::VectorChanged(int visibility,double x, double y, double z, double value)
-{
+{ 
   overlayPanel->getCurrentVectorInfo(visibility,x,y,z,value);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvMainWindow::OverlayChanged(int visibility, double valueOver, double valueRef)
-{
+{ 
   overlayPanel->getCurrentOverlayInfo(visibility,valueOver, valueRef);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvMainWindow::FusionChanged(int visibility, double value)
-{
+{ 
   overlayPanel->getCurrentFusionInfo(visibility,value);
 }
 //------------------------------------------------------------------------------
@@ -1732,7 +1743,7 @@ void vvMainWindow::FusionChanged(int visibility, double value)
 //or when UpdateWindowLevel() is called ; when slicerManager emits WindowLevelChanged
 //when ImageInfoChanged() is called
 void vvMainWindow::WindowLevelChanged()
-{
+{ 
   // Base image
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   if(index==-1) return;
@@ -1787,7 +1798,7 @@ void vvMainWindow::WindowLevelChanged()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::WindowLevelEdited()
-{
+{ 
   presetComboBox->setCurrentIndex(WL_USER);
   UpdateWindowLevel();
 }
@@ -1795,7 +1806,7 @@ void vvMainWindow::WindowLevelEdited()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SetWindowLevel(double w, double l)
-{
+{ 
   windowSpinBox->setValue(w);
   levelSpinBox->setValue(l);
   presetComboBox->setCurrentIndex(WL_USER);
@@ -1806,7 +1817,7 @@ void vvMainWindow::SetWindowLevel(double w, double l)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateWindowLevel()
-{
+{ 
   if (DataTree->selectedItems().size()) {
     if (presetComboBox->currentIndex() == WL_VENTILATION) //For ventilation
       colorMapComboBox->setCurrentIndex(5);
@@ -1822,7 +1833,7 @@ void vvMainWindow::UpdateWindowLevel()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateSlicingPreset()
-{
+{ 
   if (DataTree->selectedItems().size()) {
     int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
     mSlicerManagers[index]->SetSlicingPreset(vvSlicerManager::SlicingPresetType(slicingPresetComboBox->currentIndex()));
@@ -1832,7 +1843,7 @@ void vvMainWindow::UpdateSlicingPreset()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateColorMap()
-{
+{ 
   if (DataTree->selectedItems().size()) {
     int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
     mSlicerManagers[index]->SetColorMap(colorMapComboBox->currentIndex());
@@ -1841,7 +1852,7 @@ void vvMainWindow::UpdateColorMap()
 }
 //------------------------------------------------------------------------------
 void vvMainWindow::SwitchWindowLevel()
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   int window = mSlicerManagers[index]->GetColorWindow();
   presetComboBox->setCurrentIndex(WL_USER);
@@ -1852,7 +1863,7 @@ void vvMainWindow::SwitchWindowLevel()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ApplyWindowLevelToAllImages()
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   if(index==-1) return;
   double window = mSlicerManagers[index]->GetColorWindow();
@@ -1881,7 +1892,7 @@ void vvMainWindow::ApplyWindowLevelToAllImages()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ApplyWindowToSetOfImages(double window, unsigned int indexMin, unsigned int indexMax)
-{
+{ 
   for (unsigned int i = indexMin; i <= indexMax && i < mSlicerManagers.size(); i++) {
     if (mSlicerManagers[i] == NULL)
       continue;
@@ -1894,7 +1905,7 @@ void vvMainWindow::ApplyWindowToSetOfImages(double window, unsigned int indexMin
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ApplyLevelToSetOfImages(double level, unsigned int indexMin, unsigned int indexMax)
-{
+{ 
   for (unsigned int i = indexMin; i <= indexMax && i < mSlicerManagers.size(); i++) {
     if (mSlicerManagers[i] == NULL)
       continue;
@@ -1907,7 +1918,7 @@ void vvMainWindow::ApplyLevelToSetOfImages(double level, unsigned int indexMin,
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps)
-{
+{ 
   for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
     if (mSlicerManagers[i]->GetId() == id) {
       mSlicerManagers[i]->GetSlicer(slicer)->SetCurrentPosition(x,y,z,temps);
@@ -1920,7 +1931,7 @@ void vvMainWindow::UpdateLinkManager(std::string id, int slicer, double x, doubl
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateLinkedNavigation(std::string id, vvSlicerManager * sm, vvSlicer* refSlicer)
-{
+{ 
   for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
     if (id == mSlicerManagers[i]->GetId()) {
       mSlicerManagers[i]->UpdateLinkedNavigation(refSlicer);
@@ -1931,7 +1942,7 @@ void vvMainWindow::UpdateLinkedNavigation(std::string id, vvSlicerManager * sm,
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ShowContextMenu(QPoint point)
-{
+{ 
   if (!DataTree->selectedItems().size()) {
     contextActions[1]->setEnabled(0);
     contextActions[2]->setEnabled(0);
@@ -1960,21 +1971,21 @@ void vvMainWindow::ShowContextMenu(QPoint point)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::CloseImage()
-{
+{ 
   CloseImage(DataTree->selectedItems()[0],0);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ReloadImage()
-{
+{ 
   ReloadImage(DataTree->selectedItems()[0],0);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SelectOverlayImage()
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
 
   //check if one overlay image is added
@@ -1997,13 +2008,14 @@ void vvMainWindow::SelectOverlayImage()
     for (int i = 0; i < files.size(); i++) {
       vecFileNames.push_back(files[i].toStdString());
     }
+
     AddOverlayImage(index,vecFileNames,vvImageReader::IMAGE);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvMainWindow::AddOverlayImage(int index, std::vector<std::string> fileNames, vvImageReader::LoadedImageType type)
-{
+{ 
   QString file(fileNames[0].c_str());
   if (QFile::exists(file))
   {
@@ -2028,6 +2040,10 @@ void vvMainWindow::AddOverlayImage(int index, std::vector<std::string> fileNames
       item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
       item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("overlay").c_str());
       qApp->processEvents();
+#if VTK_MAJOR_VERSION > 5
+      for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++)
+        mSlicerManagers[index]->GetSlicer(i)->ForceUpdateDisplayExtent();
+#endif
 
       for (int j = 1; j <= 4; j++) {
         item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole));
@@ -2083,7 +2099,7 @@ void vvMainWindow::AddOverlayImage(int index, std::vector<std::string> fileNames
 
 //------------------------------------------------------------------------------
 void vvMainWindow::AddROI(int index, QString file)
-{
+{ 
   /*
   // Get slice manager
 
@@ -2110,7 +2126,7 @@ void vvMainWindow::AddROI(int index, QString file)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SelectFusionImage()
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
 
   //check if one fusion image is added
@@ -2140,7 +2156,7 @@ void vvMainWindow::SelectFusionImage()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ResetTransformationToIdentity()
-{
+{ 
   std::string actorType = DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString().toStdString();
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   mSlicerManagers[index]->ResetTransformationToIdentity(actorType);
@@ -2150,7 +2166,7 @@ void vvMainWindow::ResetTransformationToIdentity()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::AddFusionImage(int index, std::vector<std::string> fileNames, vvImageReader::LoadedImageType type)
-{
+{ 
   QString file(fileNames[0].c_str());
   if (QFile::exists(file))
   {
@@ -2175,7 +2191,10 @@ void vvMainWindow::AddFusionImage(int index, std::vector<std::string> fileNames,
           item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
           item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("fusion").c_str());
           qApp->processEvents();
-
+#if VTK_MAJOR_VERSION > 5
+      for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++)
+        mSlicerManagers[index]->GetSlicer(i)->ForceUpdateDisplayExtent();
+#endif
       for (int j = 1; j <= 4; j++) {
         item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole));
       }
@@ -2228,7 +2247,7 @@ void vvMainWindow::AddFusionImage(int index, std::vector<std::string> fileNames,
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 void vvMainWindow::AddLandmarks(int index, std::vector<std::string> files)
-{
+{ 
     if (!landmarksPanel->LoadFromFile(files))
       QMessageBox::information(this,tr("Problem reading Landmarks !"),"File doesn't exist!");
 
@@ -2238,7 +2257,7 @@ void vvMainWindow::AddLandmarks(int index, std::vector<std::string> files)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::OpenField()
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   //check if a vector field has already been added
   for (int child = 0; child < DataTree->topLevelItem(index)->childCount(); child++)
@@ -2266,7 +2285,7 @@ void vvMainWindow::OpenField()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk)
-{
+{ 
   //create an item in the tree with good settings
   QTreeWidgetItem *item = new QTreeWidgetItem();
   item->setData(0,Qt::UserRole,filename.toStdString().c_str());
@@ -2317,11 +2336,15 @@ void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::AddField(vvImage::Pointer vf,QString file,int index)
-{
+{ 
   QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
   vvSlicerManager* imageManager = mSlicerManagers[index];
   if (imageManager->SetVF(vf,file.toStdString())) {
     AddFieldEntry(file,index,false);
+#if VTK_MAJOR_VERSION > 5
+      for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++)
+        mSlicerManagers[index]->GetSlicer(i)->ForceUpdateDisplayExtent();
+#endif
   } else {
     QString error = "Cannot import the vector field for this image.\n";
     error += imageManager->GetLastError().c_str();
@@ -2334,7 +2357,7 @@ void vvMainWindow::AddField(vvImage::Pointer vf,QString file,int index)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::AddField(QString file,int index)
-{
+{ 
   if (QFile::exists(file)) {
     mInputPathName = itksys::SystemTools::GetFilenamePath(file.toStdString()).c_str();
 
@@ -2366,7 +2389,7 @@ void vvMainWindow::AddField(QString file,int index)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SetVFProperty(int subsampling, int scale, int log, int width, double r, double g, double b)
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   if (mSlicerManagers[index]->GetSlicer(0)->GetVF()) {
     for (int i = 0; i < 4; i++) {
@@ -2386,7 +2409,7 @@ void vvMainWindow::SetVFProperty(int subsampling, int scale, int log, int width,
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SetOverlayProperty(int color, int linked, double window, double level)
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   if (mSlicerManagers[index]->GetSlicer(0)->GetOverlay()) {
     mSlicerManagers[index]->SetOverlayColor(color);
@@ -2401,7 +2424,7 @@ void vvMainWindow::SetOverlayProperty(int color, int linked, double window, doub
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap,double window, double level, bool showLegend)
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   if (mSlicerManagers[index]->GetSlicer(0)->GetFusion()) {
     mSlicerManagers[index]->SetFusionColorMap(colormap);
@@ -2419,7 +2442,7 @@ void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SelectFusionSequence()
-{
+{ 
   //get the index of the slicer manager of the main sequence (CT)
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   //check if one overlay image is already associated
@@ -2451,8 +2474,8 @@ void vvMainWindow::SelectFusionSequence()
 
 
 //------------------------------------------------------------------------------
-void vvMainWindow::SelectFusionSequenceCorrespondances() {
-
+void vvMainWindow::SelectFusionSequenceCorrespondances() 
+{ 
   //make sure the index is right?
   //in the end, I should attach the temporal data to the right sequence!
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
@@ -2480,7 +2503,7 @@ void vvMainWindow::SelectFusionSequenceCorrespondances() {
   bool signalOK = true;
   unsigned nbFrameMain = mSlicerManagers[index]->GetImage()->GetTransform().size();
   unsigned nbFrameSecondary = mSlicerManagers[index]->GetFusionSequenceNbFrames();
-std::cout<<"nbFrameMain = "<<nbFrameMain<<", nbFrameSecondary= "<<nbFrameSecondary<<", signal size: "<<tmpVect.size()<<std::endl;
+  std::cout<<"nbFrameMain = "<<nbFrameMain<<", nbFrameSecondary= "<<nbFrameSecondary<<", signal size: "<<tmpVect.size()<<std::endl;
   std::vector<unsigned> temporalCorrespondances;
   if ( tmpVect.size() == nbFrameMain + nbFrameSecondary ) {
     for (unsigned i=0 ; i<tmpVect.size() ; i++) {
@@ -2516,7 +2539,7 @@ std::cout<<"nbFrameMain = "<<nbFrameMain<<", nbFrameSecondary= "<<nbFrameSeconda
 //when this function is called index is the slicer manager index corresponding to the main sequence (CT)
 //the files behind fileNames points to the data for the secondary sequence
 void vvMainWindow::AddFusionSequence(int index, std::vector<std::string> fileNames, vvImageReader::LoadedImageType type)
-{
+{ 
   QString file(fileNames[0].c_str());
   if (QFile::exists(file))
   {
@@ -2544,6 +2567,10 @@ void vvMainWindow::AddFusionSequence(int index, std::vector<std::string> fileNam
       item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
       item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("fusionSequence").c_str());
       qApp->processEvents();
+#if VTK_MAJOR_VERSION > 5
+      for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++)
+        mSlicerManagers[index]->GetSlicer(i)->ForceUpdateDisplayExtent();
+#endif
       for (int j = 1; j <= 4; j++) {
         item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole));
       }
@@ -2637,7 +2664,7 @@ void vvMainWindow::AddFusionSequence(int index, std::vector<std::string> fileNam
 //------------------------------------------------------------------------------
 //fusionSequenceFrameIndex and fusionSequenceNbFrames are relative to the secondary sequence (US)
 void vvMainWindow::SetFusionSequenceProperty(int fusionSequenceFrameIndex, bool spatialSyncFlag, unsigned int fusionSequenceNbFrames, bool temporalSyncFlag)
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
 
   if (!mSlicerManagers[index]->IsInvolvedInFusionSequence()) return;
@@ -2717,7 +2744,7 @@ void vvMainWindow::SetFusionSequenceProperty(int fusionSequenceFrameIndex, bool
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveAs()
-{
+{ 
   if (DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString() == "vector") {
     QMessageBox::warning(this,tr("Unsupported type"),tr("Sorry, saving a vector field is unsupported for the moment"));
     return;
@@ -2821,7 +2848,7 @@ void vvMainWindow::SaveAs()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveCurrentState()
-{
+{ 
   QString Extensions = "XML Files(*.xml)";
   QString fileName = QFileDialog::getSaveFileName(this,
     tr("Save Current Window State"),
@@ -2834,14 +2861,14 @@ void vvMainWindow::SaveCurrentState()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveCurrentStateAs(const std::string& stateFile)
-{
+{ 
   vvSaveState save_state;
   save_state.Run(this, stateFile);
 }
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ReadSavedState()
-{
+{ 
   QString Extensions = "XML Files(*.xml)";
   QString fileName = QFileDialog::getOpenFileName(this,
     tr("Load Window State"),
@@ -2854,7 +2881,7 @@ void vvMainWindow::ReadSavedState()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ReadSavedStateFile(const std::string& stateFile)
-{
+{ 
   vvReadState read_state;
   read_state.Run(this, stateFile);
 }
@@ -2862,13 +2889,13 @@ void vvMainWindow::ReadSavedStateFile(const std::string& stateFile)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::LinkAllImages()
-{
+{ 
   linkPanel->linkAll();
 }
 
 //------------------------------------------------------------------------------
 void vvMainWindow::AddLink(QString image1,QString image2,bool fromPanel)
-{
+{ 
   if (!fromPanel) {
     // delegate to linkPanel if call came from elsewhere...
     linkPanel->addLinkFromIds(image1, image2);
@@ -2902,7 +2929,7 @@ void vvMainWindow::AddLink(QString image1,QString image2,bool fromPanel)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::RemoveLink(QString image1,QString image2)
-{
+{ 
   for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
     if (image1.toStdString() == mSlicerManagers[i]->GetId()) {
       mSlicerManagers[i]->RemoveLink(image2.toStdString());
@@ -2916,7 +2943,7 @@ void vvMainWindow::RemoveLink(QString image1,QString image2)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset)
-{
+{ 
   if(mSlicerManagers.size()==1)
     return;
 
@@ -2932,7 +2959,7 @@ void vvMainWindow::ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, i
 }
 //------------------------------------------------------------------------------
 void vvMainWindow::HorizontalSliderMoved(int value,int column, int slicer_index)
-{
+{ 
   for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
     if (DataTree->topLevelItem(i)->data(column,Qt::CheckStateRole).toInt() > 1) {
       //i is the SlicerManager that is in charge of this slicer.
@@ -2969,7 +2996,7 @@ void vvMainWindow::HorizontalSliderMoved(int value,int column, int slicer_index)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::NOHorizontalSliderMoved()
-{
+{ 
   // if (mCurrentTime == NOHorizontalSlider->value()) return;
   HorizontalSliderMoved(NOHorizontalSlider->value(),COLUMN_UL_VIEW,0);
   //  mCurrentTime = NOHorizontalSlider->value();
@@ -2979,7 +3006,7 @@ void vvMainWindow::NOHorizontalSliderMoved()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::NEHorizontalSliderMoved()
-{
+{ 
   // if (mCurrentTime == NEHorizontalSlider->value()) return;
   HorizontalSliderMoved(NEHorizontalSlider->value(),COLUMN_UR_VIEW,1);
   //  mCurrentTime = NEHorizontalSlider->value();
@@ -2989,7 +3016,7 @@ void vvMainWindow::NEHorizontalSliderMoved()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SOHorizontalSliderMoved()
-{
+{ 
   // if (mCurrentTime == SOHorizontalSlider->value()) return;
   HorizontalSliderMoved(SOHorizontalSlider->value(),COLUMN_DL_VIEW,2);
   // mCurrentTime = SOHorizontalSlider->value();
@@ -2999,7 +3026,7 @@ void vvMainWindow::SOHorizontalSliderMoved()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SEHorizontalSliderMoved()
-{
+{ 
   // if (mCurrentTime == SEHorizontalSlider->value()) return;
   HorizontalSliderMoved(SEHorizontalSlider->value(),COLUMN_DR_VIEW,3);
   // mCurrentTime = SEHorizontalSlider->value();
@@ -3008,7 +3035,7 @@ void vvMainWindow::SEHorizontalSliderMoved()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::NOVerticalSliderChanged()
-{
+{ 
   static int value=-1;
   if (value == NOVerticalSlider->value()) return;
   else value = NOVerticalSlider->value();
@@ -3034,7 +3061,7 @@ void vvMainWindow::NOVerticalSliderChanged()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::NEVerticalSliderChanged()
-{
+{ 
   static int value=-1;
   if (value == NEVerticalSlider->value()) return;
   else value = NEVerticalSlider->value();
@@ -3056,7 +3083,7 @@ void vvMainWindow::NEVerticalSliderChanged()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SOVerticalSliderChanged()
-{
+{ 
   static int value=-1;
   if (value == SOVerticalSlider->value()) return;
   else value = SOVerticalSlider->value();
@@ -3079,7 +3106,7 @@ void vvMainWindow::SOVerticalSliderChanged()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SEVerticalSliderChanged()
-{
+{ 
   static int value=-1;
   if (value == SEVerticalSlider->value()) return;
   else value = SEVerticalSlider->value();
@@ -3101,7 +3128,7 @@ void vvMainWindow::SEVerticalSliderChanged()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateSlice(int slicer, int slice)
-{
+{ 
   // DD("vvMainWindow::UpdateSlice");
   //   DD(slicer);
   //   DD(slice);
@@ -3127,7 +3154,7 @@ void vvMainWindow::UpdateSlice(int slicer, int slice)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateTSlice(int slicer, int slice, int code)
-{
+{ 
   //FusionSequence: the slider value should be updated for slicers which show the same sequence as requested
   bool doUpdate=false;
   if (code==-1) doUpdate=true;
@@ -3166,7 +3193,7 @@ void vvMainWindow::UpdateTSlice(int slicer, int slice, int code)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax)
-{
+{ 
   //int position = int((min+max)/2);
   int position = mSlicerManagers[mCurrentPickedImageIndex]->GetSlicer(slicer)->GetSlice();
   if (slicer == 0) {
@@ -3192,7 +3219,7 @@ void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveNOScreenshot()
-{
+{ 
   SaveScreenshot(NOViewWidget);
 }
 //------------------------------------------------------------------------------
@@ -3200,7 +3227,7 @@ void vvMainWindow::SaveNOScreenshot()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveNEScreenshot()
-{
+{ 
   SaveScreenshot(NEViewWidget);
 }
 //------------------------------------------------------------------------------
@@ -3208,7 +3235,7 @@ void vvMainWindow::SaveNEScreenshot()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveSOScreenshot()
-{
+{ 
   SaveScreenshot(SOViewWidget);
 }
 //------------------------------------------------------------------------------
@@ -3216,7 +3243,7 @@ void vvMainWindow::SaveSOScreenshot()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveSEScreenshot()
-{
+{ 
   SaveScreenshot(SEViewWidget);
 }
 //------------------------------------------------------------------------------
@@ -3224,7 +3251,7 @@ void vvMainWindow::SaveSEScreenshot()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveScreenshotAllSlices()
-{
+{ 
   QVTKWidget *widget = NOViewWidget;
 
   int index = 0;// GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
@@ -3265,7 +3292,11 @@ void vvMainWindow::SaveScreenshotAllSlices()
     fn = itksys::SystemTools::GetFilenamePath(filename.toStdString()) + "/"+ fn
       + "_" + num + itksys::SystemTools::GetFilenameLastExtension(filename.toStdString());
     writer->SetFileName(fn.c_str());
+#if VTK_MAJOR_VERSION <= 5
     writer->SetInput(windowToImageFilter->GetOutput());
+#else
+    writer->SetInputConnection(windowToImageFilter->GetOutputPort());
+#endif
     writer->Write();
   }
 }
@@ -3274,7 +3305,7 @@ void vvMainWindow::SaveScreenshotAllSlices()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
-{
+{ 
   QString Extensions = "Images( *.png);;";
   Extensions += "Images( *.jpg);;";
   Extensions += "Images( *.bmp);;";
@@ -3319,7 +3350,11 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
 
     // Snapshot image if not null
     if(imgwriter!=NULL) {
+#if VTK_MAJOR_VERSION <= 5
       imgwriter->SetInput(image);
+#else
+      imgwriter->SetInputConnection(w2i->GetOutputPort());
+#endif
       imgwriter->SetFileName(fileName.toStdString().c_str());
       imgwriter->Write();
       return;
@@ -3334,13 +3369,13 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
 
       // FPS
       bool ok;
-      int fps = QInputDialog::getInteger(this, tr("Number of frames per second"),
+      int fps = QInputDialog::getInt(this, tr("Number of frames per second"),
         tr("FPS:"), 5, 0, 1000, 1, &ok);
       if(ok)
         gif->SetRate(fps);
 
       // Loops
-      int loops = QInputDialog::getInteger(this, tr("Loops"),
+      int loops = QInputDialog::getInt(this, tr("Loops"),
         tr("Number of loops (0 means infinite):"), 0, 0, 1000000000, 1, &ok);
       if(ok)
         gif->SetLoops(loops);
@@ -3389,7 +3424,11 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
 
     // Take video if not null
     if(vidwriter!=NULL){
+#if VTK_MAJOR_VERSION <= 5
       vidwriter->SetInput(image);
+#else
+      vidwriter->SetInputConnection(w2i->GetOutputPort());
+#endif
       vidwriter->SetFileName(fileName.toStdString().c_str());
       vidwriter->Start();
       int nSlice = mSlicerManagers[smIndex]->GetSlicer(0)->GetTMax();
@@ -3398,7 +3437,11 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
         vtkSmartPointer<vtkWindowToImageFilter> w2i = vtkSmartPointer<vtkWindowToImageFilter>::New();
         w2i->SetInput(widget->GetRenderWindow());
         w2i->Update();
+#if VTK_MAJOR_VERSION <= 5
         vidwriter->SetInput(w2i->GetOutput());
+#else
+        vidwriter->SetInputConnection(w2i->GetOutputPort());
+#endif
         vidwriter->Write();
       }
       vidwriter->End();
@@ -3414,7 +3457,7 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
 
 //------------------------------------------------------------------------------
 void vvMainWindow::GoToCursor()
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   for (int column = 1; column < 5; column++) {
     if (DataTree->selectedItems()[0]->data(column,Qt::CheckStateRole).toInt() > 1) {
@@ -3431,7 +3474,7 @@ void vvMainWindow::GoToCursor()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::GoToLandmark()
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   for (int column = 1; column < 5; column++) {
     if (DataTree->selectedItems()[0]->data(column,Qt::CheckStateRole).toInt() > 1) {
@@ -3448,7 +3491,7 @@ void vvMainWindow::GoToLandmark()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::PlayPause()
-{
+{ 
   if (playMode) {
     playMode = 0;
     playButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/player_play.png")));
@@ -3473,7 +3516,7 @@ void vvMainWindow::PlayPause()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::PlayNext()
-{
+{ 
   if (playMode && !this->isHidden()) {
     int image_number=DataTree->topLevelItemCount();
     ///Only play one slicer per SM, and only if the SM is being displayed
@@ -3490,23 +3533,24 @@ void vvMainWindow::PlayNext()
 //------------------------------------------------------------------------------
 
 void vvMainWindow::ShowLastImage()
-{
+{ 
   if (mSlicerManagers.size() > 1) {
     QTreeWidgetItem * item=DataTree->topLevelItem(DataTree->topLevelItemCount()-1);
     CurrentImageChanged(mSlicerManagers.back()->GetId()); //select new image
     item->setData(1,Qt::CheckStateRole,2); //show the new image in the first panel
+    //mSlicerManagers[GetSlicerIndexFromItem(item)]->GetSlicer(0)->SetActorVisibility("image", 0, 1); //Set the Last Image visibles
     DisplayChanged(item,1);
   }
 }
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateRenderWindows()
-{
+{ 
   for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
-    mSlicerManagers[i]->GetSlicer(0)->UpdateLandmarks();
-    mSlicerManagers[i]->GetSlicer(1)->UpdateLandmarks();
-    mSlicerManagers[i]->GetSlicer(2)->UpdateLandmarks();
-    mSlicerManagers[i]->GetSlicer(3)->UpdateLandmarks();
+      for (unsigned int j = 0; j < 4; ++j) {
+        mSlicerManagers[i]->GetSlicer(j)->RemoveLandmarks();
+        mSlicerManagers[i]->GetSlicer(j)->DisplayLandmarks();
+      }
   }
   if (NOViewWidget->GetRenderWindow()) NOViewWidget->GetRenderWindow()->Render();
   if (NEViewWidget->GetRenderWindow()) NEViewWidget->GetRenderWindow()->Render();
@@ -3517,7 +3561,7 @@ void vvMainWindow::UpdateRenderWindows()
 
 //------------------------------------------------------------------------------
 void vvMainWindow::SegmentationOnCurrentImage()
-{
+{ 
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
 
   vvSegmentationDialog segmentation;
@@ -3527,7 +3571,7 @@ void vvMainWindow::SegmentationOnCurrentImage()
 //------------------------------------------------------------------------------
 
 void vvMainWindow::SurfaceViewerLaunch()
-{
+{ 
   vvSurfaceViewerDialog surfaceViewer;
   surfaceViewer.exec();
 }
@@ -3536,7 +3580,7 @@ void vvMainWindow::SurfaceViewerLaunch()
 
 //------------------------------------------------------------------------------
 int vvMainWindow::GetImageDuplicateFilenameNumber(std::string filename)
-{
+{ 
   int number=0;
   for(unsigned int l=0; l<mSlicerManagers.size(); l++) {
     vvSlicerManager * v = mSlicerManagers[l];
@@ -3552,7 +3596,7 @@ int vvMainWindow::GetImageDuplicateFilenameNumber(std::string filename)
 
 //------------------------------------------------------------------------------
 vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filename)
-{
+{ 
   // Change filename if another image exist with the same name
   int number = GetImageDuplicateFilenameNumber(filename);
 
@@ -3634,13 +3678,13 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen
   connect(mSlicerManagers.back(), SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
 
 
+
+  InitSlicers();
   UpdateTree();
   qApp->processEvents();
-  InitSlicers();
-  ShowLastImage();
   InitDisplay();
+  ShowLastImage();
   qApp->processEvents();
-
   // End
   ImageInfoChanged();
   return slicer_manager;
@@ -3650,7 +3694,7 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen
 
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateCurrentSlicer()
-{
+{ 
   int index = -1;
   if (DataTree->selectedItems().size() > 0) {
     index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
index 5b11d48e2d65e1a0bc8a9edb52384127a7e4c55d..e7045f58d84a19889f0f8abd97a4698587b237bb 100644 (file)
@@ -31,6 +31,7 @@
 #include <itksys/SystemTools.hxx>
 
 // vtk
+#include <vtkVersion.h>
 #include <vtkSmartPointer.h>
 #include <vtkFloatArray.h>
 #include <vtkPointData.h>
@@ -135,6 +136,7 @@ void vvMesh::ComputeMasks(vtkImageData* sample,bool extrude)
     double *bounds=mesh->GetBounds();
 
     vtkSmartPointer<vtkImageData> binary_image=vtkSmartPointer<vtkImageData>::New();
+#if VTK_MAJOR_VERSION <= 5
     binary_image->SetScalarTypeToUnsignedChar();
     ///Use the smallest mask in which the mesh fits
     // Add two voxels on each side to make sure the mesh fits
@@ -151,6 +153,23 @@ void vvMesh::ComputeMasks(vtkImageData* sample,bool extrude)
                             0,ceil((bounds[3]-origin[1])/spacing[1]+4),
                             0,ceil((bounds[5]-origin[2])/spacing[2])+4);
     binary_image->AllocateScalars();
+#else
+    ///Use the smallest mask in which the mesh fits
+    // Add two voxels on each side to make sure the mesh fits
+    double * samp_origin=sample->GetOrigin();
+    double * spacing=sample->GetSpacing();
+    binary_image->SetSpacing(spacing);
+
+    /// Put the origin on a voxel to avoid small skips
+    binary_image->SetOrigin(floor((bounds[0]-samp_origin[0])/spacing[0]-2)*spacing[0]+samp_origin[0],
+                            floor((bounds[2]-samp_origin[1])/spacing[1]-2)*spacing[1]+samp_origin[1],
+                            floor((bounds[4]-samp_origin[2])/spacing[2]-2)*spacing[2]+samp_origin[2]);
+    double * origin=binary_image->GetOrigin();
+    binary_image->SetExtent(0,ceil((bounds[1]-origin[0])/spacing[0]+4),
+                            0,ceil((bounds[3]-origin[1])/spacing[1]+4),
+                            0,ceil((bounds[5]-origin[2])/spacing[2])+4);
+    binary_image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);
+#endif
     memset(binary_image->GetScalarPointer(),0,binary_image->GetDimensions()[0]*binary_image->GetDimensions()[1]*binary_image->GetDimensions()[2]*sizeof(unsigned char));
 
 
@@ -162,16 +181,34 @@ void vvMesh::ComputeMasks(vtkImageData* sample,bool extrude)
 
     if (extrude) {
       vtkSmartPointer<vtkLinearExtrusionFilter> extrude=vtkSmartPointer<vtkLinearExtrusionFilter>::New();
+#if VTK_MAJOR_VERSION <= 5
       extrude->SetInput(mesh);
+#else
+      extrude->SetInputData(mesh);
+#endif
       ///We extrude in the -slice_spacing direction to respect the FOCAL convention
       extrude->SetVector(0, 0, -slice_spacing);
+#if VTK_MAJOR_VERSION <= 5
       sts->SetInput(extrude->GetOutput());
-    } else
+#else
+      sts->SetInputConnection(extrude->GetOutputPort());
+#endif
+    } else {
+#if VTK_MAJOR_VERSION <= 5
       sts->SetInput(mesh);
+#else
+      sts->SetInputData(mesh);
+#endif
+   }
 
     vtkSmartPointer<vtkImageStencil> stencil=vtkSmartPointer<vtkImageStencil>::New();
+#if VTK_MAJOR_VERSION <= 5
     stencil->SetStencil(sts->GetOutput());
     stencil->SetInput(binary_image);
+#else
+    stencil->SetStencilData(sts->GetOutput());
+    stencil->SetInputData(binary_image);
+#endif
     stencil->Update();
     this->AddMask(stencil->GetOutput());
 
@@ -189,7 +226,11 @@ void vvMesh::ComputeMeshes()
   this->RemoveMeshes();
   for (std::vector<vtkImageData*>::iterator i=masks.begin(); i!=masks.end(); i++) {
     vtkSmartPointer<vtkMarchingCubes> marching = vtkSmartPointer<vtkMarchingCubes>::New();
+#if VTK_MAJOR_VERSION <= 5
     marching->SetInput(*i);
+#else
+    marching->SetInputData(*i);
+#endif
     marching->SetValue(0,0.5);
     marching->Update();
     this->AddMesh(marching->GetOutput());
index 4ace9bb389239a1956477d035e51a8b7e8b48c95..d8741aa5448cbc1e5cff6b5b4962267d3df0ba6d 100644 (file)
@@ -17,6 +17,7 @@
 ===========================================================================**/
 #include "vvMeshActor.h"
 #include "clitkCommon.h"
+#include <vtkVersion.h>
 #include <vtkPolyDataMapper.h>
 #include <vtkMarchingSquares.h>
 #include <vtkImageData.h>
@@ -45,15 +46,28 @@ void vvMeshActor::Init(vvMesh::Pointer mesh,int time_slice,vvImage::Pointer vf)
 
   mMarching=vtkMarchingSquares::New();
   mTimeSlice=time_slice;
-  if (static_cast<unsigned int>(time_slice)<mMesh->GetNumberOfMeshes())
+  if (static_cast<unsigned int>(time_slice)<mMesh->GetNumberOfMeshes()) {
+#if VTK_MAJOR_VERSION <= 5
     mMarching->SetInput(mMesh->GetMask(time_slice));
-  else
+#else
+    mMarching->SetInputData(mMesh->GetMask(time_slice));
+#endif
+  } else {
+#if VTK_MAJOR_VERSION <= 5
     mMarching->SetInput(mMesh->GetMask(0));
+#else
+    mMarching->SetInputData(mMesh->GetMask(0));
+#endif
+  }
   mMarching->SetValue(0,0.5);
   //mMarching->Update();
 
   mMapper=vtkPolyDataMapper::New();
+#if VTK_MAJOR_VERSION <= 5
   mMapper->SetInput(mMarching->GetOutput());
+#else
+  mMapper->SetInputConnection(mMarching->GetOutputPort());
+#endif
   //The following line allows to display the contour over the image
   //(http://www.nabble.com/What-happens-when-two-actors-are-at-the-same-depth--td23175458.html)
   vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
@@ -96,10 +110,19 @@ void vvMeshActor::SetCutSlice(double slice)
 void vvMeshActor::SetTimeSlice(int time)
 {
   mTimeSlice=time;
-  if (static_cast<unsigned int>(time)<mMesh->GetNumberOfMasks())
+  if (static_cast<unsigned int>(time)<mMesh->GetNumberOfMasks()) {
+#if VTK_MAJOR_VERSION <= 5
     mMarching->SetInput(mMesh->GetMask(time));
-  else
+#else
+    mMarching->SetInputData(mMesh->GetMask(time));
+#endif
+  } else {
+#if VTK_MAJOR_VERSION <= 5
     mMarching->SetInput(mMesh->GetMask(0));
+#else
+    mMarching->SetInputData(mMesh->GetMask(0));
+#endif
+ }
   SetCutSlice(mCutSlice); //We need to find the new mask cut slice,
   //since masks do not all have the same origin
 }
index d03b0ac29c69013051926ae048ddebaa51deb1ca..75afc697748c1677316d434ac4beb700efb47a3c 100644 (file)
@@ -34,6 +34,7 @@
 #endif
 
 // vtk
+#include <vtkVersion.h>
 #include <vtkSmartPointer.h>
 #include <vtkAppendPolyData.h>
 #include <vtkCellArray.h>
@@ -297,7 +298,11 @@ std::vector<vvMesh::Pointer> vvMeshReader::readSelectedContours()
                       ids[1] = (ids[0] + 1) % tpoint_number.GetValue(); //0-1,1-2,...,n-1-0
                       contour->GetLines()->InsertNextCell(2, ids);
                     }
+#if VTK_MAJOR_VERSION <= 5
                   append->AddInput(contour);
+#else
+                  append->AddInputData(contour);
+#endif
                 }
               else
                 if (contour_type == "POINT ")
diff --git a/vv/vvOSXHelper.h b/vv/vvOSXHelper.h
new file mode 100644 (file)
index 0000000..2d9f296
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef _OSX_HELPER_
+#define _OSX_HELPER_
+
+// For retina displays, see
+// http://public.kitware.com/pipermail/vtkusers/2015-February/090117.html
+void disableGLHiDPI( long a_id );
+
+#endif
+
diff --git a/vv/vvOSXHelper.mm b/vv/vvOSXHelper.mm
new file mode 100644 (file)
index 0000000..20898a2
--- /dev/null
@@ -0,0 +1,10 @@
+#include <Cocoa/Cocoa.h>
+#include "vvOSXHelper.h"
+
+// For retina displays, see
+// http://public.kitware.com/pipermail/vtkusers/2015-February/090117.html
+void disableGLHiDPI( long a_id ){
+ NSView *view = reinterpret_cast<NSView*>( a_id );
+ [view setWantsBestResolutionOpenGLSurface:NO];
+}
+
index c1f821516be03f05f697cf00925bbf5040f5d5aa..44850bb158aadbd504b4d2edd3c033023e1d2ec5 100644 (file)
@@ -94,8 +94,12 @@ void vvDicomSeriesSelector::close()
 void vvDicomSeriesSelector::BrowseButtonRelease()
 {
   QFileDialog dialog(this);
+  QStringList filters;
+  filters << "DICOM files (*.dcm)"
+          << "All files (*)";
   dialog.setFileMode(QFileDialog::AnyFile);
-  dialog.setFilter("DICOM files (*.dcm); All files (*)");
+  dialog.setNameFilters(filters);
+  //dialog.setFilter(tr("DICOM files (*.dcm); All files (*)"));
   mFoldername = dialog.getExistingDirectory(this,
                 "Select a folder to find DICOM image",
                 mPreviousPath);
index 74d588328865cdfa27ca192a0d44daf5cdcb7a3d..9755e78fba73c28eb69fed3d5a120e79a64a25f8 100644 (file)
@@ -32,7 +32,7 @@
 
 //------------------------------------------------------------------------------
 vvROIActor::vvROIActor()
-{
+{ 
   mIsVisible = true;
   mIsContourVisible = false;
   mOpacity = 0.5;
@@ -52,14 +52,14 @@ vvROIActor::vvROIActor()
 
 //------------------------------------------------------------------------------
 vvROIActor::~vvROIActor()
-{
+{ 
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvROIActor::RemoveActors()
-{
+{ 
   for(unsigned int i= 0; i<mOverlayActors.size(); i++) {
     mOverlayActors[i]->RemoveActors();
   }
@@ -69,29 +69,31 @@ void vvROIActor::RemoveActors()
   }  
   
   Update(true);
-  mImageContour.clear();
-  mOverlayActors.clear();
+  //mImageContour.clear();
+  //mOverlayActors.clear();
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetROI(clitk::DicomRT_ROI * s)
-{
+{ 
   mROI = s;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetContourWidth(int n) {
+void vvROIActor::SetContourWidth(int n) 
+{ 
   mContourWidth = n;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetSlicerManager(vvSlicerManager * s) {
+void vvROIActor::SetSlicerManager(vvSlicerManager * s) 
+{ 
   mSlicerManager = s;
 }
 //------------------------------------------------------------------------------
@@ -99,7 +101,7 @@ void vvROIActor::SetSlicerManager(vvSlicerManager * s) {
 
 //------------------------------------------------------------------------------
 void vvROIActor::UpdateImage()
-{
+{ 
   mOverlayActors.clear();
   mImageContour.clear();
   Initialize(mDepth, mIsVisible);
@@ -110,7 +112,7 @@ void vvROIActor::UpdateImage()
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetVisible(bool b)
-{
+{ 
   mIsVisible = b;
   if (!b) { // remove actor
     for(unsigned int i= 0; i<mOverlayActors.size(); i++)
@@ -125,7 +127,8 @@ void vvROIActor::SetVisible(bool b)
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetContourVisible(bool b) {
+void vvROIActor::SetContourVisible(bool b) 
+{ 
   mIsContourVisible = b;
   if (!b) { // remove actor
     for(unsigned int i= 0; i<mImageContour.size(); i++) {
@@ -143,21 +146,24 @@ void vvROIActor::SetContourVisible(bool b) {
 
 
 //------------------------------------------------------------------------------
-bool vvROIActor::IsVisible() {
+bool vvROIActor::IsVisible() 
+{ 
   return mIsVisible;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-bool vvROIActor::IsContourVisible() {
+bool vvROIActor::IsContourVisible() 
+{ 
   return mIsContourVisible;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::Initialize(double depth, bool IsVisible) {
+void vvROIActor::Initialize(double depth, bool IsVisible) 
+{ 
   if (mROI->GetImage()) {
     mImageContour.clear();
     mOverlayActors.clear();
@@ -174,7 +180,7 @@ void vvROIActor::Initialize(double depth, bool IsVisible) {
       mImageContour[i]->SetLineWidth(mContourWidth);
       mImageContour[i]->SetPreserveMemoryModeEnabled(true);
       mImageContour[i]->SetDepth(mDepth+0.5);
-      mImageContour[i]->HideActors();
+      mImageContour[i]->ShowActors();
       
       mOverlayActors.push_back(vvBinaryImageOverlayActor::New());
 
@@ -195,7 +201,6 @@ void vvROIActor::Initialize(double depth, bool IsVisible) {
       mOverlayActors[i]->Initialize(IsVisible);      
       mOverlayActors[i]->SetDepth(mDepth);
     }
-
     connect(mSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
     //connect(mSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
     connect(mSlicerManager, SIGNAL(AVerticalSliderHasChanged(int, int)), SLOT(UpdateSlice(int, int)));
@@ -206,7 +211,7 @@ void vvROIActor::Initialize(double depth, bool IsVisible) {
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetDepth(double d)
-{
+{ 
   mDepth = d;
   if (!mSlicerManager) return;
   for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {  
@@ -220,7 +225,7 @@ void vvROIActor::SetDepth(double d)
 
 //------------------------------------------------------------------------------
 void vvROIActor::Update(bool force)
-{
+{ 
   if (!mSlicerManager) return;
   for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
     UpdateSlice(i, mSlicerManager->GetSlicer(i)->GetSlice(), force);
@@ -231,7 +236,7 @@ void vvROIActor::Update(bool force)
 
 //------------------------------------------------------------------------------
 void vvROIActor::UpdateSlice(int slicer, int slices, bool force)
-{
+{ 
   if (!mROI->GetImage())  return;
   if ((!mIsVisible) && (!mIsContourVisible)) return; 
   if (!mSlicerManager) {
@@ -251,14 +256,15 @@ void vvROIActor::UpdateSlice(int slicer, int slices, bool force)
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetOpacity(double d)
-{
+{ 
   mOpacity = d;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetContourColor(double r, double v, double b) {
+void vvROIActor::SetContourColor(double r, double v, double b) 
+{ 
   mContourColor[0] = r;
   mContourColor[1] = v;
   mContourColor[2] = b;  
@@ -267,7 +273,8 @@ void vvROIActor::SetContourColor(double r, double v, double b) {
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetOverlayColor(double r, double v, double b) {
+void vvROIActor::SetOverlayColor(double r, double v, double b) 
+{ 
   if (mROI)
     mROI->SetDisplayColor(r,v,b);
 }
@@ -275,21 +282,24 @@ void vvROIActor::SetOverlayColor(double r, double v, double b) {
 
 
 //------------------------------------------------------------------------------
-std::vector<double> & vvROIActor::GetContourColor() { 
+std::vector<double> & vvROIActor::GetContourColor() 
+{ 
   return mContourColor; 
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-std::vector<double> & vvROIActor::GetOverlayColor() { 
+std::vector<double> & vvROIActor::GetOverlayColor() 
+{ 
   return mROI->GetDisplayColor();
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::UpdateColor() {
+void vvROIActor::UpdateColor() 
+{ 
   for(unsigned int i=0; i<mOverlayActors.size(); i++) {
     mOverlayActors[i]->SetOpacity(mOpacity);
     mOverlayActors[i]->SetColor(mROI->GetDisplayColor()[0],
@@ -309,7 +319,7 @@ void vvROIActor::UpdateColor() {
 
 //------------------------------------------------------------------------------
 double vvROIActor::GetOpacity()
-{
+{ 
   return mOpacity;
 }
 //------------------------------------------------------------------------------
@@ -317,7 +327,7 @@ double vvROIActor::GetOpacity()
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetSelected(bool b)
-{
+{ 
   mIsSelected = b;
   if (b) {
     for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
@@ -335,7 +345,7 @@ void vvROIActor::SetSelected(bool b)
 
 //------------------------------------------------------------------------------
 void vvROIActor::CopyParameters(QSharedPointer<vvROIActor> roi)
-{
+{ 
   // Overlay
   SetVisible(roi->IsVisible());
   SetOpacity(roi->GetOpacity());
index 112330aca32513e1d9e373f397f4d85738c665ac..2d6057e9e9bed82217ec327ad3a70607589234c0 100644 (file)
@@ -20,6 +20,9 @@
 #include "vvRegisterForm.h"
 #include <QNetworkRequest>
 #include <QDir>
+#if QT_VERSION >= 0x050000
+#include <QUrlQuery>
+#endif
 #include <QPalette>
 #include "clitkConfiguration.h"
 #include "vvConfiguration.h"
@@ -33,6 +36,8 @@ vvRegisterForm::vvRegisterForm(QUrl url, QString path, QSettings::Format format)
 
 void vvRegisterForm::sendData(){
   QUrl url2(url);
+  
+#if QT_VERSION < 0x050000
   url2.addQueryItem("name", firstName->text().toUtf8());
   url2.addQueryItem("lastName", lastName->text().toUtf8());
   url2.addQueryItem("email", email->text().toUtf8());
@@ -42,7 +47,21 @@ void vvRegisterForm::sendData(){
   url2.addQueryItem("architecture", ARCHITECTURE);
   url2.addQueryItem("adressing", QString::number(sizeof(char*)*8)+"-bit");
   url2.addQueryItem("compilationDate", QString(__DATE__) + ", " + QString(__TIME__) );
-
+#else
+  QUrlQuery url2Query;
+    
+  url2Query.addQueryItem("name", firstName->text().toUtf8());
+  url2Query.addQueryItem("lastName", lastName->text().toUtf8());
+  url2Query.addQueryItem("email", email->text().toUtf8());
+  url2Query.addQueryItem("group", group->text().toUtf8());
+  url2Query.addQueryItem("os", OS_NAME);
+  url2Query.addQueryItem("vvVersion", VV_VERSION);
+  url2Query.addQueryItem("architecture", ARCHITECTURE);
+  url2Query.addQueryItem("adressing", QString::number(sizeof(char*)*8)+"-bit");
+  url2Query.addQueryItem("compilationDate", QString(__DATE__) + ", " + QString(__TIME__) );
+  url2.setQuery(url2Query);
+#endif
+  
   manager->get(QNetworkRequest(url2));
 }
 void vvRegisterForm::accept(){
index 888375eefbb2449001e80dd5300998298e421894..d4bea5baa088d8728298f9c364b995859710fa0f 100644 (file)
@@ -27,6 +27,9 @@
 #include "vvInteractorStyleNavigator.h"
 #include "vvSlicer.h"
 
+#include <vtkVersion.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkInformation.h>
 #include "vtkMarchingCubes.h"
 #include "vtkMarchingSquares.h"
 #include "vtkImageClip.h"
@@ -56,6 +59,7 @@
 #include <vtkPolyDataWriter.h>
 
 #include <QMessageBox>
+#include <QFileDialog>
 
 //====================================================================
 vvSegmentationDialog::vvSegmentationDialog(QWidget * parent, Qt::WindowFlags f)
@@ -188,14 +192,27 @@ void vvSegmentationDialog::SetImage(vvImage::Pointer image)
   clipping1Slider->setValue(range[0]);
   clipping2Slider->setValue(range[1]);
 
+#if VTK_MAJOR_VERSION <= 5
   mClipper->SetInput(mManager->GetSlicer(0)->GetInput());
+#else
+  mClipper->SetInputData(mManager->GetSlicer(0)->GetInput());
+#endif
   mSquares1->SetValue(0,clipping1Slider->value());
   mSquares2->SetValue(0,clipping2Slider->value());
+
+#if VTK_MAJOR_VERSION <= 5
   mSquares1->SetInput(mClipper->GetOutput());
   mSquares2->SetInput(mClipper->GetOutput());
 
   mSquaresMapper1->SetInput(mSquares1->GetOutput());
   mSquaresMapper2->SetInput(mSquares2->GetOutput());
+#else
+  mSquares1->SetInputData(mClipper->GetOutput());
+  mSquares2->SetInputData(mClipper->GetOutput());
+
+  mSquaresMapper1->SetInputData(mSquares1->GetOutput());
+  mSquaresMapper2->SetInputData(mSquares2->GetOutput());
+#endif
   mSquaresMapper1->ScalarVisibilityOff();
   mSquaresMapper2->ScalarVisibilityOff();
 
@@ -225,7 +242,11 @@ void vvSegmentationDialog::UpdateSlice(int slicer,int slices)
 {
   int slice = mManager->GetSlicer(0)->GetSlice();
   int tslice = mManager->GetSlicer(0)->GetTSlice();
+#if VTK_MAJOR_VERSION <= 5
   mClipper->SetInput(mManager->GetSlicer(0)->GetInput());
+#else
+  mClipper->SetInputData(mManager->GetSlicer(0)->GetInput());
+#endif
   int* extent = mManager->GetSlicer(0)->GetImageActor()->GetDisplayExtent();
   mClipper->SetOutputWholeExtent(extent[0],extent[1],extent[2],extent[3],extent[4],extent[5]);
   int i;
@@ -320,7 +341,11 @@ void vvSegmentationDialog::BinariseSurface()
   for (unsigned int numImage = 0; numImage < mManager->GetSlicer(0)->GetImage()->GetVTKImages().size(); numImage++) {
     vtkImageData* image = mManager->GetSlicer(0)->GetImage()->GetVTKImages()[numImage];
     int ext[6];
+#if VTK_MAJOR_VERSION <= 5
     image->GetWholeExtent(ext);
+#else
+    image->GetExtent(ext);
+#endif
     void *in1Ptr;
     in1Ptr = image->GetScalarPointerForExtent(ext);
 
@@ -337,17 +362,34 @@ void vvSegmentationDialog::BinariseSurface()
     outputImage->SetExtent(ext);
     outputImage->SetOrigin(image->GetOrigin());
     outputImage->SetSpacing(image->GetSpacing());
+#if VTK_MAJOR_VERSION <= 5
     outputImage->SetScalarTypeToUnsignedChar();
+#else
+    outputImage->AllocateScalars(VTK_UNSIGNED_CHAR, 1);
+#endif
     outputImage->CopyAndCastFrom(image,ext);
+#if VTK_MAJOR_VERSION <= 5
     outputImage->Update();
+#else
+    //outputImage->Update();
+#endif
 
     image->DeepCopy(outputImage);
+#if VTK_MAJOR_VERSION <= 5
     image->UpdateInformation();
     image->PropagateUpdateExtent();
+#else
+    //image->UpdateInformation();
+    //image->PropagateUpdateExtent();
+#endif
 
     vtkImageData* imageBin = vtkImageData::New();
     imageBin->DeepCopy(image);
+#if VTK_MAJOR_VERSION <= 5
     imageBin->Update();
+#else
+    //imageBin->Update();
+#endif
     mBinaireImages.push_back(imageBin);
   }
 
@@ -366,10 +408,19 @@ void vvSegmentationDialog::Erode()
   erode->SetKernelSize(mKernelValue,mKernelValue,mKernelValue);
   for (unsigned int numImage = 0; numImage < mManager->GetSlicer(0)->GetImage()->GetVTKImages().size(); numImage++) {
     vtkImageData* image = mManager->GetSlicer(0)->GetImage()->GetVTKImages()[numImage];
+#if VTK_MAJOR_VERSION <= 5
     erode->SetInput(image);
     erode->Update();
+#else
+    erode->SetInputData(image);
+    //erode->Update();
+#endif
     image->DeepCopy(erode->GetOutput());
+#if VTK_MAJOR_VERSION <= 5
     image->Update();
+#else
+    //image->Update();
+#endif
   }
   erode->Delete();
   dilateButton->setEnabled(1);
@@ -386,13 +437,26 @@ void vvSegmentationDialog::Dilate()
   dilate->SetKernelSize(mKernelValue,mKernelValue,mKernelValue);
   for (unsigned int numImage = 0; numImage < mManager->GetSlicer(0)->GetImage()->GetVTKImages().size(); numImage++) {
     vtkImageData* image = mManager->GetSlicer(0)->GetImage()->GetVTKImages()[numImage];
+#if VTK_MAJOR_VERSION <= 5
     dilate->SetInput(image);
+#else
+    dilate->SetInputData(image);
+#endif
     vtkImageData* mask = mBinaireImages[numImage];
+#if VTK_MAJOR_VERSION <= 5
     And->SetInput1(dilate->GetOutput());
     And->SetInput2(mask);
+#else
+    And->SetInput1Data(dilate->GetOutput());
+    And->SetInput2Data(mask);
+#endif
     And->Update();
     image->DeepCopy(And->GetOutput());
+#if VTK_MAJOR_VERSION <= 5
     image->Update();
+#else
+    //image->Update();
+#endif
   }
   And->Delete();
   dilate->Delete();
@@ -425,10 +489,18 @@ void vvSegmentationDialog::InsertSeed()
 
   for (unsigned int numImage = 0; numImage < mManager->GetSlicer(0)->GetImage()->GetVTKImages().size(); numImage++) {
     vtkImageData* image = mManager->GetSlicer(0)->GetImage()->GetVTKImages()[numImage];
+#if VTK_MAJOR_VERSION <= 5
     seed->SetInput(image);
+#else
+    seed->SetInputData(image);
+#endif
     seed->Update();
     image->DeepCopy(seed->GetOutput());
+#if VTK_MAJOR_VERSION <= 5
     image->Update();
+#else
+    //image->Update();
+#endif
   }
 
   seed->Delete();
@@ -444,11 +516,19 @@ void vvSegmentationDialog::ChangeDimRendering()
       m3DExtractor->SetValue(0,0.5);
       for (unsigned int numImage = 0; numImage < mManager->GetSlicer(0)->GetImage()->GetVTKImages().size(); numImage++) {
         vtkActor* actor = vtkActor::New();
+#if VTK_MAJOR_VERSION <= 5
         m3DExtractor->SetInput(mManager->GetSlicer(0)->GetImage()->GetVTKImages()[numImage]);
+#else
+        m3DExtractor->SetInputData(mManager->GetSlicer(0)->GetImage()->GetVTKImages()[numImage]);
+#endif
         m3DExtractor->Update();
 
         vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
+#if VTK_MAJOR_VERSION <= 5
         mapper->SetInput(m3DExtractor->GetOutput());
+#else
+        mapper->SetInputData(m3DExtractor->GetOutput());
+#endif
         m3DMappers.push_back(mapper);
 
         actor->SetMapper(mapper);
@@ -503,7 +583,11 @@ void vvSegmentationDialog::Save()
                        "Mesh Files (*.vtk *.vtp)");
     if (!fileName.isEmpty()) {
       vtkSmartPointer<vtkPolyDataWriter> w = vtkSmartPointer<vtkPolyDataWriter>::New();
+#if VTK_MAJOR_VERSION <= 5
       w->SetInput(m3DExtractor->GetOutput());
+#else
+      w->SetInputData(m3DExtractor->GetOutput());
+#endif
       w->SetFileName(fileName.toStdString().c_str());
       w->Write();
     }
index a3af4a39575b6be2efc1034649a8108b43099ae0..cf248d929f97a01d303f28c041de96c4bbb24878 100644 (file)
 #include "vtkPolyData.h"
 #include <vtkPolyDataMapper.h>
 
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include <QTreeWidget>
 
 //====================================================================
index dd585636c5a76227817ec14cc8ded56fd548f132..48422cbcac9f0ed33998157702e773b1a6921ba9 100644 (file)
 #include "vvGlyphSource.h"
 #include "vvGlyph2D.h"
 
+#include <vtkVersion.h>
+#include <vtkExtentTranslator.h>
+#include <vtkAlgorithm.h>
+#include <vtkExecutive.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkInformation.h>
 #include <vtkTextProperty.h>
 #include <vtkTextActor.h>
 #include <vtkTextSource.h>
 #include <vtkAssignAttribute.h>
 #include <vtkImageAccumulate.h>
 #include <vtkImageReslice.h>
+#include <vtkOpenGLImageSliceMapper.h>
 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
 #  include <vtkImageMapper3D.h>
 #  include <vtkImageSliceMapper.h>
 #endif
 
-vtkCxxRevisionMacro(vvSlicer, "DummyRevision");
 vtkStandardNewMacro(vvSlicer);
 static void copyExtent(int* in, int* to){
- for(int i=0; i<6; ++i) to[i]=in[i]; 
+ for(int i=0; i<6; ++i) 
+ {
+       to[i]=in[i];
+ } 
 }
 //------------------------------------------------------------------------------
 vvSlicer::vvSlicer()
-{
+{ 
        mFusionSequenceCode = -1;
   this->UnInstallPipeline();
   mImage = NULL;
   mReducedExtent = new int[6];
+  mRegisterExtent = NULL;
   mCurrentTSlice = 0;
   mCurrentFusionTSlice = 0;
   mCurrentOverlayTSlice = 0;
@@ -115,7 +125,11 @@ vvSlicer::vvSlicer()
   crossCursor->SetRadius(2);
 
   pdm = vtkSmartPointer<vtkPolyDataMapper2D>::New();
+#if VTK_MAJOR_VERSION <= 5
   pdm->SetInput(crossCursor->GetOutput());
+#else
+  pdm->SetInputConnection(crossCursor->GetOutputPort(0));
+#endif
 
   pdmA = vtkSmartPointer<vtkActor2D>::New();
   pdmA->SetMapper(pdm);
@@ -162,7 +176,7 @@ vvSlicer::vvSlicer()
 
 //------------------------------------------------------------------------------
 vtkImageMapToWindowLevelColors* vvSlicer::GetOverlayMapper()
-{
+{ 
   return mOverlayMapper.GetPointer();
 }
 //------------------------------------------------------------------------------
@@ -170,7 +184,7 @@ vtkImageMapToWindowLevelColors* vvSlicer::GetOverlayMapper()
 
 //------------------------------------------------------------------------------
 vvBlendImageActor* vvSlicer::GetOverlayActor()
-{
+{ 
   return mOverlayActor.GetPointer();
 }
 //------------------------------------------------------------------------------
@@ -178,7 +192,7 @@ vvBlendImageActor* vvSlicer::GetOverlayActor()
 
 //------------------------------------------------------------------------------
 vtkImageMapToColors* vvSlicer::GetFusionMapper()
-{
+{ 
   return mFusionMapper.GetPointer();
 }
 //------------------------------------------------------------------------------
@@ -186,7 +200,7 @@ vtkImageMapToColors* vvSlicer::GetFusionMapper()
 
 //------------------------------------------------------------------------------
 vtkImageActor* vvSlicer::GetFusionActor()
-{
+{ 
   return mFusionActor.GetPointer();
 }
 //------------------------------------------------------------------------------
@@ -194,7 +208,7 @@ vtkImageActor* vvSlicer::GetFusionActor()
 
 //------------------------------------------------------------------------------
 vtkActor* vvSlicer::GetVFActor()
-{
+{ 
   return mVFActor.GetPointer();
 }
 //------------------------------------------------------------------------------
@@ -202,7 +216,7 @@ vtkActor* vvSlicer::GetVFActor()
 
 //------------------------------------------------------------------------------
 vtkCornerAnnotation* vvSlicer::GetAnnotation()
-{
+{ 
   return ca.GetPointer();
 }
 //------------------------------------------------------------------------------
@@ -210,7 +224,7 @@ vtkCornerAnnotation* vvSlicer::GetAnnotation()
 
 //------------------------------------------------------------------------------
 void vvSlicer::EnableReducedExtent(bool b)
-{
+{ 
   mUseReducedExtent = b;
 }
 //------------------------------------------------------------------------------
@@ -218,7 +232,7 @@ void vvSlicer::EnableReducedExtent(bool b)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetReducedExtent(int * ext)
-{
+{ 
   copyExtent(ext, mReducedExtent);
 }
 //------------------------------------------------------------------------------
@@ -226,7 +240,7 @@ void vvSlicer::SetReducedExtent(int * ext)
 
 //------------------------------------------------------------------------------
 void vvSlicer::AddContour(vvMesh::Pointer contour,bool propagate)
-{
+{ 
 
   mSurfaceCutActors.push_back(new vvMeshActor());
   if (propagate)
@@ -243,7 +257,7 @@ void vvSlicer::AddContour(vvMesh::Pointer contour,bool propagate)
 
 //------------------------------------------------------------------------------
 void vvSlicer::ToggleContourSuperposition()
-{
+{ 
   for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
        i!=mSurfaceCutActors.end(); i++)
     (*i)->ToggleSuperposition();
@@ -253,7 +267,7 @@ void vvSlicer::ToggleContourSuperposition()
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetCursorColor(int r,int g, int b)
-{
+{ 
   pdmA->GetProperty()->SetColor(r,g,b);
 }
 //------------------------------------------------------------------------------
@@ -261,7 +275,7 @@ void vvSlicer::SetCursorColor(int r,int g, int b)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetCursorVisibility(bool s)
-{
+{ 
   pdmA->SetVisibility(s);
 }
 //------------------------------------------------------------------------------
@@ -269,7 +283,7 @@ void vvSlicer::SetCursorVisibility(bool s)
 
 //------------------------------------------------------------------------------
 bool vvSlicer::GetCursorVisibility()
-{
+{ 
   return pdmA->GetVisibility();
 }
 //------------------------------------------------------------------------------
@@ -277,7 +291,7 @@ bool vvSlicer::GetCursorVisibility()
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetCornerAnnotationVisibility(bool s)
-{
+{ 
   ca->SetVisibility(s);
 }
 //------------------------------------------------------------------------------
@@ -285,7 +299,7 @@ void vvSlicer::SetCornerAnnotationVisibility(bool s)
 
 //------------------------------------------------------------------------------
 bool vvSlicer::GetCornerAnnotationVisibility()
-{
+{ 
   return ca->GetVisibility();
 }
 //------------------------------------------------------------------------------
@@ -293,7 +307,7 @@ bool vvSlicer::GetCornerAnnotationVisibility()
 
 //------------------------------------------------------------------------------
 vvSlicer::~vvSlicer()
-{
+{ 
   for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
        i!=mSurfaceCutActors.end(); i++)
     delete (*i);
@@ -303,14 +317,14 @@ vvSlicer::~vvSlicer()
 
 //------------------------------------------------------------------------------
 double* vvSlicer::GetCurrentPosition()
-{
+{ 
   return mCurrentBeforeSlicingTransform;
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetCurrentPosition(double x, double y, double z, int t)
-{
+{ 
   mCurrentBeforeSlicingTransform[0]=x;
   mCurrentBeforeSlicingTransform[1]=y;
   mCurrentBeforeSlicingTransform[2]=z;
@@ -322,7 +336,7 @@ void vvSlicer::SetCurrentPosition(double x, double y, double z, int t)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetImage(vvImage::Pointer image)
-{
+{ 
   if (image->GetVTKImages().size()) {
     mImage = image;
 
@@ -337,13 +351,26 @@ void vvSlicer::SetImage(vvImage::Pointer image)
     mConcatenatedTransform->Concatenate(mImage->GetTransform()[0]);
     mConcatenatedTransform->Concatenate(mSlicingTransform);
     mImageReslice->SetResliceTransform(mConcatenatedTransform);
+#if VTK_MAJOR_VERSION <= 5
     mImageReslice->SetInput(0, mImage->GetFirstVTKImageData());
+#else
+    mImageReslice->SetInputData(0, mImage->GetFirstVTKImageData());
+#endif
     mImageReslice->UpdateInformation();
 
+#if VTK_MAJOR_VERSION <= 5
     this->Superclass::SetInput(mImageReslice->GetOutput());
+#else
+    this->Superclass::SetInputConnection(mImageReslice->GetOutputPort());
+#endif
 
     int extent[6];
+#if VTK_MAJOR_VERSION <= 5
     this->GetInput()->GetWholeExtent(extent);
+#else
+    int* ext = mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
+    copyExtent(ext, extent);
+#endif
 
     // Prevent crash when reload -> change slice if outside extent
     if (Slice < extent[SliceOrientation*2] || Slice>=extent[SliceOrientation*2+1]) {
@@ -352,9 +379,14 @@ void vvSlicer::SetImage(vvImage::Pointer image)
 
     // Make sure that the required part image has been computed
     extent[SliceOrientation*2] = Slice;
-    extent[SliceOrientation*2+1] = Slice;
+    extent[SliceOrientation*2+1] = Slice;    
+#if VTK_MAJOR_VERSION <= 5
     mImageReslice->GetOutput()->SetUpdateExtent(extent);
     mImageReslice->GetOutput()->Update();
+#else
+    mImageReslice->SetUpdateExtent(extent);
+    mImageReslice->Update();
+#endif
 
     this->UpdateDisplayExtent();
 
@@ -367,7 +399,7 @@ void vvSlicer::SetImage(vvImage::Pointer image)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetOverlay(vvImage::Pointer overlay)
-{
+{ 
   if (overlay->GetVTKImages().size()) {
     mOverlay = overlay;
     mOverlayVisibility = true;
@@ -383,16 +415,28 @@ void vvSlicer::SetOverlay(vvImage::Pointer overlay)
     mConcatenatedOverlayTransform->Concatenate(mOverlay->GetTransform()[0]);
     mConcatenatedOverlayTransform->Concatenate(mSlicingTransform);
     mOverlayReslice->SetResliceTransform(mConcatenatedOverlayTransform);
+#if VTK_MAJOR_VERSION <= 5
     mOverlayReslice->SetInput(0, mOverlay->GetFirstVTKImageData());
-    mImageReslice->UpdateInformation();
+#else
+    mOverlayReslice->SetInputData(0, mOverlay->GetFirstVTKImageData());
+#endif
+    mOverlayReslice->Update();
 
     if (!mOverlayMapper)
       mOverlayMapper = vtkSmartPointer<vtkImageMapToWindowLevelColors>::New();
+#if VTK_MAJOR_VERSION <= 5
     mOverlayMapper->SetInput(mOverlayReslice->GetOutput());
+#else
+    mOverlayMapper->SetInputConnection(mOverlayReslice->GetOutputPort(0));
+#endif
 
     if (!mOverlayActor) {
       mOverlayActor = vtkSmartPointer<vvBlendImageActor>::New();
+#if VTK_MAJOR_VERSION <= 5
       mOverlayActor->SetInput(mOverlayMapper->GetOutput());
+#else
+      mOverlayActor->GetMapper()->SetInputConnection(mOverlayMapper->GetOutputPort());
+#endif
       mOverlayActor->SetPickable(0);
       mOverlayActor->SetVisibility(true);
       mOverlayActor->SetOpacity(0.5);
@@ -420,7 +464,7 @@ void vvSlicer::SetOverlay(vvImage::Pointer overlay)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetFusion(vvImage::Pointer fusion, int fusionSequenceCode)
-{
+{ 
        mFusionSequenceCode = fusionSequenceCode;
   if (fusion->GetVTKImages().size()) {
     mFusion = fusion;
@@ -437,8 +481,12 @@ void vvSlicer::SetFusion(vvImage::Pointer fusion, int fusionSequenceCode)
     mConcatenatedFusionTransform->Concatenate(mFusion->GetTransform()[0]);
     mConcatenatedFusionTransform->Concatenate(mSlicingTransform);
     mFusionReslice->SetResliceTransform(mConcatenatedFusionTransform);
+#if VTK_MAJOR_VERSION <= 5
     mFusionReslice->SetInput(0, mFusion->GetFirstVTKImageData());
-    mFusionReslice->UpdateInformation();
+#else
+    mFusionReslice->SetInputData(0, mFusion->GetFirstVTKImageData());
+#endif
+    mFusionReslice->Update();
 
     if (!mFusionMapper)
       mFusionMapper = vtkSmartPointer<vtkImageMapToColors>::New();
@@ -449,17 +497,26 @@ void vvSlicer::SetFusion(vvImage::Pointer fusion, int fusionSequenceCode)
     lut->SetSaturationRange(0, 0);
     lut->Build();
     mFusionMapper->SetLookupTable(lut);
+#if VTK_MAJOR_VERSION <= 5
     mFusionMapper->SetInput(mFusionReslice->GetOutput());
-
+#else
+    mFusionMapper->SetInputConnection(mFusionReslice->GetOutputPort(0));
+#endif
+    
     if (!mFusionActor) {
       mFusionActor = vtkSmartPointer<vtkImageActor>::New();
+#if VTK_MAJOR_VERSION <= 5
       mFusionActor->SetInput(mFusionMapper->GetOutput());
+#else
+      mFusionActor->GetMapper()->SetInputConnection(mFusionMapper->GetOutputPort());
+#endif
       mFusionActor->SetPickable(0);
       mFusionActor->SetVisibility(true);
       mFusionActor->SetOpacity(0.7);
 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
       mFusionActor->GetMapper()->BorderOn();
 #endif
+
       this->GetRenderer()->AddActor(mFusionActor);
     }
 
@@ -474,7 +531,7 @@ void vvSlicer::SetFusion(vvImage::Pointer fusion, int fusionSequenceCode)
 
 //------------------------------------------------------------------------------
 bool vvSlicer::GetActorVisibility(const std::string& actor_type, int overlay_index)
-{
+{ 
   bool vis = false;
   if (actor_type == "image")
     vis = mImageVisibility;
@@ -492,7 +549,7 @@ bool vvSlicer::GetActorVisibility(const std::string& actor_type, int overlay_ind
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetActorVisibility(const std::string& actor_type, int overlay_index ,bool vis)
-{
+{ 
   if (actor_type == "image")
     mImageVisibility = vis;
   else if (actor_type == "vector")
@@ -509,7 +566,7 @@ void vvSlicer::SetActorVisibility(const std::string& actor_type, int overlay_ind
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetVF(vvImage::Pointer vf)
-{
+{ 
   if (vf->GetVTKImages().size()) {
     mVF = vf;
     mVFVisibility = true;
@@ -519,8 +576,13 @@ void vvSlicer::SetVF(vvImage::Pointer vf)
       mVOIFilter = vtkSmartPointer<vtkExtractVOI>::New();
       mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling);
     }
+#if VTK_MAJOR_VERSION <= 5
     mVOIFilter->SetInput(vf->GetFirstVTKImageData());
     mAAFilter->SetInput(mVOIFilter->GetOutput());
+#else
+    mVOIFilter->SetInputData(vf->GetFirstVTKImageData());
+    mAAFilter->SetInputConnection(mVOIFilter->GetOutputPort());
+#endif
     ///This tells VTK to use the scalar (pixel) data of the image to draw the little arrows
     mAAFilter->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA);
 
@@ -533,8 +595,13 @@ void vvSlicer::SetVF(vvImage::Pointer vf)
     // Glyph the gradient vector (with arrows)
     if (!mGlyphFilter)
       mGlyphFilter = vtkSmartPointer<vvGlyph2D>::New();
+#if VTK_MAJOR_VERSION <= 5
     mGlyphFilter->SetInput(mAAFilter->GetOutput());
     mGlyphFilter->SetSource(mArrow->GetOutput());
+#else
+    mGlyphFilter->SetInputConnection(mAAFilter->GetOutputPort());
+    mGlyphFilter->SetSourceConnection(mArrow->GetOutputPort());
+#endif
     mGlyphFilter->ScalingOn();
     mGlyphFilter->SetScaleModeToScaleByVector();
     mGlyphFilter->OrientOn();
@@ -552,7 +619,11 @@ void vvSlicer::SetVF(vvImage::Pointer vf)
 
     if (!mVFMapper)
       mVFMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
+#if VTK_MAJOR_VERSION <= 5
     mVFMapper->SetInput(mGlyphFilter->GetOutput());
+#else
+    mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort());
+#endif
     mVFMapper->ImmediateModeRenderingOn();
     mVFMapper->SetLookupTable(mVFColorLUT);
 
@@ -573,7 +644,7 @@ void vvSlicer::SetVF(vvImage::Pointer vf)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
-{
+{ 
   mLandmarks = landmarks;
   if (landmarks) {
 
@@ -597,10 +668,17 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
 
     mLandClipper->SetClipFunction(mClipBox);
     mLandClipper->InsideOutOn();
+#if VTK_MAJOR_VERSION <= 5
     mLandClipper->SetInput(mLandmarks->GetOutput());
 
     mLandGlyph->SetSource(mCross->GetOutput());
     mLandGlyph->SetInput(mLandClipper->GetOutput());
+#else
+    mLandClipper->SetInputData(mLandmarks->GetOutput());
+
+    mLandGlyph->SetSourceConnection(mCross->GetOutputPort());
+    mLandGlyph->SetInputConnection(mLandClipper->GetOutputPort());
+#endif
     //mLandGlyph->SetIndexModeToScalar();
     //mLandGlyph->SetRange(0,1);
     //mLandGlyph->ScalingOff();
@@ -614,6 +692,7 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
     //mLandMapper->ScalarVisibilityOff();
 
     mLandActor->SetMapper(mLandMapper);
+    mLandActor->GetProperty()->SetOpacity(0.995);  //in order to get VTK to turn on the alpha-blending in OpenGL
     mLandActor->GetProperty()->SetColor(255,10,212);
     mLandActor->SetPickable(0);
     mLandActor->SetVisibility(true);
@@ -626,7 +705,7 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
 //------------------------------------------------------------------------------
 //FIXME: this function leaks memory, we should fix it someday :)
 void vvSlicer::RemoveActor(const std::string& actor_type, int overlay_index)
-{
+{ 
   if (actor_type == "vector") {
     Renderer->RemoveActor(mVFActor);
     mGlyphFilter=NULL;
@@ -659,7 +738,7 @@ void vvSlicer::RemoveActor(const std::string& actor_type, int overlay_index)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetVFSubSampling(int sub)
-{
+{ 
   if (mVOIFilter) {
     mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling);
     mSubSampling = sub;
@@ -672,7 +751,7 @@ void vvSlicer::SetVFSubSampling(int sub)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetVFScale(int scale)
-{
+{ 
   mScale = scale;
   if (mArrow)
     mArrow->SetScale(mScale);
@@ -683,7 +762,7 @@ void vvSlicer::SetVFScale(int scale)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetVFWidth(int width)
-{
+{ 
   mVFWidth = width;
   if (mVFActor)
     mVFActor->GetProperty()->SetLineWidth(mVFWidth);
@@ -695,7 +774,7 @@ void vvSlicer::SetVFWidth(int width)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetVFLog(int log)
-{
+{ 
   mVFLog = log;
   if (mGlyphFilter) {
     mGlyphFilter->SetUseLog(mVFLog);
@@ -709,10 +788,14 @@ void vvSlicer::SetVFLog(int log)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetTSlice(int t, bool updateLinkedImages)
-{
+{ 
        if (!updateLinkedImages) {
                mCurrentTSlice = t;
-               mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] );
+#if VTK_MAJOR_VERSION <= 5
+                mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] );
+#else
+                mImageReslice->SetInputData( mImage->GetVTKImages()[mCurrentTSlice] );
+#endif
                // Update transform
                mConcatenatedTransform->Identity();
                mConcatenatedTransform->Concatenate(mImage->GetTransform()[mCurrentTSlice]);
@@ -720,7 +803,6 @@ void vvSlicer::SetTSlice(int t, bool updateLinkedImages)
                UpdateDisplayExtent();
                return;
        }
-
   if (t < 0)
     mCurrentTSlice = 0;
   else if ((unsigned int)t >= mImage->GetVTKImages().size())
@@ -734,17 +816,28 @@ void vvSlicer::SetTSlice(int t, bool updateLinkedImages)
   mConcatenatedTransform->Concatenate(mSlicingTransform);
 
   // Update image data
-  mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] );
+#if VTK_MAJOR_VERSION <= 5
+   mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] );
+#else
+  mImageReslice->SetInputData( mImage->GetVTKImages()[mCurrentTSlice] );
+#endif
   if (mVF && mVFActor->GetVisibility()) {
     if (mVF->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
+#if VTK_MAJOR_VERSION <= 5
       mVOIFilter->SetInput(mVF->GetVTKImages()[mCurrentTSlice]);
+#else
+      mVOIFilter->SetInputData(mVF->GetVTKImages()[mCurrentTSlice]);
+#endif
   }
   //update the overlay
   if (mOverlay && mOverlayActor->GetVisibility()) {
     if (mOverlay->GetVTKImages().size() > (unsigned int)t) {
       mCurrentOverlayTSlice = t;
+#if VTK_MAJOR_VERSION <= 5
       mOverlayReslice->SetInput( mOverlay->GetVTKImages()[mCurrentOverlayTSlice] );
-
+#else
+      mOverlayReslice->SetInputData( mOverlay->GetVTKImages()[mCurrentOverlayTSlice] );
+#endif
       // Update overlay transform
       mConcatenatedOverlayTransform->Identity();
       mConcatenatedOverlayTransform->Concatenate(mOverlay->GetTransform()[mCurrentOverlayTSlice]);
@@ -755,7 +848,11 @@ void vvSlicer::SetTSlice(int t, bool updateLinkedImages)
   if (mFusion && mFusionActor->GetVisibility() && (mFusionSequenceCode<0)) {
     if (mFusion->GetVTKImages().size() > (unsigned int)t) {
       mCurrentFusionTSlice = t;
+#if VTK_MAJOR_VERSION <= 5
       mFusionReslice->SetInput( mFusion->GetVTKImages()[mCurrentFusionTSlice]);
+#else
+      mFusionReslice->SetInputData( mFusion->GetVTKImages()[mCurrentFusionTSlice]);
+#endif
 
       // Update fusion transform
       mConcatenatedFusionTransform->Identity();
@@ -774,11 +871,15 @@ void vvSlicer::SetTSlice(int t, bool updateLinkedImages)
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetFusionSequenceTSlice(int t)
-{
+{ 
   if (mFusion && mFusionActor->GetVisibility() && (mFusionSequenceCode>=0)) {
     if (mFusion->GetVTKImages().size() > (unsigned int)t) {
       mCurrentFusionTSlice = t;
+#if VTK_MAJOR_VERSION <= 5
       mFusionReslice->SetInput( mFusion->GetVTKImages()[mCurrentFusionTSlice] );
+#else
+      mFusionReslice->SetInputData( mFusion->GetVTKImages()[mCurrentFusionTSlice] );
+#endif
       // Update fusion transform
       mConcatenatedFusionTransform->Identity();
       mConcatenatedFusionTransform->Concatenate(mFusion->GetTransform()[mCurrentFusionTSlice]); //not really useful...
@@ -793,14 +894,14 @@ void vvSlicer::SetFusionSequenceTSlice(int t)
 
 //------------------------------------------------------------------------------
 int vvSlicer::GetTSlice()
-{
+{ 
   return mCurrentTSlice;
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 int vvSlicer::GetMaxCurrentTSlice()
-{
+{ 
   int t = mCurrentTSlice;
   if(mOverlay)
     t = std::max(t, mCurrentOverlayTSlice);
@@ -812,24 +913,30 @@ int vvSlicer::GetMaxCurrentTSlice()
 
 //------------------------------------------------------------------------------
 int vvSlicer::GetFusionTSlice()
-{
+{ 
   return mCurrentFusionTSlice;
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 int vvSlicer::GetOverlayTSlice()
-{
+{ 
   return mCurrentOverlayTSlice;
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvSlicer::SetSliceOrientation(int orientation)
-{
+{ 
   //if 2D image, force to watch in Axial View
   int extent[6];
-  this->GetInput()->GetWholeExtent(extent);
+#if VTK_MAJOR_VERSION <= 5
+    this->GetInput()->GetWholeExtent(extent);
+#else
+    int* ext = mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
+    copyExtent(ext, extent);
+#endif
+
   if (extent[5]-extent[4] <= 2)
     orientation = vtkImageViewer2::SLICE_ORIENTATION_XY;
 
@@ -858,7 +965,9 @@ void vvSlicer::SetSliceOrientation(int orientation)
     int *range = this->GetSliceRange();
     if (range)
       this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
-    mFirstSetSliceOrientation = false;
+#if VTK_MAJOR_VERSION <= 5
+      mFirstSetSliceOrientation = false;
+#endif
   }
   else if (this->Renderer && this->GetInput()) {
     double s = mCursor[orientation];
@@ -867,8 +976,13 @@ void vvSlicer::SetSliceOrientation(int orientation)
   }
 
   this->UpdateOrientation();
+  
   this->UpdateDisplayExtent();
-
+  
+  if (mFirstSetSliceOrientation) {
+    mFirstSetSliceOrientation = false;
+  }
+  
   if (this->Renderer && this->GetInput()) {
     double scale = this->Renderer->GetActiveCamera()->GetParallelScale();
     this->Renderer->ResetCamera();
@@ -885,11 +999,15 @@ void vvSlicer::SetSliceOrientation(int orientation)
 // In other words, we change the grid of the reslice in the same way as the grid
 // of the displayed image in the slicing direction.
 void vvSlicer::AdjustResliceToSliceOrientation(vtkImageReslice *reslice)
-{
+{ 
   // Reset autocrop and update output information
   reslice->SetOutputOriginToDefault();
   reslice->SetOutputSpacingToDefault();
+#if VTK_MAJOR_VERSION <= 5
   reslice->GetOutput()->UpdateInformation();
+#else
+  reslice->UpdateInformation();
+#endif
 
   // Ge new origin / spacing
   double origin[3];
@@ -919,16 +1037,23 @@ void vvSlicer::AdjustResliceToSliceOrientation(vtkImageReslice *reslice)
   reslice->SetOutputOrigin(origin);
   reslice->SetOutputSpacing(spacing);
   reslice->UpdateInformation();
-  reslice->GetOutput()->UpdateInformation();
 }
 //------------------------------------------------------------------------------
 
 //----------------------------------------------------------------------------
-int * vvSlicer::GetExtent(){
+int * vvSlicer::GetExtent()
+{ 
   int *w_ext;
   if (mUseReducedExtent) {
     w_ext = mReducedExtent;
-  } else w_ext = GetInput()->GetWholeExtent();
+  }
+  else {
+#if VTK_MAJOR_VERSION <= 5
+    w_ext = GetInput()->GetWholeExtent();
+#else
+    w_ext = mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
+#endif
+  }
   return w_ext;
 }
 //----------------------------------------------------------------------------
@@ -936,7 +1061,7 @@ int * vvSlicer::GetExtent(){
 
 //----------------------------------------------------------------------------
 int vvSlicer::GetOrientation()
-{
+{ 
   return this->SliceOrientation;
 }
 //----------------------------------------------------------------------------
@@ -944,25 +1069,40 @@ int vvSlicer::GetOrientation()
 
 //----------------------------------------------------------------------------
 void vvSlicer::UpdateDisplayExtent()
-{
+{ 
+  emit UpdateDisplayExtentBegin(mSlicerNumber);
   vtkImageData *input = this->GetInput();
   if (!input || !this->ImageActor) {
     return;
   }
+
+#if VTK_MAJOR_VERSION <= 5
   input->UpdateInformation();
+#else
+  mRegisterExtent = mImageReslice->GetOutputInformation(0)->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
+#endif
   this->SetSlice( this->GetSlice() ); //SR: make sure the update let the slice in extents
 
   // Local copy of extent
   int w_ext[6];
+#if VTK_MAJOR_VERSION <= 5
   int* ext = GetExtent();
+#else
+  int* ext = mImageReslice->GetOutputInformation(0)->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
+#endif
   copyExtent(ext, w_ext);
+  if (mUseReducedExtent) {
+        copyExtent(mReducedExtent, w_ext);
+    }
   // Set slice value
+
   w_ext[ this->SliceOrientation*2   ] = this->Slice;
   w_ext[ this->SliceOrientation*2+1 ] = this->Slice;
   
   // Image actor
   this->ImageActor->SetVisibility(mImageVisibility);
   this->ImageActor->SetDisplayExtent(w_ext);
+  
 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
   // Fix for bug #1882
   dynamic_cast<vtkImageSliceMapper *>(this->ImageActor->GetMapper())->SetOrientation(this->GetOrientation());
@@ -972,8 +1112,13 @@ void vvSlicer::UpdateDisplayExtent()
   if (mOverlay && mOverlayVisibility) {
     AdjustResliceToSliceOrientation(mOverlayReslice);
     int overExtent[6];
+#if VTK_MAJOR_VERSION <= 5
     this->ConvertImageToImageDisplayExtent(input, w_ext, mOverlayReslice->GetOutput(), overExtent);
     bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
+#else
+    this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mOverlayReslice->GetOutput(), overExtent);
+    bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
+#endif
     mOverlayActor->SetVisibility(!out);
     mOverlayActor->SetDisplayExtent( overExtent );
 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
@@ -988,8 +1133,13 @@ void vvSlicer::UpdateDisplayExtent()
   if (mFusion && mFusionVisibility) {
     AdjustResliceToSliceOrientation(mFusionReslice);
     int fusExtent[6];
+#if VTK_MAJOR_VERSION <= 5
     this->ConvertImageToImageDisplayExtent(input, w_ext, mFusionReslice->GetOutput(), fusExtent);
     bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
+#else
+    this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mFusionReslice->GetOutput(), fusExtent);
+    bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
+#endif
     mFusionActor->SetVisibility(!out);
     mFusionActor->SetDisplayExtent( fusExtent );
 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
@@ -999,7 +1149,6 @@ void vvSlicer::UpdateDisplayExtent()
   }
   else if(mFusion)
     mFusionActor->SetVisibility(false);
-
   // Vector field actor
   double* camera = Renderer->GetActiveCamera()->GetPosition();
   double* image_bounds = ImageActor->GetBounds();
@@ -1020,32 +1169,41 @@ void vvSlicer::UpdateDisplayExtent()
   
   if (mVF && mVFVisibility) {
     int vfExtent[6];
+#if VTK_MAJOR_VERSION <= 5
     mVF->GetVTKImages()[0]->UpdateInformation();
     this->ConvertImageToImageDisplayExtent(input, w_ext, mVF->GetVTKImages()[0], vfExtent);
     bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetWholeExtent());
+#else
+    //this->UpdateInformation();
+    this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mVF->GetVTKImages()[0], vfExtent);
+    bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
+#endif
     mVFActor->SetVisibility(!out);
     mVOIFilter->SetVOI(vfExtent);
     int orientation[3] = {1,1,1};
     orientation[this->SliceOrientation] = 0;
     mGlyphFilter->SetOrientation(orientation[0], orientation[1], orientation[2]);
-    mVFMapper->Update();
-
     position[this->SliceOrientation] += offset;
     mVFActor->SetPosition(position);
+    mVFActor->GetProperty()->SetOpacity(0.995); //in order to get VTK to turn on the alpha-blending in OpenGL
+    mVFMapper->Update();
+
   }
   else if(mVF)
     mVFActor->SetVisibility(false);
+    
+    
+    double boundsT [6];
+      for(unsigned int i=0; i<6; i++)
+        boundsT[i] = ImageActor->GetBounds()[i];
+      boundsT[ this->SliceOrientation*2   ] = ImageActor->GetBounds()[ this->SliceOrientation*2  ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
+      boundsT[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
+
 
   // Landmarks actor
   if (mLandActor) {
     if (mClipBox) {
-      double bounds [6];
-      for(unsigned int i=0; i<6; i++)
-        bounds[i] = ImageActor->GetBounds()[i];
-      bounds[ this->SliceOrientation*2   ] = ImageActor->GetBounds()[ this->SliceOrientation*2  ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
-      bounds[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
-      mClipBox->SetBounds(bounds);
-      UpdateLandmarks();
+      RemoveLandmarks();
     }
     
     position[this->SliceOrientation] = offset;
@@ -1070,6 +1228,39 @@ void vvSlicer::UpdateDisplayExtent()
         cam->SetClippingRange(range - sumSpacing, range + sumSpacing);
       }
     }
+    
+    if (mLandActor) {
+        if (mClipBox) {
+            DisplayLandmarks();
+        }
+    }
+  }
+  emit UpdateDisplayExtentEnd(mSlicerNumber);
+}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+void vvSlicer::ConvertImageToImageDisplayExtent(vtkInformation *sourceImage, const int sourceExtent[6],
+                                                vtkImageData *targetImage, int targetExtent[6])
+{ 
+  double dExtents[6];
+  double *origin, *spacing;
+  origin = sourceImage->Get(vtkDataObject::ORIGIN());
+  spacing = sourceImage->Get(vtkDataObject::SPACING());
+  for(unsigned int i=0; i<6; i++) {
+    // From source voxel coordinates to world coordinates
+    dExtents[i] = origin[i/2] + spacing[i/2] * sourceExtent[i];
+
+    // From world coordinates to floating point target voxel coordinates
+    dExtents[i] = (dExtents[i]- targetImage->GetOrigin()[i/2]) / targetImage->GetSpacing()[i/2];
+    
+    // Round to current slice or larger extent
+    if(i/2==this->GetOrientation())
+      targetExtent[i] = itk::Math::Round<double>(dExtents[i]);
+    else if(i%2==1)
+      targetExtent[i] = itk::Math::Ceil<double>(dExtents[i]);
+    else
+      targetExtent[i] = itk::Math::Floor<double>(dExtents[i]);
   }
 }
 //----------------------------------------------------------------------------
@@ -1099,7 +1290,7 @@ void vvSlicer::ConvertImageToImageDisplayExtent(vtkImageData *sourceImage, const
 
 //----------------------------------------------------------------------------
 bool vvSlicer::ClipDisplayedExtent(int extent[6], int refExtent[6])
-{
+{ 
   bool out = false;
   int maxBound = 6;
 
@@ -1127,7 +1318,7 @@ bool vvSlicer::ClipDisplayedExtent(int extent[6], int refExtent[6])
 
 //----------------------------------------------------------------------------
 void vvSlicer::UpdateOrientation()
-{
+{ 
   // Set the camera position
   vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
   if (cam) {
@@ -1157,7 +1348,7 @@ void vvSlicer::UpdateOrientation()
 
 //----------------------------------------------------------------------------
 void vvSlicer::SetOpacity(double s)
-{
+{ 
   this->GetImageActor()->SetOpacity(s);
 }
 //----------------------------------------------------------------------------
@@ -1165,7 +1356,7 @@ void vvSlicer::SetOpacity(double s)
 
 //----------------------------------------------------------------------------
 void vvSlicer::SetRenderWindow(int orientation, vtkRenderWindow * rw)
-{
+{ 
   this->Superclass::SetRenderWindow(rw);
   this->SetupInteractor(rw->GetInteractor());
   ca->SetImageActor(this->GetImageActor());
@@ -1181,8 +1372,8 @@ void vvSlicer::SetRenderWindow(int orientation, vtkRenderWindow * rw)
   bounds[3] = max;
   bounds[4] = -max;
   bounds[5] = max;
-
   crossCursor->SetModelBounds(bounds);
+
   this->GetRenderer()->AddActor(pdmA);
   this->GetRenderer()->AddActor(ca);
   this->GetRenderer()->ResetCamera();
@@ -1197,7 +1388,7 @@ void vvSlicer::SetRenderWindow(int orientation, vtkRenderWindow * rw)
 
 //----------------------------------------------------------------------------
 void vvSlicer::ResetCamera()
-{
+{ 
   this->GetRenderer()->ResetCamera();
 }
 //----------------------------------------------------------------------------
@@ -1205,7 +1396,7 @@ void vvSlicer::ResetCamera()
 
 //----------------------------------------------------------------------------
 void vvSlicer::SetDisplayMode(bool i)
-{
+{ 
        this->GetRenderer()->SetDraw(i);
        if (i) UpdateDisplayExtent();
 }
@@ -1214,7 +1405,7 @@ void vvSlicer::SetDisplayMode(bool i)
 
 //----------------------------------------------------------------------------
 void vvSlicer::FlipHorizontalView()
-{
+{ 
   vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
   if (cam) {
     double *position = cam->GetPosition();
@@ -1245,7 +1436,7 @@ void vvSlicer::FlipHorizontalView()
 
 //----------------------------------------------------------------------------
 void vvSlicer::FlipVerticalView()
-{
+{ 
   vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
   if (cam) {
     FlipHorizontalView();
@@ -1259,7 +1450,7 @@ void vvSlicer::FlipVerticalView()
 
 //----------------------------------------------------------------------------
 void vvSlicer::SetColorWindow(double window)
-{
+{ 
   vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
   if ( LUT ) {
     double level = this->GetWindowLevel()->GetLevel();
@@ -1272,7 +1463,7 @@ void vvSlicer::SetColorWindow(double window)
 
 //----------------------------------------------------------------------------
 void vvSlicer::SetColorLevel(double level)
-{
+{ 
   vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
   if ( LUT ) {
     double window = this->GetWindowLevel()->GetWindow();
@@ -1285,7 +1476,7 @@ void vvSlicer::SetColorLevel(double level)
 
 //----------------------------------------------------------------------------
 double vvSlicer::GetOverlayColorWindow()
-{
+{ 
   if(mOverlayMapper)
     return mOverlayMapper->GetWindow();
   else
@@ -1295,7 +1486,7 @@ double vvSlicer::GetOverlayColorWindow()
 
 //----------------------------------------------------------------------------
 double vvSlicer::GetOverlayColorLevel()
-{
+{ 
   if(mOverlayMapper)
     return mOverlayMapper->GetLevel();
   else
@@ -1305,7 +1496,7 @@ double vvSlicer::GetOverlayColorLevel()
 
 //----------------------------------------------------------------------------
 void vvSlicer::SetOverlayColorWindow(double window)
-{
+{ 
   if(mOverlayMapper)
     mOverlayMapper->SetWindow(window);
 }
@@ -1313,7 +1504,7 @@ void vvSlicer::SetOverlayColorWindow(double window)
 
 //----------------------------------------------------------------------------
 void vvSlicer::SetOverlayColorLevel(double level)
-{
+{ 
   if(mOverlayMapper)
     mOverlayMapper->SetLevel(level);
 }
@@ -1322,7 +1513,7 @@ void vvSlicer::SetOverlayColorLevel(double level)
 //----------------------------------------------------------------------------
 // Returns the min an the max value in a 20%x20% region around the mouse pointer
 void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max, vtkImageData *image, vtkTransform *transform)
-{
+{ 
   //Get mouse pointer position in view coordinates
   double corner1[3];
   double corner2[3];
@@ -1357,10 +1548,22 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max, vtkImag
 
     if(iLocalExtents[i*2  ]>iLocalExtents[i*2+1])
       std::swap(iLocalExtents[i*2], iLocalExtents[i*2+1]);
+
+    for(int j=0;j<2; j++) {
+      if(iLocalExtents[i*2+j]< mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT())[2*i])
+        iLocalExtents[i*2+j] = mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT())[2*i];
+
+      if(iLocalExtents[i*2+j]> mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT())[2*i+1])
+        iLocalExtents[i*2+j] = mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT())[2*i+1];
+    }
   }
 
   vtkSmartPointer<vtkExtractVOI> voiFilter = vtkSmartPointer<vtkExtractVOI>::New();
+#if VTK_MAJOR_VERSION <= 5
   voiFilter->SetInput(image);
+#else
+  voiFilter->SetInputData(image);
+#endif
   voiFilter->SetVOI(iLocalExtents);
   voiFilter->Update();
   if (!voiFilter->GetOutput()->GetNumberOfPoints()) {
@@ -1370,7 +1573,11 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max, vtkImag
   }
 
   vtkSmartPointer<vtkImageAccumulate> accFilter = vtkSmartPointer<vtkImageAccumulate>::New();
+#if VTK_MAJOR_VERSION <= 5
   accFilter->SetInput(voiFilter->GetOutput());
+#else
+  accFilter->SetInputConnection(voiFilter->GetOutputPort(0));
+#endif
   accFilter->Update();
 
   min = *(accFilter->GetMin());
@@ -1380,11 +1587,11 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max, vtkImag
 
 //----------------------------------------------------------------------------
 double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, double X, double Y, double Z, int &ix, int &iy, int &iz, int component)
-{
+{ 
   ix = lrint(X);
   iy = lrint(Y);
   iz = lrint(Z);
-
+#if VTK_MAJOR_VERSION <= 5
   if (ix < image->GetWholeExtent()[0] ||
       ix > image->GetWholeExtent()[1] ||
       iy < image->GetWholeExtent()[2] ||
@@ -1392,16 +1599,27 @@ double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, double X, doubl
       iz < image->GetWholeExtent()[4] ||
       iz > image->GetWholeExtent()[5] )
     return std::numeric_limits<double>::quiet_NaN();
-
   image->SetUpdateExtent(ix, ix, iy, iy, iz, iz);
   image->Update();
+#else
+  if (ix < image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[0] ||
+      ix > image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[1] ||
+      iy < image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[2] ||
+      iy > image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[3] ||
+      iz < image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[4] ||
+      iz > image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[5] )
+    return std::numeric_limits<double>::quiet_NaN();
+  //image->SetUpdateExtent(ix, ix, iy, iy, iz, iz);
+  //image->Update();
+#endif
+
   return image->GetScalarComponentAsDouble(ix, iy, iz, component);
 }
 //----------------------------------------------------------------------------
 
 //----------------------------------------------------------------------------
 void vvSlicer::Render()
-{
+{ 
   if (this->mFusion && mFusionActor->GetVisibility() && showFusionLegend) {
     legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable());
     legend->UseOpacityOn();
@@ -1414,13 +1632,14 @@ void vvSlicer::Render()
   } else legend->SetVisibility(0);
 
   if (ca->GetVisibility()) {
-    std::stringstream worldPos;
+
+    std::stringstream worldPos(" ");
     double pt[3];
     mConcatenatedTransform->TransformPoint(mCurrent, pt);
     double X = (pt[0] - mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[0])/mImage->GetVTKImages()[mCurrentTSlice]->GetSpacing()[0];
     double Y = (pt[1] - mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[1])/mImage->GetVTKImages()[mCurrentTSlice]->GetSpacing()[1];
     double Z = (pt[2] - mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[2])/mImage->GetVTKImages()[mCurrentTSlice]->GetSpacing()[2];
-
+#if VTK_MAJOR_VERSION <= 5
     if (X >= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[0]-0.5 &&
         X <= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[1]+0.5 &&
         Y >= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[2]-0.5 &&
@@ -1446,6 +1665,33 @@ void vvSlicer::Render()
                              << mCurrentTSlice
                              << std::endl;
     }
+#else
+    if (X >= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[0]-0.5 &&
+        X <= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[1]+0.5 &&
+        Y >= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[2]-0.5 &&
+        Y <= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[3]+0.5 &&
+        Z >= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[4]-0.5 &&
+        Z <= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[5]+0.5) {
+
+      int ix, iy, iz;
+      double value = this->GetScalarComponentAsDouble(mImage->GetVTKImages()[mCurrentTSlice], X, Y, Z, ix, iy, iz);
+
+      if(ImageActor->GetVisibility())
+        worldPos << "data value : " << value << std::endl;
+
+      worldPos << "mm : " << lrint(mCurrentBeforeSlicingTransform[0]) << ' '
+                          << lrint(mCurrentBeforeSlicingTransform[1]) << ' '
+                          << lrint(mCurrentBeforeSlicingTransform[2]) << ' '
+                          << mCurrentTSlice
+                          << std::endl;
+      worldPos << "pixel : " << ix << ' '
+                             << iy << ' '
+                             << iz << ' '
+                             << mCurrentTSlice
+                             << std::endl;
+    
+    }
+#endif
     ca->SetText(1,worldPos.str().c_str());
 
     std::stringstream slicePos;
@@ -1460,7 +1706,7 @@ void vvSlicer::Render()
     double xCursor = (x - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
     double yCursor = (y - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
     double zCursor = (z - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
-
+#if VTK_MAJOR_VERSION <= 5    
     if (xCursor >= this->GetImageActor()->GetDisplayExtent()[0]-0.5 &&
         xCursor < this->GetImageActor()->GetDisplayExtent()[1]+0.5 &&
         yCursor >= this->GetImageActor()->GetDisplayExtent()[2]-0.5 &&
@@ -1477,29 +1723,71 @@ void vvSlicer::Render()
       crossCursor->SetFocalPoint(x,y,z);
     } else
       crossCursor->SetFocalPoint(-1,-1,z);
+    crossCursor->Update();
   }
+#else
+    vtkSmartPointer<vtkOpenGLImageSliceMapper> mapperOpenGL= vtkSmartPointer<vtkOpenGLImageSliceMapper>::New();
+    try {
+        mapperOpenGL = dynamic_cast<vtkOpenGLImageSliceMapper*>(GetImageActor()->GetMapper());
+    } catch (const std::bad_cast& e) {
+               std::cerr << e.what() << std::endl;
+               std::cerr << "Conversion error" << std::endl;
+               return;
+       }
 
+    if (xCursor >= mapperOpenGL->GetCroppingRegion()[0]-0.5 &&
+        xCursor < mapperOpenGL->GetCroppingRegion()[1]+0.5 &&
+        yCursor >= mapperOpenGL->GetCroppingRegion()[2]-0.5 &&
+        yCursor < mapperOpenGL->GetCroppingRegion()[3]+0.5 &&
+        zCursor >= mapperOpenGL->GetCroppingRegion()[4]-0.5 &&
+        zCursor < mapperOpenGL->GetCroppingRegion()[5]+0.5 ) {
+      vtkRenderer * renderer = this->Renderer;
+
+      renderer->WorldToView(x,y,z);
+      renderer->ViewToNormalizedViewport(x,y,z);
+      renderer->NormalizedViewportToViewport(x,y);
+      renderer->ViewportToNormalizedDisplay(x,y);
+      renderer->NormalizedDisplayToDisplay(x,y);
+      crossCursor->SetFocalPoint(x,y,z);
+    } else
+      crossCursor->SetFocalPoint(-1,-1,z);
+    crossCursor->Update();
+  }
+#endif
 
   if (mOverlay && mOverlayActor->GetVisibility()) {
     if(mLinkOverlayWindowLevel) {
       mOverlayMapper->SetWindow(this->GetColorWindow());
       mOverlayMapper->SetLevel(this->GetColorLevel());
     }
+#if VTK_MAJOR_VERSION <= 5
     mOverlayMapper->GetOutput()->SetUpdateExtent(mOverlayActor->GetDisplayExtent());
-    mOverlayMapper->GetOutput()->Update();
+#else
+    mOverlayMapper->SetUpdateExtent(mOverlayActor->GetDisplayExtent());
+#endif
     mOverlayMapper->Update();
   }
-  if (mLandMapper)
-    UpdateLandmarks();
+  if (mFusion && mFusionActor->GetVisibility()) {
+#if VTK_MAJOR_VERSION <= 5
+    mFusionMapper->GetOutput()->SetUpdateExtent(mFusionActor->GetDisplayExtent());
+#else
+    mFusionMapper->SetUpdateExtent(mFusionActor->GetDisplayExtent());
+#endif
+    mFusionMapper->Update();
+  }
+  if (mLandMapper) {
+    RemoveLandmarks();
+    DisplayLandmarks();
+  }
 
-  this->GetRenderWindow()->Render();
+    this->GetRenderWindow()->Render();
 }
 //----------------------------------------------------------------------------
 
 
 //----------------------------------------------------------------------------
 void vvSlicer::UpdateCursorPosition()
-{
+{ 
   pdmA->SetVisibility(true);
   mCursor[0] = mCurrent[0];
   mCursor[1] = mCurrent[1];
@@ -1510,24 +1798,43 @@ void vvSlicer::UpdateCursorPosition()
 
 
 //----------------------------------------------------------------------------
-void vvSlicer::UpdateLandmarks()
-{
+void vvSlicer::RemoveLandmarks()
+{ 
   vtkPolyData *pd = static_cast<vtkPolyData*>(mLandClipper->GetInput());
   if (pd->GetPoints()) {
-    //mLandGlyph->SetRange(0,1);
-    //mLandGlyph->Modified();
-    //mLandGlyph->Update();
 
-    mClipBox->Modified();
-    mLandClipper->Update();
-    mLandMapper->Update();
-    //Let's add the captions
     //First remove all captions:
     for(unsigned int i=0;i<mLandLabelActors.size();i++) {
        this->Renderer->RemoveActor2D(mLandLabelActors[i]);
        //allActors2D->Remove (mLandLabelActors[i]);
     }
     mLandLabelActors.clear();
+  }
+}
+//----------------------------------------------------------------------------
+
+
+//----------------------------------------------------------------------------
+void vvSlicer::DisplayLandmarks()
+{ 
+
+  double bounds [6];
+  for(unsigned int i=0; i<6; i++)
+    bounds[i] = ImageActor->GetBounds()[i];
+  bounds[ this->SliceOrientation*2   ] = ImageActor->GetBounds()[ this->SliceOrientation*2  ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
+  bounds[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
+  mClipBox->SetBounds(bounds);
+
+
+  vtkPolyData *pd = static_cast<vtkPolyData*>(mLandClipper->GetInput());
+  if (pd->GetPoints()) {
+    //mLandGlyph->SetRange(0,1);
+    //mLandGlyph->Modified();
+    //mLandGlyph->Update();
+
+    mClipBox->Modified();
+    mLandClipper->Update();
+    mLandMapper->Update();
     //Next add the captions to the displayed points
     for (vtkIdType id=0; id<mLandClipper->GetOutput()->GetNumberOfPoints(); id++) {
          double *position = mLandClipper->GetOutput()->GetPoint(id);
@@ -1554,7 +1861,7 @@ void vvSlicer::UpdateLandmarks()
 
 //----------------------------------------------------------------------------
 void vvSlicer::SetSlice(int slice)
-{
+{ 
   int *range = this->GetSliceRange();
   if (range) {
     if (slice < range[0]) {
@@ -1579,7 +1886,8 @@ void vvSlicer::SetSlice(int slice)
 //----------------------------------------------------------------------------
 
 //----------------------------------------------------------------------------
-int vvSlicer::GetTMax() {
+int vvSlicer::GetTMax() 
+{ 
   int tmax = (int)mImage->GetVTKImages().size() - 1;
   if(mOverlay)
     tmax = std::max(tmax, (int)mOverlay->GetVTKImages().size()-1);
@@ -1589,7 +1897,7 @@ int vvSlicer::GetTMax() {
 
 //----------------------------------------------------------------------------
 void vvSlicer::SetContourSlice()
-{
+{ 
   if (mSurfaceCutActors.size() > 0)
     for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
          i!=mSurfaceCutActors.end(); i++) {
@@ -1604,7 +1912,7 @@ void vvSlicer::SetContourSlice()
 
 //----------------------------------------------------------------------------
 void vvSlicer::ForceUpdateDisplayExtent()
-{
+{ 
   this->UpdateDisplayExtent();
 }
 //----------------------------------------------------------------------------
@@ -1612,7 +1920,7 @@ void vvSlicer::ForceUpdateDisplayExtent()
 
 //----------------------------------------------------------------------------
 int* vvSlicer::GetDisplayExtent()
-{
+{ 
   return this->GetImageActor()->GetDisplayExtent();
 }
 //----------------------------------------------------------------------------
@@ -1620,14 +1928,15 @@ int* vvSlicer::GetDisplayExtent()
 
 //----------------------------------------------------------------------------
 void vvSlicer::PrintSelf(ostream& os, vtkIndent indent)
-{
+{ 
   this->Superclass::PrintSelf(os, indent);
 }
 //----------------------------------------------------------------------------
 
+
 //----------------------------------------------------------------------------
 void vvSlicer::SetVFColor(double r, double g, double b)
-{
+{ 
   double mVFColorHSV[3];
   mVFColor[0] = r;
   mVFColor[1] = g;
@@ -1640,4 +1949,21 @@ void vvSlicer::SetVFColor(double r, double g, double b)
 
   this->Render();
 }  
+//----------------------------------------------------------------------------
+
+
+//----------------------------------------------------------------------------
+void vvSlicer::SetRegisterExtent(int ext[6])
+{ 
+    copyExtent(ext, mRegisterExtent);
+}
+//----------------------------------------------------------------------------
+
+
+//----------------------------------------------------------------------------
+void vvSlicer::GetRegisterExtent(int ext[6])
+{ 
+    copyExtent(mRegisterExtent, ext);
+}
+//----------------------------------------------------------------------------
 
index 0bffd1f36abcc46f92d5b43a3c51aab519685e59..4fadb3e775023661c0689b07e7a5f9075dce6324 100644 (file)
@@ -20,6 +20,7 @@
 #include <iostream>
 #include <vector>
 
+#include <QObject>
 #include <QString> //TODO delete
 #include <QMessageBox>
 
@@ -58,11 +59,13 @@ class vtkScalarBarActor;
 class vtkTransform;
 class vtkImageReslice;
 
-class vvSlicer: public vtkImageViewer2
-{
+class vvSlicer: public QObject, public vtkImageViewer2 {
+  
+Q_OBJECT
+
 public:
   static vvSlicer *New();
-  vtkTypeRevisionMacro(vvSlicer,vtkImageViewer2);
+  vtkTypeMacro(vvSlicer,vtkImageViewer2);
   void PrintSelf(ostream& os, vtkIndent indent);
 
   void SetImage(vvImage::Pointer inputImages);
@@ -148,7 +151,6 @@ public:
   double* GetCursorPosition() {
     return mCursor;
   }
-
   vtkTransform * GetSlicingTransform() { return mSlicingTransform; }
   vtkTransform * GetConcatenatedTransform() { return mConcatenatedTransform; }
   vtkTransform * GetConcatenatedFusionTransform() { return mConcatenatedFusionTransform; }
@@ -168,7 +170,8 @@ public:
 
   void GetExtremasAroundMousePointer(double & min, double & max, vtkImageData *image, vtkTransform *transform);
 
-  void UpdateLandmarks();
+  void RemoveLandmarks();
+  void DisplayLandmarks();
   void ForceUpdateDisplayExtent();
 
   int* GetDisplayExtent();
@@ -205,9 +208,19 @@ public:
     return mVFColor;
   }
   void SetVFColor(double r, double g, double b);
-
+  
   //necessary to flag the secondary sequence
   void SetFusionSequenceCode(int code) {mFusionSequenceCode=code;}
+  void SetRegisterExtent(int [6]);
+  void GetRegisterExtent(int [6]);
+  
+  void SetSlicerNumber(const int nbSlicer) {mSlicerNumber = nbSlicer;}
+  int GetSlicerNumber() const {return mSlicerNumber;}
+  
+signals:
+  void UpdateDisplayExtentBegin(int);
+  void UpdateDisplayExtentEnd(int);
+  
 protected:
   vvSlicer();
   ~vvSlicer();
@@ -264,6 +277,7 @@ protected:
   vtkSmartPointer<vtkScalarBarActor> legend;
   std::vector<vvMeshActor*> mSurfaceCutActors;
 
+  int mSlicerNumber;
   int mCurrentTSlice;
   int mCurrentFusionTSlice;
   int mCurrentOverlayTSlice;
@@ -277,13 +291,15 @@ protected:
   double mVFColor[3];
   bool mUseReducedExtent;
   int * mReducedExtent;
-  int * mInitialExtent;
+  int * mRegisterExtent;
   bool mLinkOverlayWindowLevel;
   bool showFusionLegend;
 
 private:
   void UpdateOrientation();
   void UpdateDisplayExtent();
+  void ConvertImageToImageDisplayExtent(vtkInformation *sourceImage, const int sourceExtent[6],
+                                        vtkImageData *targetImage, int targetExtent[6]);
   void ConvertImageToImageDisplayExtent(vtkImageData *sourceImage, const int sourceExtent[6],
                                         vtkImageData *targetImage, int targetExtent[6]);
   ///Sets the surfaces to be cut on the image slice: update the vtkCutter
index 89fd42b49fae4177e89ec0c2ee4590e38c9a6f54..82d6508bf8445eed080b45706bb645cac50efa4a 100644 (file)
@@ -25,6 +25,9 @@
 #include "vvMesh.h"\r
 #include "vvBlendImageActor.h"\r
 \r
+#include <vtkVersion.h>\r
+#include <vtkStreamingDemandDrivenPipeline.h>\r
+#include <vtkInformation.h>\r
 #include <vtkImageActor.h>\r
 #include <vtkImageData.h>\r
 #include <vtkRenderWindow.h>\r
 #include <QMessageBox>\r
 //----------------------------------------------------------------------------\r
 vvSlicerManager::vvSlicerManager(int numberOfSlicers)\r
-{\r
+{ \r
+\r
+  connect(this, SIGNAL(callAddLandmark(float,float,float,float)), this, SLOT(AddLandmark(float,float,float,float)));\r
+\r
   mFileName = "";\r
   mId = "";\r
   mVFName = "";\r
@@ -73,8 +79,10 @@ vvSlicerManager::vvSlicerManager(int numberOfSlicers)
   mLandmarks = NULL;\r
   mLinkedId.resize(0);\r
 \r
-  for ( int i = 0; i < numberOfSlicers; i++)\r
+  for ( int i = 0; i < numberOfSlicers; i++) {\r
     mSlicers.push_back(vtkSmartPointer<vvSlicer>::New());\r
+    mSlicers[i]->SetSlicerNumber(i);\r
+  }\r
   mSelectedSlicer = -1;\r
   \r
   mPreviousSlice.resize(numberOfSlicers, 0);\r
@@ -88,7 +96,7 @@ vvSlicerManager::vvSlicerManager(int numberOfSlicers)
 \r
 //----------------------------------------------------------------------------\r
 vvSlicerManager::~vvSlicerManager()\r
-{\r
+{ \r
   if (mLandmarks)\r
     delete mLandmarks;\r
 }\r
@@ -97,7 +105,7 @@ vvSlicerManager::~vvSlicerManager()
 \r
 //------------------------------------------------------------------------------\r
 void vvSlicerManager::SetFilename(std::string filename, int number)\r
-{\r
+{ \r
   mFileName = filename;\r
   mFileName = vtksys::SystemTools::GetFilenameName(mFileName);\r
   mBaseFileName = vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(mFileName));\r
@@ -119,7 +127,7 @@ void vvSlicerManager::SetFilename(std::string filename, int number)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::AddContour(vvMesh::Pointer contour,bool propagate)\r
-{\r
+{ \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->AddContour(contour,propagate);\r
   }\r
@@ -129,7 +137,7 @@ void vvSlicerManager::AddContour(vvMesh::Pointer contour,bool propagate)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::ToggleContourSuperposition()\r
-{\r
+{ \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++)\r
     mSlicers[i]->ToggleContourSuperposition();\r
 }\r
@@ -137,7 +145,7 @@ void vvSlicerManager::ToggleContourSuperposition()
 \r
 //----------------------------------------------------------------------------\r
 std::string vvSlicerManager::GetListOfAbsoluteFilePathInOneString(const std::string &actorType)\r
-{\r
+{ \r
   vvImageReader *reader = NULL;\r
 \r
   if(actorType=="image")\r
@@ -168,7 +176,7 @@ std::string vvSlicerManager::GetListOfAbsoluteFilePathInOneString(const std::str
 \r
 //----------------------------------------------------------------------------\r
 bool vvSlicerManager::SetImage(std::string filename, vvImageReader::LoadedImageType type, int n, unsigned int slice)\r
-{\r
+{ \r
   mType = type;\r
   if (mReader.IsNull())\r
     mReader = vvImageReader::New();\r
@@ -203,7 +211,7 @@ bool vvSlicerManager::SetImage(std::string filename, vvImageReader::LoadedImageT
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetImage(vvImage::Pointer image)\r
-{\r
+{ \r
   mImage=image;\r
   for (unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->SetImage(image);\r
@@ -214,7 +222,7 @@ void vvSlicerManager::SetImage(vvImage::Pointer image)
 \r
 //----------------------------------------------------------------------------\r
 bool vvSlicerManager::SetImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type, int n)\r
-{\r
+{ \r
   mType = type;\r
   std::string fileWithoutExtension = vtksys::SystemTools::GetFilenameWithoutExtension(filenames[0]);\r
   if (type == vvImageReader::DICOM)\r
@@ -254,7 +262,7 @@ bool vvSlicerManager::SetImages(std::vector<std::string> filenames, vvImageReade
 \r
 //----------------------------------------------------------------------------\r
 bool vvSlicerManager::SetOverlay(std::vector<std::string> filenames,int dim, std::string component, vvImageReader::LoadedImageType type)\r
-{\r
+{ \r
   mOverlayName = filenames[0];\r
   mOverlayComponent = component;\r
   if (dim > mImage->GetNumberOfDimensions()) {\r
@@ -280,7 +288,7 @@ bool vvSlicerManager::SetOverlay(std::vector<std::string> filenames,int dim, std
 \r
 //----------------------------------------------------------------------------\r
 bool vvSlicerManager::SetFusion(std::vector<std::string> filenames,int dim, std::string component, vvImageReader::LoadedImageType type)\r
-{\r
+{ \r
   mFusionName = filenames[0];\r
   mFusionComponent = component;\r
   if (dim > mImage->GetNumberOfDimensions()) {\r
@@ -310,7 +318,7 @@ bool vvSlicerManager::SetFusion(std::vector<std::string> filenames,int dim, std:
 //----------------------------------------------------------------------------\r
 //this function is called by vvMainWindow::AddFusionSequence for the primary sequence (CT), while the given files constitute the secondary sequence.\r
 bool vvSlicerManager::SetFusionSequence(std::vector<std::string> filenames, int dim, std::string component, vvImageReader::LoadedImageType type)\r
-{\r
+{ \r
        mFusionSequenceInvolvementCode = 0;\r
 \r
        mFusionName = filenames[0];\r
@@ -359,7 +367,7 @@ bool vvSlicerManager::SetFusionSequence(std::vector<std::string> filenames, int
 \r
 //----------------------------------------------------------------------------\r
 bool vvSlicerManager::SetVF(std::string filename)\r
-{\r
+{ \r
   if (mVectorReader.IsNull())\r
     mVectorReader = vvImageReader::New();\r
   mVectorReader->SetInputFilename(filename);\r
@@ -379,7 +387,7 @@ bool vvSlicerManager::SetVF(std::string filename)
 \r
 //----------------------------------------------------------------------------\r
 bool vvSlicerManager::SetVF(vvImage::Pointer vf,std::string filename)\r
-{\r
+{ \r
   if (vf->GetNumberOfDimensions() > mImage->GetNumberOfDimensions()) {\r
     mLastError = "Sorry, vector field dimension cannot be greater then reference image.";\r
     return false;\r
@@ -406,7 +414,7 @@ bool vvSlicerManager::SetVF(vvImage::Pointer vf,std::string filename)
 \r
 //----------------------------------------------------------------------------\r
 vvSlicer* vvSlicerManager::GetSlicer(int i)\r
-{\r
+{ \r
   return mSlicers[i];\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -414,7 +422,7 @@ vvSlicer* vvSlicerManager::GetSlicer(int i)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::UpdateSlicer(int num, bool state)\r
-{\r
+{ \r
   if (mSlicers[num]->GetImage()) {\r
     mSlicers[num]->SetDisplayMode(state);\r
   }\r
@@ -424,7 +432,7 @@ void vvSlicerManager::UpdateSlicer(int num, bool state)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetSlicerWindow(int i, vtkRenderWindow* RW)\r
-{\r
+{ \r
   mSlicers[i]->SetRenderWindow(i,RW);\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -432,7 +440,7 @@ void vvSlicerManager::SetSlicerWindow(int i, vtkRenderWindow* RW)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetInteractorStyleNavigator(int i, vtkInteractorStyle* style)\r
-{\r
+{ \r
   vvSlicerManagerCommand *smc = vvSlicerManagerCommand::New();\r
   smc->SM = this;\r
   smc->SetSlicerNumber(i);\r
@@ -471,7 +479,7 @@ void vvSlicerManager::SetInteractorStyleNavigator(int i, vtkInteractorStyle* sty
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::LeftButtonReleaseEvent(int slicer)\r
-{\r
+{ \r
   emit LeftButtonReleaseSignal(slicer);\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -479,7 +487,7 @@ void vvSlicerManager::LeftButtonReleaseEvent(int slicer)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::EmitMousePositionUpdated(int slicer)\r
-{\r
+{ \r
   emit MousePositionUpdatedSignal(slicer);\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -487,7 +495,7 @@ void vvSlicerManager::EmitMousePositionUpdated(int slicer)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::EmitKeyPressed(std::string KeyPress)\r
-{\r
+{ \r
   emit KeyPressedSignal(KeyPress);\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -495,7 +503,7 @@ void vvSlicerManager::EmitKeyPressed(std::string KeyPress)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetSliceOrientation(int slicer, int orientation)\r
-{\r
+{ \r
   mSlicers[slicer]->SetSliceOrientation(orientation);\r
   emit UpdateOrientation(slicer, orientation);\r
 }\r
@@ -503,14 +511,14 @@ void vvSlicerManager::SetSliceOrientation(int slicer, int orientation)
 \r
 //----------------------------------------------------------------------------\r
 int vvSlicerManager::GetTSlice()\r
-{\r
+{ \r
   return mSlicers[0]->GetTSlice();\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetTSlice(int slice, bool updateLinkedImages)\r
-{\r
+{ \r
        if (!updateLinkedImages) { //for fusionSequence, TMax / MaxCurrentTSlice are irrelevant.\r
                for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
                        mSlicers[i]->SetTSlice(slice, updateLinkedImages);\r
@@ -537,7 +545,7 @@ void vvSlicerManager::SetTSlice(int slice, bool updateLinkedImages)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetFusionSequenceTSlice(int slice)\r
-{\r
+{ \r
        for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
                mSlicers[i]->SetFusionSequenceTSlice(slice);\r
                UpdateTSlice(i);\r
@@ -548,12 +556,11 @@ void vvSlicerManager::SetFusionSequenceTSlice(int slice)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetNextTSlice(int originating_slicer)\r
-{\r
+{ \r
   int t = mSlicers[0]->GetMaxCurrentTSlice();\r
   t++;\r
   if (t > mSlicers[0]->GetTMax())\r
     t = 0;\r
-  //std::cout << "vvSlicerManager::SetNextTSlice" << std::endl;\r
   emit UpdateTSlice(originating_slicer,t, mFusionSequenceInvolvementCode);\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -561,12 +568,11 @@ void vvSlicerManager::SetNextTSlice(int originating_slicer)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetPreviousTSlice(int originating_slicer)\r
-{\r
+{ \r
   int t = mSlicers[0]->GetMaxCurrentTSlice();\r
   t--;\r
   if (t < 0)\r
     t = mSlicers[0]->GetTMax();\r
-  //std::cout << "vvSlicerManager::SetPreviousTSlice" << std::endl;\r
   emit UpdateTSlice(originating_slicer,t, mFusionSequenceInvolvementCode);\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -574,7 +580,7 @@ void vvSlicerManager::SetPreviousTSlice(int originating_slicer)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::ToggleInterpolation()\r
-{\r
+{ \r
   bool interpolate=!(mSlicers[0]->GetImageActor()->GetInterpolate());\r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->GetImageActor()->SetInterpolate(interpolate);\r
@@ -589,7 +595,7 @@ void vvSlicerManager::ToggleInterpolation()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetTSliceInSlicer(int tslice, int slicer)\r
-{\r
+{ \r
   if (tslice < 0)\r
     tslice = 0;\r
   else if (tslice > mSlicers[slicer]->GetTMax())\r
@@ -615,7 +621,7 @@ void vvSlicerManager::SetTSliceInSlicer(int tslice, int slicer)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetColorWindow(double s)\r
-{\r
+{ \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->SetColorWindow(s);\r
   }\r
@@ -624,7 +630,7 @@ void vvSlicerManager::SetColorWindow(double s)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetColorLevel(double s)\r
-{\r
+{ \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->SetColorLevel(s);\r
   }\r
@@ -633,7 +639,7 @@ void vvSlicerManager::SetColorLevel(double s)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetOverlayColorWindow(double s)\r
-{\r
+{ \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->SetOverlayColorWindow(s);\r
   }\r
@@ -642,7 +648,7 @@ void vvSlicerManager::SetOverlayColorWindow(double s)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetOverlayColorLevel(double s)\r
-{\r
+{ \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->SetOverlayColorLevel(s);\r
   }\r
@@ -651,7 +657,7 @@ void vvSlicerManager::SetOverlayColorLevel(double s)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetLinkOverlayWindowLevel(bool b)\r
-{\r
+{ \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->SetLinkOverlayWindowLevel(b);\r
   }\r
@@ -660,7 +666,7 @@ void vvSlicerManager::SetLinkOverlayWindowLevel(bool b)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetCursorAndCornerAnnotationVisibility(int s)\r
-{\r
+{ \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->SetCursorVisibility(s);\r
     mSlicers[i]->SetCornerAnnotationVisibility(s);\r
@@ -670,7 +676,7 @@ void vvSlicerManager::SetCursorAndCornerAnnotationVisibility(int s)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetOpacity(int i, double factor)\r
-{\r
+{ \r
   mSlicers[i]->SetOpacity(1/factor);\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -678,7 +684,7 @@ void vvSlicerManager::SetOpacity(int i, double factor)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::UpdateViews(int current,int slicer)\r
-{\r
+{ \r
   double p[3], pt[3];\r
   p[0] = mSlicers[slicer]->GetCurrentPosition()[0];\r
   p[1] = mSlicers[slicer]->GetCurrentPosition()[1];\r
@@ -691,7 +697,7 @@ void vvSlicerManager::UpdateViews(int current,int slicer)
     /mSlicers[slicer]->GetInput()->GetSpacing()[1];\r
   double z = (pt[2] - mSlicers[slicer]->GetInput()->GetOrigin()[2])\r
     /mSlicers[slicer]->GetInput()->GetSpacing()[2];\r
-\r
+#if VTK_MAJOR_VERSION <= 5\r
   if (x >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0]-0.5 &&\r
       x <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1]+0.5 &&\r
       y >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2]-0.5 &&\r
@@ -758,13 +764,83 @@ void vvSlicerManager::UpdateViews(int current,int slicer)
       }\r
     }\r
   }\r
+#else\r
+int extentImageReslice[6];\r
+mSlicers[slicer]->GetRegisterExtent(extentImageReslice);\r
+  if (x >= extentImageReslice[0]-0.5 &&\r
+      x <= extentImageReslice[1]+0.5 &&\r
+      y >= extentImageReslice[2]-0.5 &&\r
+      y <= extentImageReslice[3]+0.5 &&\r
+      z >= extentImageReslice[4]-0.5 &&\r
+      z <= extentImageReslice[5]+0.5) {\r
+    mSlicers[slicer]->UpdateCursorPosition();\r
+    mSlicers[slicer]->SetCursorColor(10,212,255);\r
+    mSelectedSlicer = slicer;\r
+\r
+    switch (mSlicers[slicer]->GetSliceOrientation()) {\r
+    case vtkImageViewer2::SLICE_ORIENTATION_XY:\r
+      if (mSlicers[slicer]->GetSlice() != (int)lrint(z))\r
+        mSlicers[slicer]->SetSlice((int)lrint(z));\r
+      break;\r
+\r
+    case vtkImageViewer2::SLICE_ORIENTATION_XZ:\r
+      if (mSlicers[slicer]->GetSlice() != (int)lrint(y))\r
+        mSlicers[slicer]->SetSlice((int)lrint(y));\r
+      break;\r
+\r
+    case vtkImageViewer2::SLICE_ORIENTATION_YZ:\r
+      if (mSlicers[slicer]->GetSlice() != (int)lrint(x))\r
+        mSlicers[slicer]->SetSlice((int)lrint(x));\r
+      break;\r
+    }\r
+    mSlicers[slicer]->Render();\r
+\r
+    for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
+      if (i != (unsigned int)slicer\r
+          && mSlicers[i]->GetRenderer()->GetDraw()\r
+          && mSlicers[i]->GetRenderWindow()->GetSize()[0] > 2\r
+          && mSlicers[i]->GetRenderWindow()->GetSize()[1] > 2) {\r
+        mSlicers[i]->SetCurrentPosition(p[0], p[1], p[2], mSlicers[slicer]->GetMaxCurrentTSlice());\r
+        mSlicers[i]->UpdateCursorPosition();\r
+        if (current) { //do not display corner annotation if image is the one picked\r
+          mSlicers[i]->SetCurrentPosition(-VTK_DOUBLE_MAX,-VTK_DOUBLE_MAX,\r
+                                          -VTK_DOUBLE_MAX, mSlicers[slicer]->GetMaxCurrentTSlice());\r
+          mSlicers[i]->SetCursorColor(255,10,212);\r
+        } else {\r
+          mSlicers[i]->SetCursorColor(150,10,282);\r
+        }\r
+        switch (mSlicers[i]->GetSliceOrientation()) {\r
+        case vtkImageViewer2::SLICE_ORIENTATION_XY:\r
+          if (mSlicers[i]->GetSlice() != (int)lrint(z))\r
+            mSlicers[i]->SetSlice((int)lrint(z));\r
+          break;\r
+\r
+        case vtkImageViewer2::SLICE_ORIENTATION_XZ:\r
+          if (mSlicers[i]->GetSlice() != (int)lrint(y))\r
+            mSlicers[i]->SetSlice((int)lrint(y));\r
+          break;\r
+\r
+        case vtkImageViewer2::SLICE_ORIENTATION_YZ:\r
+          if (mSlicers[i]->GetSlice() != (int)lrint(x))\r
+            mSlicers[i]->SetSlice((int)lrint(x));\r
+          break;\r
+        }\r
+        \r
+        mSlicers[i]->Render();\r
+        \r
+        UpdateSlice(i);\r
+        UpdateTSlice(i);\r
+      }\r
+    }\r
+  }\r
+#endif\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::UpdateLinked(int slicer)\r
-{\r
+{ \r
   double p[3], pt[3];\r
   p[0] = mSlicers[slicer]->GetCurrentPosition()[0];\r
   p[1] = mSlicers[slicer]->GetCurrentPosition()[1];\r
@@ -773,7 +849,7 @@ void vvSlicerManager::UpdateLinked(int slicer)
   double x = (pt[0] - mSlicers[slicer]->GetInput()->GetOrigin()[0]) / mSlicers[slicer]->GetInput()->GetSpacing()[0];\r
   double y = (pt[1] - mSlicers[slicer]->GetInput()->GetOrigin()[1]) / mSlicers[slicer]->GetInput()->GetSpacing()[1];\r
   double z = (pt[2] - mSlicers[slicer]->GetInput()->GetOrigin()[2]) / mSlicers[slicer]->GetInput()->GetSpacing()[2];\r
-\r
+#if VTK_MAJOR_VERSION <= 5\r
   if (x >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0]-0.5 &&\r
       x <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1]+0.5 &&\r
       y >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2]-0.5 &&\r
@@ -790,12 +866,32 @@ void vvSlicerManager::UpdateLinked(int slicer)
                }\r
     }\r
   }\r
+#else\r
+int extentImageReslice[6];\r
+mSlicers[slicer]->GetRegisterExtent(extentImageReslice);\r
+  if (x >= extentImageReslice[0]-0.5 &&\r
+      x <= extentImageReslice[1]+0.5 &&\r
+      y >= extentImageReslice[2]-0.5 &&\r
+      y <= extentImageReslice[3]+0.5 &&\r
+      z >= extentImageReslice[4]-0.5 &&\r
+      z <= extentImageReslice[5]+0.5) {\r
+    for (std::list<std::string>::const_iterator i = mLinkedId.begin(); i != mLinkedId.end(); i++) {\r
+               if (this->IsInvolvedInFusionSequence()) {\r
+                       //this SlicerManager is involved in fusionSequence => do not synchronize the times\r
+                       emit UpdateLinkManager(*i, slicer, p[0], p[1], p[2], -1);\r
+               }\r
+               else {\r
+                       emit UpdateLinkManager(*i, slicer, p[0], p[1], p[2], mSlicers[slicer]->GetMaxCurrentTSlice());\r
+               }\r
+    }\r
+  }\r
+#endif\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::UpdateLinkedNavigation(vvSlicer *refSlicer, bool bPropagate)\r
-{\r
+{ \r
   vtkCamera *refCam = refSlicer->GetRenderer()->GetActiveCamera();\r
 \r
   double refPosition[3];\r
@@ -838,7 +934,7 @@ void vvSlicerManager::UpdateLinkedNavigation(vvSlicer *refSlicer, bool bPropagat
 \r
 //----------------------------------------------------------------------------\r
 double vvSlicerManager::GetColorWindow() const\r
-{\r
+{ \r
   if (mSlicers.size())\r
     return mSlicers[0]->GetColorWindow();\r
   return -1;\r
@@ -848,7 +944,7 @@ double vvSlicerManager::GetColorWindow() const
 \r
 //----------------------------------------------------------------------------\r
 double vvSlicerManager::GetColorLevel() const\r
-{\r
+{ \r
   if (mSlicers.size())\r
     return mSlicers[0]->GetColorLevel();\r
   return -1;\r
@@ -857,7 +953,7 @@ double vvSlicerManager::GetColorLevel() const
 \r
 //----------------------------------------------------------------------------\r
 double vvSlicerManager::GetOverlayColorWindow() const\r
-{\r
+{ \r
   if (mSlicers.size())\r
     return mSlicers[0]->GetOverlayColorWindow();\r
   return -1;\r
@@ -866,7 +962,7 @@ double vvSlicerManager::GetOverlayColorWindow() const
 \r
 //----------------------------------------------------------------------------\r
 double vvSlicerManager::GetOverlayColorLevel() const\r
-{\r
+{ \r
   if (mSlicers.size())\r
     return mSlicers[0]->GetOverlayColorLevel();\r
   return -1;\r
@@ -875,7 +971,7 @@ double vvSlicerManager::GetOverlayColorLevel() const
 \r
 //----------------------------------------------------------------------------\r
 bool vvSlicerManager::GetLinkOverlayWindowLevel() const\r
-{\r
+{ \r
   if (mSlicers.size())\r
     return mSlicers[0]->GetLinkOverlayWindowLevel();\r
   return -1;\r
@@ -884,7 +980,7 @@ bool vvSlicerManager::GetLinkOverlayWindowLevel() const
 \r
 //------------------------------------------------------------------------------\r
 void vvSlicerManager::ResetTransformationToIdentity(const std::string actorType)\r
-{\r
+{ \r
   if(actorType == "image")\r
     for(unsigned int i=0; i<this->GetImage()->GetTransform().size(); i++)\r
       this->GetImage()->GetTransform()[i]->Identity();\r
@@ -913,7 +1009,7 @@ void vvSlicerManager::ResetTransformationToIdentity(const std::string actorType)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::Render()\r
-{\r
+{ \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->Render();\r
   }\r
@@ -923,7 +1019,7 @@ void vvSlicerManager::Render()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::GenerateDefaultLookupTable()\r
-{\r
+{ \r
   SetPreset(mPreset);\r
   SetColorMap(mColorMap);\r
 }\r
@@ -932,7 +1028,7 @@ void vvSlicerManager::GenerateDefaultLookupTable()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::Reload()\r
-{\r
+{ \r
   mReader->Update(mType);\r
   mImage=mReader->GetOutput();\r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
@@ -949,7 +1045,7 @@ void vvSlicerManager::Reload()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::ReloadFusion()\r
-{\r
+{ \r
   mFusionReader->Update(mImage->GetNumberOfDimensions(),mFusionComponent.c_str(),mType);\r
 \r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
@@ -962,7 +1058,7 @@ void vvSlicerManager::ReloadFusion()
 //----------------------------------------------------------------------------\r
 //the secondary sequence is being reloaded.\r
 void vvSlicerManager::ReloadFusionSequence()\r
-{\r
+{ \r
   //  this is to keep the slice thickness, which needs to be artificially increased for visualization\r
   double sp_x, sp_y, sp_z;\r
   this->GetImage()->GetVTKImages()[0]->GetSpacing(sp_x, sp_y, sp_z);\r
@@ -999,7 +1095,7 @@ void vvSlicerManager::ReloadFusionSequence()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::ReloadOverlay()\r
-{\r
+{ \r
   mOverlayReader->Update(mImage->GetNumberOfDimensions(),mOverlayComponent.c_str(),mType);\r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
     mSlicers[i]->SetOverlay(mOverlayReader->GetOutput());\r
@@ -1011,7 +1107,7 @@ void vvSlicerManager::ReloadOverlay()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::ReloadVF()\r
-{\r
+{ \r
   mVectorReader->Update(vvImageReader::VECTORFIELD); //deletes the old images through the VF::Init() function\r
   mVF=mVectorReader->GetOutput();\r
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
@@ -1024,7 +1120,7 @@ void vvSlicerManager::ReloadVF()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::RemoveActor(const std::string& actor_type, int overlay_index)\r
-{\r
+{ \r
   if (actor_type =="overlay")\r
     mOverlayReader = NULL;\r
 \r
@@ -1048,7 +1144,7 @@ void vvSlicerManager::RemoveActor(const std::string& actor_type, int overlay_ind
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::RemoveActors()\r
-{\r
+{ \r
   ///This method leaks a few objects. See RemoveActor for what a\r
   ///correct implementation would look like\r
   //DS -> probably due to the reader (now released in the\r
@@ -1063,7 +1159,7 @@ void vvSlicerManager::RemoveActors()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)\r
-{\r
+{ \r
   //  int view = mSlicers[slicer]->GetSliceOrientation();\r
   //  int slice = mSlicers[slicer]->GetSlice();\r
   double x = mSlicers[slicer]->GetCursorPosition()[0];\r
@@ -1081,7 +1177,8 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
   int displayOver = 0;\r
   int displayFus = 0;\r
   double valueOver=0, valueFus=0;\r
-  if (X >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] &&\r
+#if VTK_MAJOR_VERSION <= 5\r
+    if (X >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] &&\r
       X <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1] &&\r
       Y >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2] &&\r
       Y <= mSlicers[slicer]->GetInput()->GetWholeExtent()[3] &&\r
@@ -1140,13 +1237,76 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
     emit UpdateOverlay(displayOver,valueOver,value);\r
     emit UpdateFusion(displayFus,valueFus);\r
   }\r
+#else\r
+int extentImageReslice[6];\r
+mSlicers[slicer]->GetRegisterExtent(extentImageReslice);\r
+    if (X >= extentImageReslice[0] &&\r
+      X <= extentImageReslice[1] &&\r
+      Y >= extentImageReslice[2] &&\r
+      Y <= extentImageReslice[3] &&\r
+      Z >= extentImageReslice[4] &&\r
+      Z <= extentImageReslice[5]) {\r
+\r
+    value = this->GetScalarComponentAsDouble(mSlicers[slicer]->GetInput(), X, Y, Z);\r
+\r
+    if (mSlicers[slicer]->GetVFActor() ) {\r
+      displayVec = 1;\r
+      unsigned int currentTime = mSlicers[slicer]->GetMaxCurrentTSlice();\r
+      vtkImageData *vf = NULL;\r
+\r
+      if (mSlicers[slicer]->GetVF()->GetVTKImages().size() > currentTime)\r
+        vf = mSlicers[slicer]->GetVF()->GetVTKImages()[currentTime];\r
+      else\r
+        vf = mSlicers[slicer]->GetVF()->GetVTKImages()[0];\r
+\r
+      if (vf) {\r
+        double Xvf = (x - vf->GetOrigin()[0])/ vf->GetSpacing()[0];\r
+        double Yvf = (y - vf->GetOrigin()[1])/ vf->GetSpacing()[1];\r
+        double Zvf = (z - vf->GetOrigin()[2])/ vf->GetSpacing()[2];\r
+        xVec = this->GetScalarComponentAsDouble( vf, Xvf, Yvf, Zvf, 0);\r
+        yVec = this->GetScalarComponentAsDouble( vf, Xvf, Yvf, Zvf, 1);\r
+        zVec = this->GetScalarComponentAsDouble( vf, Xvf, Yvf, Zvf, 2);\r
+        valueVec = sqrt(xVec*xVec + yVec*yVec + zVec*zVec);\r
+      }\r
+    }\r
+    if (mSlicers[slicer]->GetOverlayActor() ) {\r
+      displayOver = 1;\r
+      vtkImageData *overlay = dynamic_cast<vtkImageData*>(mSlicers[slicer]->GetOverlayMapper()->GetInput());\r
+      double Xover = (x - overlay->GetOrigin()[0]) / overlay->GetSpacing()[0];\r
+      double Yover = (y - overlay->GetOrigin()[1]) / overlay->GetSpacing()[1];\r
+      double Zover = (z - overlay->GetOrigin()[2]) / overlay->GetSpacing()[2];\r
+      valueOver = this->GetScalarComponentAsDouble(overlay, Xover, Yover, Zover);\r
+    }\r
+\r
+       if ( mSlicers[slicer]->GetFusionActor() ) {\r
+               displayFus = 1;\r
+               vtkImageData *fusion = dynamic_cast<vtkImageData*>(mSlicers[slicer]->GetFusionMapper()->GetInput());\r
+               double Xover = (x - fusion->GetOrigin()[0]) / fusion->GetSpacing()[0];\r
+               double Yover = (y - fusion->GetOrigin()[1]) / fusion->GetSpacing()[1];\r
+               double Zover = (z - fusion->GetOrigin()[2]) / fusion->GetSpacing()[2];\r
+               valueFus = this->GetScalarComponentAsDouble(fusion, Xover, Yover, Zover);\r
+       }\r
+       else if (this->IsInvolvedInFusionSequence()) { \r
+    //if the cursor moves over the 'independent' version of the secondary sequence\r
+    //do not update the panel, just keep it as it is.\r
+               displayFus = 1;\r
+               valueFus = std::numeric_limits<double>::quiet_NaN();\r
+       }\r
+\r
+    emit UpdatePosition(mSlicers[slicer]->GetCursorVisibility(),\r
+                        x,y,z,X,Y,Z,value);\r
+    emit UpdateVector(displayVec,xVec, yVec, zVec, valueVec);\r
+    emit UpdateOverlay(displayOver,valueOver,value);\r
+    emit UpdateFusion(displayFus,valueFus);\r
+  }\r
+#endif\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::Activated()\r
-{\r
+{ \r
   emit currentImageChanged(mId);\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -1154,7 +1314,7 @@ void vvSlicerManager::Activated()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::Picked()\r
-{\r
+{ \r
   emit currentPickedImageChanged(mId);\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -1162,7 +1322,7 @@ void vvSlicerManager::Picked()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::UpdateWindowLevel()\r
-{\r
+{ \r
   emit WindowLevelChanged();\r
 }\r
 //----------------------------------------------------------------------------\r
@@ -1170,12 +1330,11 @@ void vvSlicerManager::UpdateWindowLevel()
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::UpdateSlice(int slicer)\r
-{\r
+{ \r
   if (mPreviousSlice[slicer] == mSlicers[slicer]->GetSlice()) {\r
     //DD("============= NOTHING");\r
     return;\r
   }\r
-  //std::cout << "vvSlicerManager::UpdateSlice " << slicer << " " << mSlicers[slicer]->GetSlice() << std::endl;\r
   emit UpdateSlice(slicer, mSlicers[slicer]->GetSlice());\r
   mSlicers[slicer]->Render(); // DS <-- I add this, this could/must be the only Render ...\r
   mPreviousSlice[slicer] = mSlicers[slicer]->GetSlice();\r
@@ -1185,7 +1344,7 @@ void vvSlicerManager::UpdateSlice(int slicer)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::UpdateTSlice(int slicer)\r
-{\r
+{ \r
   int slice = mSlicers[slicer]->GetSlice();\r
 \r
   int tslice = mSlicers[slicer]->GetMaxCurrentTSlice();\r
@@ -1207,7 +1366,7 @@ void vvSlicerManager::UpdateTSlice(int slicer)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::UpdateSliceRange(int slicer)\r
-{\r
+{ \r
   emit UpdateSliceRange(slicer,\r
                         mSlicers[slicer]->GetSliceRange()[0], mSlicers[slicer]->GetSliceRange()[1],\r
                         0,mSlicers[slicer]->GetTMax());\r
@@ -1216,7 +1375,7 @@ void vvSlicerManager::UpdateSliceRange(int slicer)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetSlicingPreset(SlicingPresetType preset)\r
-{\r
+{ \r
   if(mSlicingPreset==preset)\r
     return;\r
 \r
@@ -1238,8 +1397,15 @@ void vvSlicerManager::SetSlicingPreset(SlicingPresetType preset)
       return;\r
     }\r
     s->ForceUpdateDisplayExtent();\r
+#if VTK_MAJOR_VERSION <= 5\r
     s->SetSlice((s->GetInput()->GetWholeExtent()[s->GetSliceOrientation()*2+1]\r
                 +s->GetInput()->GetWholeExtent()[s->GetSliceOrientation()*2])/2.0);\r
+#else\r
+    int extentImageReslice[6];\r
+    s->GetRegisterExtent(extentImageReslice);\r
+    s->SetSlice((extentImageReslice[s->GetSliceOrientation()*2+1]\r
+                +extentImageReslice[s->GetSliceOrientation()*2])/2.0);\r
+#endif\r
     s->ResetCamera();\r
     s->Render();\r
   }\r
@@ -1252,7 +1418,7 @@ void vvSlicerManager::SetSlicingPreset(SlicingPresetType preset)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetPreset(int preset)\r
-{\r
+{ \r
 \r
   //vtkLookupTable* LUT = static_cast<vtkLookupTable*>(mSlicers[0]->GetWindowLevel()->GetLookupTable());\r
   double window = mSlicers[0]->GetColorWindow();\r
@@ -1311,7 +1477,7 @@ void vvSlicerManager::SetPreset(int preset)
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlKey)\r
-{\r
+{ \r
   double min, max;\r
   if(bCtrlKey && this->mSlicers[slicer]->GetFusion()) {\r
     int t = mSlicers[slicer]->GetFusionTSlice();\r
@@ -1352,7 +1518,7 @@ void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlK
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::SetColorMap(int colormap)\r
-{\r
+{ \r
   double range[2];\r
 \r
   range[0] = mSlicers[0]->GetInput()->GetScalarRange()[0];\r
@@ -1451,7 +1617,6 @@ void vvSlicerManager::SetColorMap(int colormap)
 \r
     fusLUT->ForceBuild();\r
     double v[4];\r
-\r
     // set color table transparency\r
     //double alpha_range=(double)mFusionThresOpacity/10;\r
     double range_end = fusRange[0] + (double)mFusionThresOpacity*(fusRange[1] - fusRange[0])/100;\r
@@ -1507,7 +1672,7 @@ void vvSlicerManager::SetColorMap(int colormap)
 \r
 //----------------------------------------------------------------------------\r
 vvLandmarks* vvSlicerManager::GetLandmarks()\r
-{\r
+{ \r
   if (mLandmarks == NULL) {\r
     mLandmarks = new vvLandmarks(mSlicers[0]->GetTMax()+1);\r
     for (unsigned int i = 0; i < mSlicers.size(); i++)\r
@@ -1516,14 +1681,18 @@ vvLandmarks* vvSlicerManager::GetLandmarks()
   return mLandmarks;\r
 }\r
 //----------------------------------------------------------------------------\r
-\r
+void vvSlicerManager::AddNewLandmark(float x,float y,float z,float t)\r
+{ \r
+    emit callAddLandmark(x,y,z,t);\r
+}\r
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::AddLandmark(float x,float y,float z,float t)\r
-{\r
+{ \r
   double x_index = (x - mSlicers[0]->GetInput()->GetOrigin()[0])/mSlicers[0]->GetInput()->GetSpacing()[0];\r
   double y_index = (y - mSlicers[0]->GetInput()->GetOrigin()[1])/mSlicers[0]->GetInput()->GetSpacing()[1];\r
   double z_index = (z - mSlicers[0]->GetInput()->GetOrigin()[2])/mSlicers[0]->GetInput()->GetSpacing()[2];\r
+#if VTK_MAJOR_VERSION <= 5\r
   if (x_index >= mSlicers[0]->GetInput()->GetWholeExtent()[0]-0.5 &&\r
       x_index <= mSlicers[0]->GetInput()->GetWholeExtent()[1]+0.5 &&\r
       y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2]-0.5 &&\r
@@ -1534,26 +1703,72 @@ void vvSlicerManager::AddLandmark(float x,float y,float z,float t)
     this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
     emit LandmarkAdded();\r
   }\r
+#else\r
+  int extentImageReslice[6];\r
+  mSlicers[0]->GetRegisterExtent(extentImageReslice);\r
+  if (x_index >= extentImageReslice[0]-0.5 &&\r
+      x_index <= extentImageReslice[1]+0.5 &&\r
+      y_index >= extentImageReslice[2]-0.5 &&\r
+      y_index <= extentImageReslice[3]+0.5 &&\r
+      z_index >= extentImageReslice[4]-0.5 &&\r
+      z_index <= extentImageReslice[5]+0.5) {\r
+    double value = this->GetScalarComponentAsDouble(mImage->GetVTKImages()[mSlicers[0]->GetTSlice()], x_index, y_index, z_index);\r
+    this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
+    emit LandmarkAdded();\r
+  }\r
+#endif\r
+}\r
+//----------------------------------------------------------------------------\r
+\r
+//----------------------------------------------------------------------------\r
+void vvSlicerManager::AddLandmarkProfile(float x,float y,float z,float t)\r
+{ \r
+  double x_index = (x - mSlicers[0]->GetInput()->GetOrigin()[0])/mSlicers[0]->GetInput()->GetSpacing()[0];\r
+  double y_index = (y - mSlicers[0]->GetInput()->GetOrigin()[1])/mSlicers[0]->GetInput()->GetSpacing()[1];\r
+  double z_index = (z - mSlicers[0]->GetInput()->GetOrigin()[2])/mSlicers[0]->GetInput()->GetSpacing()[2];\r
+#if VTK_MAJOR_VERSION <= 5\r
+  if (x_index >= mSlicers[0]->GetInput()->GetWholeExtent()[0]-0.5 &&\r
+      x_index <= mSlicers[0]->GetInput()->GetWholeExtent()[1]+0.5 &&\r
+      y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2]-0.5 &&\r
+      y_index <= mSlicers[0]->GetInput()->GetWholeExtent()[3]+0.5 &&\r
+      z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4]-0.5 &&\r
+      z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]+0.5) {\r
+    double value = this->GetScalarComponentAsDouble(mSlicers[0]->GetInput(), x_index, y_index, z_index);\r
+    this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
+  }\r
+#else\r
+  int extentImageReslice[6];\r
+  mSlicers[0]->GetRegisterExtent(extentImageReslice);\r
+  if (x_index >= extentImageReslice[0]-0.5 &&\r
+      x_index <= extentImageReslice[1]+0.5 &&\r
+      y_index >= extentImageReslice[2]-0.5 &&\r
+      y_index <= extentImageReslice[3]+0.5 &&\r
+      z_index >= extentImageReslice[4]-0.5 &&\r
+      z_index <= extentImageReslice[5]+0.5) {\r
+    double value = this->GetScalarComponentAsDouble(mImage->GetVTKImages()[mSlicers[0]->GetTSlice()], x_index, y_index, z_index);\r
+    this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
+  }\r
+#endif\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::PrevImage(int slicer)\r
-{\r
+{ \r
   emit ChangeImageWithIndexOffset(this, slicer, -1);\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::NextImage(int slicer)\r
-{\r
+{ \r
   emit ChangeImageWithIndexOffset(this, slicer,  1);\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
 //----------------------------------------------------------------------------\r
 void vvSlicerManager::VerticalSliderHasChanged(int slicer, int slice)\r
-{\r
+{ \r
   emit AVerticalSliderHasChanged(slicer, slice);\r
 }\r
 \r
@@ -1561,7 +1776,7 @@ void vvSlicerManager::VerticalSliderHasChanged(int slicer, int slice)
 \r
 //----------------------------------------------------------------------------\r
 double vvSlicerManager::GetScalarComponentAsDouble(vtkImageData *image, double X, double Y, double Z, int component)\r
-{\r
+{ \r
   int ix, iy, iz;\r
   return mSlicers[0]->GetScalarComponentAsDouble(image, X, Y, Z, ix, iy, iz, component);\r
 }\r
index bbdd2a41dad6cfb36c24f8c5d8a143f69dd9e7f6..e80ef485f8e54ea9de07b18957b04db35531b039 100644 (file)
@@ -274,7 +274,8 @@ class vvSlicerManager : public QObject {
   void SetSlicingPreset(SlicingPresetType preset);
 
   vvLandmarks *GetLandmarks();
-  void AddLandmark(float x,float y,float z,float t);
+  void AddNewLandmark(float x,float y,float z,float t);
+  void AddLandmarkProfile(float x,float y,float z,float t);
   
   void NextImage(int slicer);
   void PrevImage(int slicer);
@@ -282,7 +283,11 @@ class vvSlicerManager : public QObject {
   void VerticalSliderHasChanged(int slicer, int slice);
   double GetScalarComponentAsDouble(vtkImageData *image, double X, double Y, double Z, int component=0);
 
+public slots:
+  void AddLandmark(float x,float y,float z,float t);
+
 signals :
+  void callAddLandmark(float x,float y,float z,float t);
   void currentImageChanged(std::string id);
   void currentPickedImageChanged(std::string id);
   void UpdatePosition(int visibility,double x, double y, double z, double X, double Y, double Z, double value);
index f5d2b699bd495e881d533abaad7c20a43d511c83..07164f69ad56ed1a2073282fe3a235dc92a8fba5 100644 (file)
@@ -38,7 +38,6 @@
 #include "vtkTransform.h"
 
 #include <cmath>
-
 //------------------------------------------------------------------------------
 vvSlicerManagerCommand::vvSlicerManagerCommand()
 {
@@ -112,53 +111,53 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
           this->SM->SetLocalColorWindowing(VisibleInWindow, bCtrlKey);
           return;
         }
-        if (KeyPress == "0") {
+        if (KeyPress == "0" || KeyPress == "KP_0") {
           this->SM->SetPreset(WL_AUTO);
           this->SM->UpdateWindowLevel();
           return;
         }
-        if (KeyPress == "1") {
+        if (KeyPress == "1" || KeyPress == "KP_1") {
           this->SM->SetPreset(WL_HOUNSFIELD);
           this->SM->UpdateWindowLevel();
           return;
         }
-        if (KeyPress == "2") {
+        if (KeyPress == "2" || KeyPress == "KP_2") {
           this->SM->SetPreset(WL_SOFTTISSUE);
           this->SM->UpdateWindowLevel();
 
           return;
         }
-        if (KeyPress == "3") {
+        if (KeyPress == "3" || KeyPress == "KP_3") {
           this->SM->SetPreset(WL_LUNGS);
           this->SM->UpdateWindowLevel();
           return;
         }
-        if (KeyPress == "4") {
+        if (KeyPress == "4" || KeyPress == "KP_4") {
           this->SM->SetPreset(WL_BONES);
           this->SM->UpdateWindowLevel();
           return;
         }
-        if (KeyPress == "5") {
+        if (KeyPress == "5" || KeyPress == "KP_5") {
           this->SM->SetPreset(WL_HEAD);
           this->SM->UpdateWindowLevel();
           return;
         }
-        if (KeyPress == "6") {
+        if (KeyPress == "6" || KeyPress == "KP_6") {
           this->SM->SetColorMap(0);
           this->SM->UpdateWindowLevel();
           return;
         }
-        if (KeyPress == "7") {
+        if (KeyPress == "7" || KeyPress == "KP_7") {
           this->SM->SetColorMap(1);
           this->SM->UpdateWindowLevel();
           return;
         }
-        if (KeyPress == "8") {
+        if (KeyPress == "8" || KeyPress == "KP_8") {
           this->SM->SetColorMap(2);
           this->SM->UpdateWindowLevel();
           return;
         }
-        if (KeyPress == "9") {
+        if (KeyPress == "9" || KeyPress == "KP_9") {
           this->SM->SetColorMap(3);
           this->SM->UpdateWindowLevel();
           return;
@@ -382,9 +381,10 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
       //>>>>>>> 921642d767beba2442dacc8fdb40dc36396e1b7d
 
       if (newLandmark) {
-        this->SM->AddLandmark(xWorld,yWorld,zWorld,
+        this->SM->AddNewLandmark(xWorld,yWorld,zWorld,
                               this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
-        this->SM->GetSlicer(VisibleInWindow)->UpdateLandmarks();
+        this->SM->GetSlicer(VisibleInWindow)->RemoveLandmarks();
+        //this->SM->GetSlicer(VisibleInWindow)->DisplayLandmarks();
         this->SM->Render();
       }
       if (event == vtkCommand::PickEvent || event == vtkCommand::StartPickEvent) {
index 0645ccfa95e8ea3c16d5c959a2cb35d6f7afd5e5..e8a6acb231dc06bc6f01cd790a60f85b0b201aa9 100644 (file)
@@ -24,7 +24,7 @@
 #include "vtkOBJReader.h"
 #include "vtkInteractorStyle.h"
 
-
+#include <vtkVersion.h>
 #include "vtkPolyDataMapper.h"
 #include "vtkActor.h"
 #include "vtkPolyData.h"
@@ -33,6 +33,7 @@
 #include "vtkRenderer.h"
 
 #include <QMessageBox>
+#include <QFileDialog>
 
 //----------------------------------------------------------------------------
 class vvManagerCallback : public vtkCommand
@@ -110,8 +111,11 @@ void vvSurfaceViewerDialog::LoadSurface()
     reader->Update();
     mReaders.push_back(reader);
   }
-
+#if VTK_MAJOR_VERSION <= 5
   mMapper->SetInput(mReaders[mCurrentTime]->GetOutput());
+#else
+  mMapper->SetInputConnection(mReaders[mCurrentTime]->GetOutputPort());
+#endif
 
   if (!mActor) {
     mActor = vtkActor::New();
@@ -140,7 +144,11 @@ void vvSurfaceViewerDialog::NextTime()
   mCurrentTime++;
   if (mCurrentTime >= mReaders.size())
     mCurrentTime = 0;
+#if VTK_MAJOR_VERSION <= 5
   mMapper->SetInput(mReaders[mCurrentTime]->GetOutput());
+#else
+  mMapper->SetInputConnection(mReaders[mCurrentTime]->GetOutputPort());
+#endif
   mMapper->Modified();
   renderWidget->GetRenderWindow()->Render();
 }
@@ -150,7 +158,11 @@ void vvSurfaceViewerDialog::PreviousTime()
   mCurrentTime--;
   if (mCurrentTime < 0)
     mCurrentTime = (unsigned int) mReaders.size() - 1;
+#if VTK_MAJOR_VERSION <= 5
   mMapper->SetInput(mReaders[mCurrentTime]->GetOutput());
+#else
+  mMapper->SetInputConnection(mReaders[mCurrentTime]->GetOutputPort());
+#endif
   mMapper->Modified();
   renderWidget->GetRenderWindow()->Render();
 }
index 88a75a6924081fd4eca777d21dbed1c311dffac6..ff9f0be7a056f92aea349387c7fe0d982709261c 100644 (file)
@@ -23,7 +23,11 @@ class vtkPolyDataMapper;
 class vtkActor;
 class vtkOBJReader;
 
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include <QTreeWidget>
 
 //====================================================================
index 9859d01adcc101812cd644e4e15b966fbc657f9c..5fce5d9d538337deadd5cb650a6d7681b103e58d 100644 (file)
@@ -31,6 +31,7 @@
 #include <vtkImageClip.h>
 #include <vtkRenderWindow.h>
 
+
 //------------------------------------------------------------------------------
 // Create the tool and automagically (I like this word) insert it in
 // the main window menu.
@@ -40,7 +41,7 @@ ADD_TOOL(vvToolBinarize);
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::Initialize()
-{
+{ 
   SetToolName("Binarize");
   SetToolMenuName("Binarize");
   SetToolIconFilename(":/common/icons/binarize.png");
@@ -54,7 +55,7 @@ vvToolBinarize::vvToolBinarize(vvMainWindowBase * parent, Qt::WindowFlags f)
   :vvToolWidgetBase(parent,f),
    vvToolBase<vvToolBinarize>(parent),
    Ui::vvToolBinarize()
-{
+{ 
   // GUI Initialization
   Ui_vvToolBinarize::setupUi(mToolWidget);
   mInteractiveDisplayIsEnabled = mCheckBoxInteractiveDisplay->isChecked();
@@ -82,14 +83,14 @@ vvToolBinarize::vvToolBinarize(vvMainWindowBase * parent, Qt::WindowFlags f)
 
 //------------------------------------------------------------------------------
 vvToolBinarize::~vvToolBinarize()
-{
+{ 
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::InteractiveDisplayToggled(bool b)
-{
+{ 
   mInteractiveDisplayIsEnabled = b;
   if (!mInteractiveDisplayIsEnabled) {
     RemoveVTKObjects();
@@ -108,7 +109,7 @@ void vvToolBinarize::InteractiveDisplayToggled(bool b)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::RemoveVTKObjects()
-{
+{ 
   for(unsigned int i=0; i<mImageContour.size(); i++) {
     mImageContour[i]->HideActors();
     mImageContourLower[i]->HideActors();    
@@ -121,7 +122,7 @@ void vvToolBinarize::RemoveVTKObjects()
 
 //------------------------------------------------------------------------------
 bool vvToolBinarize::close()
-{
+{ 
   // RemoveVTKObjects();
   return vvToolWidgetBase::close();
 }
@@ -129,7 +130,8 @@ bool vvToolBinarize::close()
 
 
 //------------------------------------------------------------------------------
-void vvToolBinarize::closeEvent(QCloseEvent *event) {
+void vvToolBinarize::closeEvent(QCloseEvent *event)
+{ 
   RemoveVTKObjects();
   event->accept();
 }
@@ -138,7 +140,7 @@ void vvToolBinarize::closeEvent(QCloseEvent *event) {
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::reject()
-{
+{ 
   // DD("vvToolBinarize::reject");
   RemoveVTKObjects();
   return vvToolWidgetBase::reject();
@@ -148,7 +150,7 @@ void vvToolBinarize::reject()
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::enableLowerThan(bool b)
-{
+{ 
   if (!b) {
     mThresholdSlider1->resetMaximum();
     for(unsigned int i=0; i<mImageContour.size(); i++) {
@@ -169,7 +171,7 @@ void vvToolBinarize::enableLowerThan(bool b)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::useFGBGtoggled(bool)
-{
+{ 
   if (!mCheckBoxUseBG->isChecked() && !mCheckBoxUseFG->isChecked())
     mCheckBoxUseBG->toggle();
 }
@@ -182,7 +184,7 @@ void vvToolBinarize::useFGBGtoggled(bool)
 //   DD(m.size());
 // }
 void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
-{
+{ 
   mCurrentSlicerManager = m;
 
   // Specific for this gui
@@ -214,7 +216,7 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
     mImageContour.push_back(vvImageContour::New());
     mImageContour[i]->SetSlicer(mCurrentSlicerManager->GetSlicer(i));
     mImageContour[i]->SetColor(1.0, 0.0, 0.0);
-    mImageContour[i]->SetDepth(100); // to be in front of (whe used with ROI tool)
+    mImageContour[i]->SetDepth(0); // to be in front of (whe used with ROI tool)
     mImageContourLower.push_back(vvImageContour::New());
     mImageContourLower[i]->SetSlicer(mCurrentSlicerManager->GetSlicer(i));
     mImageContourLower[i]->SetColor(0.0, 0.0, 1.0);
@@ -231,7 +233,6 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
   connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateOrientation(int, int)));
 
   //  connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int)));
-  
   InteractiveDisplayToggled(mInteractiveDisplayIsEnabled);
 }
 //------------------------------------------------------------------------------
@@ -250,21 +251,21 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::UpdateOrientation(int slicer,int orientation)
-{
+{ 
   Update(slicer);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::UpdateSlice(int slicer,int slices)
-{
+{ 
   Update(slicer);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::Update(int slicer)
-{
+{ 
   if (!mInteractiveDisplayIsEnabled) return;
   if (!mCurrentSlicerManager) close();
   mImageContour[slicer]->Update(mThresholdSlider1->GetValue());
@@ -275,7 +276,7 @@ void vvToolBinarize::Update(int slicer)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::GetArgsInfoFromGUI()
-{
+{ 
 
   /* //KEEP THIS FOR READING GGO FROM FILE
      int argc=1;
@@ -330,11 +331,11 @@ void vvToolBinarize::GetArgsInfoFromGUI()
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::apply()
-{
+{ 
   if (!mCurrentSlicerManager) close();
   QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-  GetArgsInfoFromGUI();
-
+  GetArgsInfoFromGUI();  
+  
   // Main filter
   clitk::BinarizeImageGenericFilter::Pointer filter =
     clitk::BinarizeImageGenericFilter::New();
@@ -342,8 +343,9 @@ void vvToolBinarize::apply()
   filter->SetArgsInfo(mArgsInfo);
   filter->Update();
 
+
   // Output
-  vvImage::Pointer output = filter->GetOutputVVImage();
+  vvImage::Pointer output = filter->GetOutputVVImage();  
   std::ostringstream osstream;
   osstream << "Binarized_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName() << ".mhd";
   AddImage(output,osstream.str());
@@ -355,7 +357,7 @@ void vvToolBinarize::apply()
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::valueChangedT2(double v)
-{
+{ 
   //  DD("valueChangedT2");
   if (mRadioButtonLowerThan->isChecked()) {
     mThresholdSlider1->SetMaximum(v);
@@ -371,7 +373,7 @@ void vvToolBinarize::valueChangedT2(double v)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::valueChangedT1(double v)
-{
+{ 
   //  DD("valueChangedT1");
   if (!mCurrentSlicerManager) close();
   mThresholdSlider2->SetMinimum(v);
index 9e61e683cd284872456b3d5030fbdbef1987af90..c0aa6d9fe6bbcd65326b2f7be3bb22045ddc6078 100644 (file)
 #ifndef VVTOOLBINARIZE_H
 #define VVTOOLBINARIZE_H
 
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
index c3b55709722033a6445b9b3d0fb0c239ec1d5628..2de985882c6eec8dc002d26913ba26a51cb151ef 100644 (file)
@@ -33,6 +33,9 @@
 #include <QSignalMapper>
 
 // vtk
+#include <vtkVersion.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkInformation.h>
 #include <vtkImageClip.h>
 #include <vtkImageTranslateExtent.h>
 #include <vtkImageData.h>
@@ -96,9 +99,11 @@ void vvToolCropImage::closeEvent(QCloseEvent *event)
 {
   if(mCurrentSlicerManager){
 //     Reset extends
-    for(int i=0; i<mExtentSize; i++){
+    for(int i=0; i<6; i++){
       mReducedExtent[i] = mInitialExtent[i];
     }
+    for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++)
+      mCurrentSlicerManager->GetSlicer(i)->EnableReducedExtent(false);
     UpdateExtent();
   }
   vvToolWidgetBase::closeEvent(event);
@@ -117,7 +122,10 @@ bool vvToolCropImage::close()
 //------------------------------------------------------------------------------
 void vvToolCropImage::reject()
 {
-  for(int i=0; i<mExtentSize; i++) mReducedExtent[i] = mInitialExtent[i];
+  for(int i=0; i<mExtentSize; i++)
+    mReducedExtent[i] = mInitialExtent[i];
+  for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++)
+    mCurrentSlicerManager->GetSlicer(i)->EnableReducedExtent(false);
   UpdateExtent();
   return vvToolWidgetBase::reject();
 }
@@ -173,8 +181,11 @@ void vvToolCropImage::InputIsSelected(vvSlicerManager * slicer)
     spin_zmin->setHidden(true);
     spin_zmax->setHidden(true);
   }
-
+#if VTK_MAJOR_VERSION <= 5
   int *a = mCurrentImage->GetFirstVTKImageData()->GetWholeExtent();
+#else
+  int *a = mCurrentImage->GetFirstVTKImageData()->GetInformation()->Get(vtkDataObject::DATA_EXTENT());
+#endif
   for(int i=0; i<6; i++){
     mInitialExtent[i] = a[i];
     mReducedExtent[i] = a[i];
@@ -185,8 +196,10 @@ void vvToolCropImage::InputIsSelected(vvSlicerManager * slicer)
   }
 
 //   Set initial sliders values
-  std::vector<int> imsize = mCurrentSlicerManager->GetImage()->GetSize();
+  int w_ext[6], imsize[3];
+  mCurrentSlicerManager->GetSlicer(0)->GetRegisterExtent(w_ext);
   for(int dim=0; dim<slicer->GetDimension() && dim<3; ++dim){
+    imsize[dim] = w_ext[2*dim+1] - w_ext[2*dim] +1;
     mSliders[dim*2]->setMaximum(imsize[dim]-1);
     mSliders[dim*2+1]->setMaximum(imsize[dim]-1);
     mSliders[dim*2+1]->setValue(imsize[dim]-1);
@@ -257,7 +270,7 @@ void vvToolCropImage::apply()
   }
   // We MUST reset initial extend to input image before using the
   // filter to retrieve the correct image size
-  for(int i=0; i<mExtentSize; i++) {
+  for(int i=0; i<6; i++) {
     mReducedExtent[i] = mInitialExtent[i];
   }
   
index 27a334c3de83c5b7d4e3db96bc0abeda7261b182..11ee8def9e7f5bfd8b26bacf6b64d0fd7ca058a8 100644 (file)
 #define VVTOOLCROPIMAGE_H
 
 //qt
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include <QDialog>
 #include <QSlider>
 // vv
index 81919ceb0dbf8f5b013e19ae141d9c93165bef33..e4f1b3422694383bcf0da2e0ce176eaed683e4e7 100644 (file)
 ===========================================================================**/
 #ifndef VVTOOLImageArithm_H
 #define VVTOOLImageArithm_H
+
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
index b33ca5c2c1775f0478bab421cfe551e2c91f54ee..4bc487fdbef98879c4b7f630e9ffda3d6a84c483 100644 (file)
 #define VVTOOLINPUTSELECTORWIDGET_H
 
 // qt
+#include <QObject>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include <QDialog>
 
 // vv
index 6975c0e3042e947f7ad44591a11e71efdbda8c6b..8ee1410d570d69dcd5659cf7c9e7c8b71e8fb4c6 100644 (file)
@@ -47,7 +47,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #include <vvImage.h>
 
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include "vvToolBase.h"
 #include "QWidget"
 #include "vvToolWidgetBase.h"
index 5f66395dff4dd13ea1f72416656fed2c749061fd..af2bbf81345d196f37c9b5926372bd7b87180bde 100644 (file)
   #ifndef VVTOOLMedianFilter_H
   #define VVTOOLMedianFilter_H
 
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
   #include <QtDesigner/QDesignerExportWidget>
+#else
+  #include <QtUiPlugin/QDesignerExportWidget>
+#endif
   #include "vvToolBase.h"
   #include "QWidget"
   #include "vvToolWidgetBase.h"
diff --git a/vv/vvToolProfile.cxx b/vv/vvToolProfile.cxx
new file mode 100644 (file)
index 0000000..96b463f
--- /dev/null
@@ -0,0 +1,683 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  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
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+  ===========================================================================**/
+
+#include <QFileDialog>
+#include <QShortcut>
+
+#include <algorithm>
+
+// vv
+#include "vvToolProfile.h"
+#include "vvProgressDialog.h"
+#include "vvSlicerManager.h"
+#include "vvSlicer.h"
+#include "vvToolInputSelectorWidget.h"
+
+// vtk
+#include <vtkAxis.h>
+#include <vtkImageActor.h>
+#include <vtkCamera.h>
+#include <vtkImageClip.h>
+#include <vtkRenderWindow.h>
+#include <vtkChartXY.h>
+#include <vtkPlot.h>
+#include <vtkRendererCollection.h>
+#include <vtkRenderer.h>
+
+#include <vtkLine.h>
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkProperty.h>
+#include <vtkBox.h>
+#include <vtkInformation.h>
+
+//------------------------------------------------------------------------------
+// Create the tool and automagically (I like this word) insert it in
+// the main window menu.
+ADD_TOOL(vvToolProfile);
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::Initialize()
+{ 
+  SetToolName("Profile");
+  SetToolMenuName("Intensity Profile");
+  SetToolIconFilename(":/common/icons/profile.png");
+  SetToolTip("Display the intensity profile between 2 points of the image.");
+  SetToolExperimental(false);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolProfile::vvToolProfile(vvMainWindowBase * parent, Qt::WindowFlags f)
+  :vvToolWidgetBase(parent,f),
+   vvToolBase<vvToolProfile>(parent),
+   Ui::vvToolProfile()
+{ 
+  // GUI Initialization
+  Ui_vvToolProfile::setupUi(mToolWidget);
+  
+  QShortcut *shortcutPoint1 = new QShortcut(QKeySequence("Ctrl+1"), parent);
+  shortcutPoint1->setContext(Qt::ApplicationShortcut);
+  QObject::connect(shortcutPoint1, SIGNAL(activated()), this, SLOT(selectPoint1()));
+  QShortcut *shortcutPoint2 = new QShortcut(QKeySequence("Ctrl+2"), parent);
+  shortcutPoint2->setContext(Qt::ApplicationShortcut);
+  QObject::connect(shortcutPoint2, SIGNAL(activated()), this, SLOT(selectPoint2()));
+
+  // Connect signals & slots
+  connect(mSelectPoint1Button, SIGNAL(clicked()), this, SLOT(selectPoint1()));
+  connect(mSelectPoint2Button, SIGNAL(clicked()), this, SLOT(selectPoint2()));
+  connect(mCancelPointsButton, SIGNAL(clicked()), this, SLOT(cancelPoints()));
+  connect(mSaveProfileButton, SIGNAL(clicked()), this, SLOT(SaveAs()));
+
+  // Initialize some widget
+  ProfileWidget->hide();
+  mPoint1 = NULL;
+  mPoint2 = NULL;
+  
+  mPoint1Selected = false;
+  mPoint2Selected = false;
+    
+  mView = vtkSmartPointer<vtkContextView>::New();
+  vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
+  chart->SetAutoSize(false);
+  chart->SetRenderEmpty(true);
+  mView->GetScene()->AddItem(chart);
+  this->ProfileWidget->GetRenderWindow()->GetRenderers()->RemoveAllItems();
+  this->ProfileWidget->GetRenderWindow()->AddRenderer(mView->GetRenderer());
+  ProfileWidget->show();
+
+  // Main filter
+  mFilter = clitk::ProfileImageGenericFilter::New();
+
+  // Set how many inputs are needed for this tool
+  AddInputSelector("Select one image", mFilter);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolProfile::~vvToolProfile()
+{ 
+  delete [] mPoint1;
+  delete [] mPoint2;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::selectPoint1()
+{
+  QString position = "";
+  
+  if(mCurrentSlicerManager) {
+    if (mPoint1Selected) {
+      ProfileWidget->hide();
+      vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
+      chart->SetAutoSize(false);
+      chart->SetRenderEmpty(true);
+      mView->GetScene()->ClearItems();
+      mView->GetScene()->AddItem(chart);
+      this->ProfileWidget->GetRenderWindow()->GetRenderers()->RemoveAllItems();
+      this->ProfileWidget->GetRenderWindow()->AddRenderer(mView->GetRenderer());
+      ProfileWidget->show();
+      mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P1", mPoint1[3]);
+    }
+  
+    mPoint1Selected = false;
+
+    if(mCurrentSlicerManager->GetSelectedSlicer() != -1) {
+      double *pos;
+      pos = new double [4];
+      pos[0] = pos[1] = pos[2] = pos[3] = 0;
+          
+      int i(0);
+      while (i<mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() && i<3) {
+        pos[i] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetCursorPosition()[i];
+        mPoint1[i] = round((pos[i] - mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i])/mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i]);
+        pos[i] = mPoint1[i]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i]; //Ensure to be at the center of the voxel
+        position += QString::number(mPoint1[i],'f',0) + " ";
+        ++i;
+      }
+      if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() == 4) {
+        pos[3] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetTSlice();
+        mPoint1[3] = pos[3];
+        position += QString::number(mPoint1[3],'f',0) + " ";
+      }
+      mPoint1Selected = true;
+      mCurrentSlicerManager->AddLandmarkProfile(pos[0], pos[1], pos[2], pos[3]);
+      mCurrentSlicerManager->GetLandmarks()->GetLabels()->SetNumberOfValues(mCurrentSlicerManager->GetLandmarks()->GetLabels()->GetNumberOfValues()-1);
+      mCurrentSlicerManager->GetLandmarks()->GetLabels()->Modified();
+      mCurrentSlicerManager->GetLandmarks()->GetLabels()->InsertNextValue("P1");
+    }
+  }
+  mPosPoint1Label->setText(position);
+  isPointsSelected();
+  mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::selectPoint2()
+{
+  QString position = "";
+  
+  if(mCurrentSlicerManager) {
+    if (mPoint2Selected) {
+      ProfileWidget->hide();
+      vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
+      chart->SetAutoSize(false);
+      chart->SetRenderEmpty(true);
+      mView->GetScene()->ClearItems();
+      mView->GetScene()->AddItem(chart);
+      this->ProfileWidget->GetRenderWindow()->GetRenderers()->RemoveAllItems();
+      this->ProfileWidget->GetRenderWindow()->AddRenderer(mView->GetRenderer());
+      ProfileWidget->show();
+      mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P2", mPoint2[3]);
+    }
+  
+    mPoint2Selected = false;
+    
+    if(mCurrentSlicerManager->GetSelectedSlicer() != -1) {
+      double *pos;
+      pos = new double [4];
+      pos[0] = pos[1] = pos[2] = pos[3] = 0;;
+          
+      int i(0);
+      while (i<mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() &&i<3) {
+        pos[i] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetCursorPosition()[i];
+        mPoint2[i] = round((pos[i] - mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i])/mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i]);
+        pos[i] = mPoint2[i]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i]; //Ensure to be at the center of the voxel
+        position += QString::number(mPoint2[i],'f',0) + " ";
+        ++i;
+      }
+      if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() == 4) {
+        pos[3] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetTSlice();
+        mPoint2[3] = pos[3];
+        position += QString::number(mPoint2[3],'f',0) + " ";
+      }
+      mPoint2Selected = true;
+      mCurrentSlicerManager->AddLandmarkProfile(pos[0], pos[1], pos[2], pos[3]);
+      mCurrentSlicerManager->GetLandmarks()->GetLabels()->SetNumberOfValues(mCurrentSlicerManager->GetLandmarks()->GetLabels()->GetNumberOfValues()-1);
+      mCurrentSlicerManager->GetLandmarks()->GetLabels()->Modified();
+      mCurrentSlicerManager->GetLandmarks()->GetLabels()->InsertNextValue("P2");
+    }
+  }
+  mPosPoint2Label->setText(position);
+  isPointsSelected();
+  mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+bool vvToolProfile::isPointsSelected()
+{
+  if (mPoint1Selected && mPoint2Selected) {
+      mSaveProfileButton->setEnabled(true);
+      computeProfile();
+      SetPoints();
+      for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+        DisplayLine(i);
+        connect(mCurrentSlicerManager->GetSlicer(i), SIGNAL(UpdateDisplayExtentBegin(int)), this, SLOT(DeleteLine(int)));
+        connect(mCurrentSlicerManager->GetSlicer(i), SIGNAL(UpdateDisplayExtentEnd(int)), this, SLOT(DisplayLine(int)));
+      }
+      mCurrentSlicerManager->Render();
+  }
+  else {
+      mSaveProfileButton->setEnabled(false);
+      for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+        disconnect(mCurrentSlicerManager->GetSlicer(i), SIGNAL(UpdateDisplayExtentBegin(int)), this, SLOT(DeleteLine(int)));
+        disconnect(mCurrentSlicerManager->GetSlicer(i), SIGNAL(UpdateDisplayExtentEnd(int)), this, SLOT(DisplayLine(int)));
+        mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->RemoveActor(mLineActors[i]);
+      }
+
+  }
+  return (mPoint1Selected && mPoint2Selected);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::computeProfile()
+{
+    if (!mCurrentSlicerManager) close();
+    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+    GetArgsInfoFromGUI();
+    ProfileWidget->hide();
+   
+    // Main filter
+    mFilter->SetInputVVImage(mCurrentImage);
+    mFilter->SetArgsInfo(mArgsInfo);
+    mFilter->Update();
+    
+    //Creation of the XY chart
+    vtkSmartPointer<vtkTable> table = vtkSmartPointer<vtkTable>::New();
+    vtkSmartPointer<vtkFloatArray> arrX = vtkSmartPointer<vtkFloatArray>::New();
+    vtkSmartPointer<vtkFloatArray> arrY = vtkSmartPointer<vtkFloatArray>::New();
+    arrX = mFilter->GetArrayX();
+    arrY = mFilter->GetArrayY();
+    arrX->SetName("Distance (mm)");
+    arrY->SetName("Intensity");
+    
+    table->AddColumn(arrX);
+    table->AddColumn(arrY);
+    
+    mView->GetRenderer()->SetBackground(1.0, 1.0, 1.0);
+    vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
+    chart->SetAutoSize(true);
+    mView->GetScene()->ClearItems();
+    mView->GetScene()->AddItem(chart);
+    vtkPlot *line = chart->AddPlot(vtkChart::LINE);
+#if VTK_MAJOR_VERSION <= 5
+    line->SetInput(table, 0, 1);
+#else
+    line->SetInputData(table, 0, 1);
+#endif
+    line->SetColor(0, 255, 0, 255);
+    line->SetWidth(1.0);
+    chart->GetAxis(vtkAxis::LEFT)->SetTitle("Intensity");
+    chart->GetAxis(vtkAxis::BOTTOM)->SetTitle("Distance (mm)");
+    
+    this->ProfileWidget->GetRenderWindow()->GetRenderers()->RemoveAllItems();
+    this->ProfileWidget->GetRenderWindow()->AddRenderer(mView->GetRenderer());
+    ProfileWidget->show();
+    
+    QApplication::restoreOverrideCursor();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::cancelPoints()
+{ 
+  if (mPoint1Selected)
+    mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P1", mPoint1[3]);
+  if (mPoint2Selected)
+    mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P2", mPoint2[3]);
+  ProfileWidget->hide();
+  vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
+  chart->SetAutoSize(false);
+  chart->SetRenderEmpty(true);
+  mView->GetScene()->ClearItems();
+  mView->GetScene()->AddItem(chart);
+  this->ProfileWidget->GetRenderWindow()->GetRenderers()->RemoveAllItems();
+  this->ProfileWidget->GetRenderWindow()->AddRenderer(mView->GetRenderer());
+  ProfileWidget->show();
+  
+  QString position = "";
+  mPosPoint1Label->setText(position);
+  mPosPoint2Label->setText(position);
+  mPoint1Selected = false;
+  mPoint2Selected = false;
+  mSaveProfileButton->setEnabled(false);
+  isPointsSelected();
+  mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::RemoveVTKObjects()
+{ 
+  for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+    mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->RemoveActor(mLineActors[i]);
+  }
+
+  if (mPoint1Selected)
+    mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P1", mPoint1[3]);
+  if (mPoint2Selected)
+    mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P2", mPoint2[3]);
+
+    
+  if (mCurrentSlicerManager)
+    mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+bool vvToolProfile::close()
+{ 
+  //RemoveVTKObjects();
+  
+  connect(mCurrentSlicerManager, SIGNAL(callAddLandmark(float,float,float,float)), mCurrentSlicerManager, SLOT(AddLandmark(float,float,float,float)));
+  return vvToolWidgetBase::close();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::closeEvent(QCloseEvent *event)
+{ 
+  RemoveVTKObjects();
+  event->accept();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::reject()
+{ 
+  // DD("vvToolProfile::reject");
+  RemoveVTKObjects();
+  return vvToolWidgetBase::reject();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::InputIsSelected(vvSlicerManager * m)
+{ 
+  mCurrentSlicerManager = m;
+
+  mPoint1 = new double[4];
+  mPoint1[0] = mPoint1[1] = mPoint1[2] = mPoint1[3] = 0;
+  mPoint2 = new double[4];
+  mPoint2[0] = mPoint2[1] = mPoint2[2] = mPoint2[3] = 0;
+  
+  mSaveProfileButton->setEnabled(false);
+  mTextFileName = "Profile.txt";
+  InitializeLine();
+  
+  disconnect(mCurrentSlicerManager, SIGNAL(callAddLandmark(float,float,float,float)), mCurrentSlicerManager, SLOT(AddLandmark(float,float,float,float)));
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::GetArgsInfoFromGUI()
+{ 
+
+  /* //KEEP THIS FOR READING GGO FROM FILE
+     int argc=1;
+     std::string a = "toto";
+     char * const* argv = new char*;
+     //a.c_str();
+     struct cmdline_parser_params p;
+     p.check_required = 0;
+     int good = cmdline_parser_ext(argc, argv, &args_info, &p);
+     DD(good);
+  */
+  cmdline_parser_clitkProfileImage_init(&mArgsInfo); // Initialisation to default
+
+  mArgsInfo.verbose_flag = false;
+  
+  mArgsInfo.point1_arg = mPoint1;
+  mArgsInfo.point2_arg = mPoint2;
+  mArgsInfo.point1_given = mCurrentSlicerManager->GetImage()->GetNumberOfDimensions();
+  mArgsInfo.point2_given = mCurrentSlicerManager->GetImage()->GetNumberOfDimensions();
+  
+  // Required (even if not used)
+  mArgsInfo.input_given = 0;
+  mArgsInfo.output_given = 0;
+
+  mArgsInfo.input_arg = new char;
+  mArgsInfo.output_arg = new char;
+  
+
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::apply()
+{ 
+  close();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::SaveAs()
+{ 
+  QStringList OutputListeFormat;
+  OutputListeFormat.clear();
+  OutputListeFormat.push_back(".txt");
+  
+  QString Extensions = "AllFiles(*.*)";
+  for (int i = 0; i < OutputListeFormat.count(); i++) {
+    Extensions += ";;Text File ( *";
+    Extensions += OutputListeFormat[i];
+    Extensions += ")";
+  }
+  QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), mTextFileName.c_str(), Extensions);
+  if (!fileName.isEmpty()) {
+    std::string fileformat = itksys::SystemTools::GetFilenameLastExtension(fileName.toStdString());
+    QString fileQFormat = fileformat.c_str();
+    if (OutputListeFormat.contains(fileformat.c_str()) || fileQFormat.isEmpty()) {
+        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+        std::string action = "Saving";
+        vvProgressDialog progress("Saving "+fileName.toStdString());
+        qApp->processEvents();
+        
+        if (!mCurrentSlicerManager || !isPointsSelected()) {
+            close();
+            return;
+        }
+
+        // Output
+        mTextFileName = fileName.toStdString();
+        if (fileQFormat.isEmpty())
+            mTextFileName += ".txt";
+        ofstream fileOpen(mTextFileName.c_str(), std::ofstream::trunc);
+  
+        if(!fileOpen) {
+            cerr << "Error during saving" << endl;
+            QApplication::restoreOverrideCursor();
+            close();
+            return;
+        }
+        
+        vtkSmartPointer<vtkFloatArray> arrX = vtkSmartPointer<vtkFloatArray>::New();
+        vtkSmartPointer<vtkFloatArray> arrY = vtkSmartPointer<vtkFloatArray>::New();
+        vtkSmartPointer<vtkFloatArray> coords = vtkSmartPointer<vtkFloatArray>::New();
+        arrX = mFilter->GetArrayX();
+        arrY = mFilter->GetArrayY();
+        coords = mFilter->GetCoord();
+        double *tuple;
+        tuple = new double[mCurrentSlicerManager->GetImage()->GetNumberOfDimensions()];
+        int i(0);
+        fileOpen << "The Bresenham algorithm is used to travel along the line. Values represent the center of each crossed voxel (in voxel and mm)" << endl;
+        fileOpen << "Id" << "\t" << "Value" << "\t" ;
+        fileOpen << "x(vox)" << "\t" << "y(vox)" << "\t";
+        if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() >=3)
+            fileOpen << "z(vox)" << "\t";
+        if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() >=4)
+            fileOpen << "t" << "\t";
+        fileOpen << "x(mm)" << "\t" << "y(mm)" << "\t";
+        if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() >=3)
+            fileOpen << "z(mm)" << "\t";
+        if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() >=4)
+            fileOpen << "t" << "\t";
+        fileOpen << endl;
+   
+        while (i<arrX->GetNumberOfTuples()) {
+            fileOpen << i << "\t" << arrY->GetTuple(i)[0] << "\t" ;
+      
+            coords->GetTuple(i, tuple);
+            for (int j=0; j<mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() ; ++j) {
+                fileOpen << tuple[j] << "\t" ;
+            }
+            int j(0);
+            while (j<mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() && j<3) {
+                fileOpen << tuple[j]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[j]+mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[j] << "\t" ;
+                ++j;
+            }
+            if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() == 4) {
+                fileOpen << tuple[3] << "\t" ;
+            }
+            fileOpen << endl;
+            ++i;
+        }
+  
+        delete [] tuple;
+
+        fileOpen.close();
+        QApplication::restoreOverrideCursor();
+    } else {
+      QString error = fileformat.c_str();
+      error += " format unknown !!!\n";
+      QMessageBox::information(this,tr("Saving Problem"),error);
+      SaveAs();
+    }
+  }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::DeleteLine(int slicer)
+{
+  if (!mPoint1Selected && !mPoint2Selected)
+    return;
+  
+  if(mCurrentSlicerManager) {
+      if(mCurrentSlicerManager->GetSelectedSlicer() != -1) {
+          mCurrentSlicerManager->GetSlicer(slicer)->GetRenderer()->RemoveActor(mLineActors[slicer]);
+      }
+   }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::DisplayLine(int slicer)
+{ 
+  if (!mPoint1Selected && !mPoint2Selected)
+    return;
+  
+  if(mCurrentSlicerManager) {
+      if(mCurrentSlicerManager->GetSelectedSlicer() != -1) {
+          if (std::min(mPoint1[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()],mPoint2[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()]) <= mCurrentSlicerManager->GetSlicer(slicer)->GetSlice() && std::max(mPoint1[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()],mPoint2[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()]) >= mCurrentSlicerManager->GetSlicer(slicer)->GetSlice()) {
+            vtkSmartPointer<vtkBox> clippingBox = vtkSmartPointer<vtkBox>::New();
+            double extent[6];
+            for (int j=0; j<6; ++j) {
+                extent[j] = mCurrentSlicerManager->GetSlicer(slicer)->GetExtent()[j];
+            }
+            extent[2*mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()] = mCurrentSlicerManager->GetSlicer(slicer)->GetImageActor()->GetBounds()[ mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()*2 ]-fabs(mCurrentSlicerManager->GetSlicer(slicer)->GetInput()->GetSpacing()[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()]);
+            extent[2*mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()+1] = mCurrentSlicerManager->GetSlicer(slicer)->GetImageActor()->GetBounds()[ mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()*2+1 ]+fabs(mCurrentSlicerManager->GetSlicer(slicer)->GetInput()->GetSpacing()[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()]);
+            clippingBox->SetBounds(extent);
+            
+            vtkSmartPointer<vtkClipPolyData> clipper = vtkSmartPointer<vtkClipPolyData>::New();
+            clipper->SetClipFunction(clippingBox);
+#if VTK_MAJOR_VERSION <= 5
+            clipper->SetInput(mLinesPolyData);
+#else
+            clipper->SetInputData(mLinesPolyData);
+#endif
+            clipper->InsideOutOff();
+            clipper->Update();        
+            vtkSmartPointer<vtkPolyDataMapper> lineMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
+#if VTK_MAJOR_VERSION <= 5
+            lineMapper->SetInput(clipper->GetOutput());
+#else
+            lineMapper->SetInputData(clipper->GetOutput());
+#endif 
+            
+            mLineActors[slicer]->SetMapper(lineMapper);
+            mLineActors[slicer]->GetProperty()->SetOpacity(0.995);
+
+            mCurrentSlicerManager->GetSlicer(slicer)->GetRenderer()->AddActor(mLineActors[slicer]);
+         }
+      }
+  }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::InitializeLine()
+{ 
+  if(mCurrentSlicerManager) {
+      
+      mLinesPolyData = vtkSmartPointer<vtkPolyData>::New();
+      
+      vtkSmartPointer<vtkPoints> pts = vtkSmartPointer<vtkPoints>::New();
+      double pos[4];
+      pos[0] = pos[1] = pos[2] = pos[3] = 0;
+      pts->InsertNextPoint(pos);
+      pts->InsertNextPoint(pos);
+      mLinesPolyData->SetPoints(pts);
+      
+      vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
+      vtkSmartPointer<vtkLine> line = vtkSmartPointer<vtkLine>::New();
+      line->GetPointIds()->SetId(0, 0); // the second 0 is the index of the 1st point in mLinesPolyData's points (pts)
+      line->GetPointIds()->SetId(1, 1); // the second 1 is the index of the 2nd point in mLinesPolyData's points (pts)
+      lines->InsertNextCell(line);
+      mLinesPolyData->SetLines(lines);
+       
+      unsigned char red[3] = { 255, 0, 0 };
+      vtkSmartPointer<vtkUnsignedCharArray> colors = vtkSmartPointer<vtkUnsignedCharArray>::New();
+      colors->SetNumberOfComponents(3);
+      colors->InsertNextTupleValue(red);
+      mLinesPolyData->GetCellData()->SetScalars(colors);
+      
+      for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+        mLineActors.push_back(vtkSmartPointer<vtkActor>::New());
+      }
+   }       
+}    
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolProfile::SetPoints()
+{ 
+  if (!mPoint1Selected && !mPoint2Selected)
+    return;
+  
+  if(mCurrentSlicerManager) {
+      if(mCurrentSlicerManager->GetSelectedSlicer() != -1) {
+          /*double *pos;
+          pos = new double [4];
+          pos[0] = pos[1] = pos[2] = pos[3] = 0;
+          
+          int i(0);
+          while (i<3) {
+            pos[i] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetCursorPosition()[i];
+            ++i;
+          }
+          if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() == 4) {
+            pos[3] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetTSlice();
+          } */
+          
+          double p0[4], p1[4];
+          p0[0] = mPoint1[0]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[0] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[0];
+          p0[1] = mPoint1[1]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[1] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[1];
+          p0[2] = mPoint1[2]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[2] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[2];
+          p0[3] = mPoint1[3];
+
+          p1[0] = mPoint2[0]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[0] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[0];
+          p1[1] = mPoint2[1]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[1] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[1];
+          p1[2] = mPoint2[2]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[2] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[2];
+          p1[3] = mPoint2[3];
+              
+          vtkSmartPointer<vtkPoints> pts = mLinesPolyData->GetPoints();
+          pts->SetPoint(0,p0);
+          pts->SetPoint(1,p1);
+    }
+  }
+}
+//------------------------------------------------------------------------------
+
+
diff --git a/vv/vvToolProfile.h b/vv/vvToolProfile.h
new file mode 100644 (file)
index 0000000..03fcd0c
--- /dev/null
@@ -0,0 +1,96 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  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
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef VVTOOLPROFILE_H
+#define VVTOOLPROFILE_H
+
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
+
+#include "vvToolBase.h"
+#include "vvToolWidgetBase.h"
+#include "vvImageContour.h"
+#include "vvLandmarks.h"
+#include "ui_vvToolProfile.h"
+#include "vvBinaryImageOverlayActor.h"
+
+#include "clitkProfileImage_ggo.h"
+#include "clitkProfileImageGenericFilter.h"
+#include <vtkTable.h>
+#include <vtkContextView.h>
+#include <vtkContextScene.h>
+
+//------------------------------------------------------------------------------
+class vvToolProfile:
+  public vvToolWidgetBase,
+  public vvToolBase<vvToolProfile>, 
+  private Ui::vvToolProfile
+{
+  Q_OBJECT
+    public:
+  vvToolProfile(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
+  ~vvToolProfile();
+
+  //-----------------------------------------------------
+  static void Initialize();
+  void InitializeLine();
+  void GetArgsInfoFromGUI();
+  virtual void InputIsSelected(vvSlicerManager * m);
+
+  bool isPointsSelected();
+  void computeProfile();
+  void SetPoints();
+
+  //-----------------------------------------------------
+  public slots:
+  virtual void apply();
+  virtual bool close();
+  virtual void reject();
+  
+  void selectPoint1();
+  void selectPoint2();
+  void cancelPoints();
+  void SaveAs();
+  void DisplayLine(int);
+  void DeleteLine(int);
+
+ protected:
+  void RemoveVTKObjects();
+  virtual void closeEvent(QCloseEvent *event);
+  Ui::vvToolProfile ui;
+  args_info_clitkProfileImage mArgsInfo;
+  
+  double* mPoint1;
+  double* mPoint2;
+  bool mPoint1Selected;
+  bool mPoint2Selected;
+  vtkSmartPointer<vtkContextView> mView;
+  clitk::ProfileImageGenericFilter::Pointer mFilter;
+  std::string mTextFileName;
+  std::vector<vtkSmartPointer<vtkActor> > mLineActors;
+  vtkSmartPointer<vtkPolyData> mLinesPolyData;
+
+
+}; // end class vvToolProfile
+//------------------------------------------------------------------------------
+
+#endif
+
index ec69e4ee95665914fc9279888f8cca0fc5c591f9..7a2324b2eecb2d28acd726afbe58a2cd7876a15a 100644 (file)
@@ -22,7 +22,6 @@
 #include "vvImageWriter.h"
 #include "vvROIActor.h"
 #include "vvSlicer.h"
-#include "vvROIActor.h"
 #include "vvMeshReader.h"
 #include "vvStructSelector.h"
 #include "vvToolManager.h"
 ADD_TOOL(vvToolROIManager);
 //------------------------------------------------------------------------------
 
+int vvToolROIManager::nbTotalROI = 0;
+
 //------------------------------------------------------------------------------
 vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f):
   QWidget(parent->GetTab()),
   vvToolBase<vvToolROIManager>(parent),
   Ui::vvToolROIManager()
-{
+{ 
   // Store parent
   mMainWindow = parent;
 
@@ -94,7 +95,7 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f)
 
 //------------------------------------------------------------------------------
 vvToolROIManager::~vvToolROIManager()
-{
+{ 
   mROIActorsList.clear();
 }
 //------------------------------------------------------------------------------
@@ -102,7 +103,8 @@ vvToolROIManager::~vvToolROIManager()
 
 //------------------------------------------------------------------------------
 // STATIC
-void vvToolROIManager::Initialize() {
+void vvToolROIManager::Initialize()
+{ 
   SetToolName("ROIManager");
   SetToolMenuName("Open ROI (binary image or RT-STRUCT)");
   SetToolIconFilename(":/common/icons/tool-roi.png");
@@ -115,7 +117,7 @@ void vvToolROIManager::Initialize() {
 
 //------------------------------------------------------------------------------
 void  vvToolROIManager::InitializeNewTool(bool ReadStateFlag)
-{
+{ 
   // Check if we need to start a new tool or read in the state file to load
   if (ReadStateFlag == false) {
     // Select the current image as the target
@@ -160,7 +162,7 @@ void  vvToolROIManager::InitializeNewTool(bool ReadStateFlag)
   }
 
   // Display tool in the correct tab
-  QWidget * tab = qFindChild<QWidget*>(mMainWindow->GetTab(), "ROItab");
+  QWidget * tab = mMainWindow->GetTab()->findChild<QWidget*>("ROItab");
   tab->layout()->addWidget(this);
 
   // If not read in a file we start automatically the browser to load
@@ -213,26 +215,20 @@ void  vvToolROIManager::InitializeNewTool(bool ReadStateFlag)
   connect(mDepthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeDepth(int)));
   connect(mReloadButton, SIGNAL(clicked()), this, SLOT(ReloadCurrentROI()));
   connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
-  connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
+  connect(mContourCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleContourROIToggled(int)));
   connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close()));
+  connect(mRemoveButton, SIGNAL(clicked()), this, SLOT(RemoveROI()));
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::InputIsSelected(vvSlicerManager *m)
-{
+{ 
   // Initialization
   mCurrentSlicerManager = m;
   mCurrentImage = mCurrentSlicerManager->GetImage();
 
-  // Refuse if non 3D image
-  if (mCurrentImage->GetNumberOfDimensions() != 3) {
-    QMessageBox::information(this,tr("Warning"), tr("Warning 3D ROI on a 4D image will results in some display bugs"));
-    //close();
-    //return;
-  }
-
   // Change gui
   mLabelInputInfo->setText(QString("%1").arg(m->GetFileName().c_str()));
 
@@ -244,7 +240,7 @@ void vvToolROIManager::InputIsSelected(vvSlicerManager *m)
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m)
-{
+{ 
   if (m == mCurrentSlicerManager) {
     close();
     return;
@@ -252,10 +248,47 @@ void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m)
 }
 //------------------------------------------------------------------------------
 
+void vvToolROIManager::RemoveROI()
+{ 
+
+  // Search the indice of the selected ROI
+  QList<QTreeWidgetItem *> l = mTree->selectedItems();
+  if (l.size() == 0)
+    return;
+
+  QTreeWidgetItem * w = l[0];
+  if (w == NULL) return;
+  if (w == 0) return;
+  if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) {
+    return;
+  }
+  
+  clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w];
+  if (roi == NULL) return;
+
+  // Get selected roi actor
+  int n = roi->GetROINumber();
+  
+  disconnect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
+  mROIActorsList[n]->RemoveActors();
+  mROIActorsList.erase(mROIActorsList.begin()+n);
+  mROIList.erase(mROIList.begin()+n);
+  mTreeWidgetList.erase(mTreeWidgetList.begin()+n);
+
+  for (int i = n; i < mROIActorsList.size(); ++i) {
+    mROIList[i]->SetROINumber(i);
+    mTreeWidgetList[i].data()->setText(0, QString("%1").arg(mROIList[i]->GetROINumber()));
+  }
+  connect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
+  for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+    mCurrentSlicerManager->GetSlicer(i)->Render();
+  }
+}
+//------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::close()
-{
+{ 
   disconnect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
   disconnect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
   disconnect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
@@ -264,6 +297,7 @@ void vvToolROIManager::close()
   disconnect(mChangeContourColorButton, SIGNAL(clicked()), this, SLOT(ChangeContourColor()));
   disconnect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
   disconnect(mDepthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeDepth(int)));
+  disconnect(mRemoveButton, SIGNAL(clicked()), this, SLOT(RemoveROI()));
 
   // Remove actors
   for (unsigned int i = 0; i < mROIActorsList.size(); i++) {
@@ -280,8 +314,8 @@ void vvToolROIManager::close()
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) {
-
+void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m)
+{ 
   if (mCurrentSlicerManager == NULL) return;
   if (m == NULL) return;
   if (m != mCurrentSlicerManager) hide();
@@ -294,7 +328,7 @@ void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) {
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::Open()
-{
+{ 
   // Open images
   QString Extensions = "Images or Dicom-Struct files ( *.mha *.mhd *.hdr *.his *.dcm RS*)";
   Extensions += ";;All Files (*)";
@@ -315,7 +349,7 @@ void vvToolROIManager::Open()
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::OpenBinaryImage(QStringList & filename)
-{
+{ 
   if (filename.size() == 0) return;
 
   vvProgressDialog p("Reading ROI ...", true);
@@ -359,7 +393,7 @@ void vvToolROIManager::OpenBinaryImage(QStringList & filename)
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::OpenDicomImage(std::string filename)
-{
+{ 
   // GUI selector of roi
   vvMeshReader reader;
   reader.SetFilename(filename);
@@ -411,7 +445,7 @@ void vvToolROIManager::AddImage(vvImage * binaryImage,
                                 std::string name,
                                 std::string filename,
                                 double BG, bool modeBG)
-{
+{ 
   // Check Dimension
   int dim = mCurrentImage->GetNumberOfDimensions();
   int bin_dim = binaryImage->GetNumberOfDimensions();
@@ -424,8 +458,9 @@ void vvToolROIManager::AddImage(vvImage * binaryImage,
   }
 
   // Compute roi index
-  int n = mROIList.size();
-
+  
+  int n = nbTotalROI;
+  ++nbTotalROI;
   // Compute the name of the new ROI
   // std::ostringstream oss;
   // oss << vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(filename));
@@ -439,7 +474,7 @@ void vvToolROIManager::AddImage(vvImage * binaryImage,
 
   // Create ROI
   clitk::DicomRT_ROI::Pointer roi = clitk::DicomRT_ROI::New();
-  roi->SetFromBinaryImage(binaryImage, n, name, color, filename);
+  roi->SetFromBinaryImage(binaryImage, mROIList.size(), name, color, filename);
 
   // Add a new roi to the list
   mROIList.push_back(roi);
@@ -467,7 +502,8 @@ void vvToolROIManager::AddImage(vvImage * binaryImage,
   // CheckBox for "All"
   if (actor->IsVisible()) mNumberOfVisibleROI++;
   if (actor->IsContourVisible()) mNumberOfVisibleContourROI++;
-
+  AllVisibleContourROIToggled(1);
+  
   // Add ROI in tree
   mTreeWidgetList.push_back(QSharedPointer<QTreeWidgetItem>(new QTreeWidgetItem(mTree)));
   QTreeWidgetItem * w = mTreeWidgetList.back().data();
@@ -486,13 +522,32 @@ void vvToolROIManager::AddImage(vvImage * binaryImage,
 
   // Update
   UpdateAllROIStatus();
+  
+  if (mCurrentImage->GetNumberOfDimensions() > 3) {
+      
+    //Modifications to avoid display bug with a 4D image
+    QSharedPointer<vvROIActor> CurrentROIActorTemp;
+    CurrentROIActorTemp = mCurrentROIActor;
+    mCurrentROIActor = actor;
+  
+    int VisibleInWindow(0);
+    mCurrentSlicerManager->GetSlicer(VisibleInWindow)->SetCurrentPosition(-VTK_DOUBLE_MAX,-VTK_DOUBLE_MAX,-VTK_DOUBLE_MAX,mCurrentSlicerManager->GetSlicer(VisibleInWindow)->GetMaxCurrentTSlice());
+    mCurrentSlicerManager->GetSlicer(VisibleInWindow)->Render();
+  
+    VisibleROIToggled(false);
+    VisibleROIToggled(true);
+  
+    mCurrentROIActor = CurrentROIActorTemp;
+  
+  }
+  
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::UpdateAllContours()
-{
+{ 
   if (mCurrentSlicerManager == NULL) return;
   // Render loaded ROIs (the first is sufficient)
   for(unsigned int i=0; i<mROIList.size(); i++) {
@@ -504,31 +559,42 @@ void vvToolROIManager::UpdateAllContours()
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::UpdateAllROIStatus() {
+void vvToolROIManager::UpdateAllROIStatus()
+{ 
   int nbVisible = 0;
+  int nbContourVisible = 0;
   int nb = mROIList.size();
   for(int i=0; i<nb; i++) {
     if (mROIActorsList[i]->IsVisible()) {
       nbVisible++;
     }
+    if (mROIActorsList[i]->IsContourVisible()) {
+      nbContourVisible++;
+    }
   }
 
   // change the states
   disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
-  disconnect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
+  disconnect(mContourCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleContourROIToggled(int)));
   if (nbVisible == nb) mCheckBoxShowAll->setCheckState(Qt::Checked);
   else {
     if (nbVisible == 0) mCheckBoxShowAll->setCheckState(Qt::Unchecked);
     else mCheckBoxShowAll->setCheckState(Qt::PartiallyChecked);
   }
-  connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
+  if (nbContourVisible == nb) mContourCheckBoxShowAll->setCheckState(Qt::Checked);
+  else {
+    if (nbContourVisible == 0) mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
+    else mContourCheckBoxShowAll->setCheckState(Qt::PartiallyChecked);
+  }
+  connect(mContourCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleContourROIToggled(int)));
   connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::SelectedItemChangedInTree() {
+void vvToolROIManager::SelectedItemChangedInTree()
+{ 
   // Search which roi is selected
   QList<QTreeWidgetItem *> l = mTree->selectedItems();
   if (l.size() == 0) {
@@ -566,6 +632,7 @@ void vvToolROIManager::SelectedItemChangedInTree() {
   disconnect(mChangeContourColorButton, SIGNAL(clicked()), this, SLOT(ChangeContourColor()));
   disconnect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
   disconnect(mDepthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeDepth(int)));
+  disconnect(mRemoveButton, SIGNAL(clicked()), this, SLOT(RemoveROI()));
 
   mROInameLabel->setText(roi->GetName().c_str());
   mCheckBoxShow->setChecked(actor->IsVisible());
@@ -584,6 +651,7 @@ void vvToolROIManager::SelectedItemChangedInTree() {
   connect(mChangeContourColorButton, SIGNAL(clicked()), this, SLOT(ChangeContourColor()));
   connect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
   connect(mDepthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeDepth(int)));
+  connect(mRemoveButton, SIGNAL(clicked()), this, SLOT(RemoveROI()));
 
 
   // Set the current color to the selected ROI name
@@ -610,7 +678,8 @@ void vvToolROIManager::SelectedItemChangedInTree() {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::VisibleROIToggled(bool b) {
+void vvToolROIManager::VisibleROIToggled(bool b)
+{ 
   if (mCurrentROIActor == NULL) return;
   if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
   mCurrentROIActor->SetVisible(b);
@@ -621,18 +690,21 @@ void vvToolROIManager::VisibleROIToggled(bool b) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::VisibleContourROIToggled(bool b) {
+void vvToolROIManager::VisibleContourROIToggled(bool b)
+{ 
   if (mCurrentROIActor == NULL) return;
   if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
   mCurrentROIActor->SetContourVisible(b);
   mCurrentROIActor->UpdateColor();
+  UpdateAllROIStatus(); 
   mCurrentSlicerManager->Render();
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::OpacityChanged(int v) {
+void vvToolROIManager::OpacityChanged(int v)
+{ 
   if (mCurrentROIActor == NULL) return;
   mCurrentROIActor->SetOpacity((double)v/100.0);
   mCurrentROIActor->UpdateColor();
@@ -642,7 +714,8 @@ void vvToolROIManager::OpacityChanged(int v) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleROIToggled(int b) {
+void vvToolROIManager::AllVisibleROIToggled(int b)
+{ 
   bool status = false;
   if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
       (mCheckBoxShowAll->checkState() == Qt::PartiallyChecked))  status = true;
@@ -659,7 +732,8 @@ void vvToolROIManager::AllVisibleROIToggled(int b) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleContourROIToggled(bool b) {
+void vvToolROIManager::AllVisibleContourROIToggled(int b)
+{ 
   bool status = false;
   if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
       (mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked))  status = true;
@@ -677,7 +751,8 @@ void vvToolROIManager::AllVisibleContourROIToggled(bool b) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ChangeColor() {
+void vvToolROIManager::ChangeColor()
+{ 
   if (mCurrentROIActor == NULL) return;
   QColor color;
   color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
@@ -702,7 +777,8 @@ void vvToolROIManager::ChangeColor() {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourColor() {
+void vvToolROIManager::ChangeContourColor()
+{ 
   if (mCurrentROIActor == NULL) return;
   QColor color;
   color.setRgbF(mCurrentROIActor->GetContourColor()[0],
@@ -719,7 +795,8 @@ void vvToolROIManager::ChangeContourColor() {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourWidth(int n) {
+void vvToolROIManager::ChangeContourWidth(int n)
+{ 
   if (mCurrentROIActor == NULL) return;
   mCurrentROIActor->SetContourWidth(n);
   mCurrentROIActor->UpdateColor();
@@ -729,7 +806,8 @@ void vvToolROIManager::ChangeContourWidth(int n) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ChangeDepth(int n) {
+void vvToolROIManager::ChangeDepth(int n)
+{ 
   if (mCurrentROIActor == NULL) return;
   mCurrentROIActor->SetDepth(n);
   // mCurrentROIActor->UpdateImage(); // FIXME
@@ -742,7 +820,8 @@ void vvToolROIManager::ChangeDepth(int n) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ReloadCurrentROI() {
+void vvToolROIManager::ReloadCurrentROI()
+{ 
   if (mCurrentROI->GetFilename() == "") {
     return; // do nothing (contour from rt struct do not reload)
   }
@@ -783,7 +862,7 @@ void vvToolROIManager::ReloadCurrentROI() {
 
 //------------------------------------------------------------------------------
 void  vvToolROIManager::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter)
-{
+{ 
   // Get index of the image
   int n = mMainWindow->GetSlicerManagers().size();
   int index=-1;
@@ -829,7 +908,7 @@ void  vvToolROIManager::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter)
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::ReadXMLInformation()
-{
+{ 
   std::string value="";
   mInitialImageIndex = -1;
   while (!(m_XmlReader->isEndElement() && value == GetToolName().toStdString())) {
@@ -851,7 +930,7 @@ void vvToolROIManager::ReadXMLInformation()
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::ReadXMLInformation_ROI()
-{
+{ 
   QString s;
   std::string value="";
   QSharedPointer<vvROIActor> param = QSharedPointer<vvROIActor>(new vvROIActor);
index 8ad4a1c65ece4c5393460804b03715f18248cbae..c79fefc71239b8bde9e880a0d6d91b75465852f8 100644 (file)
 #ifndef VVTOOLROIMANAGER_H
 #define VVTOOLROIMANAGER_H
 
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include <QSharedPointer>
 
 #include "vvToolBase.h"
@@ -64,9 +69,10 @@ class vvToolROIManager:
   void ChangeContourWidth(int n);
   void ChangeDepth(int n);
   void AllVisibleROIToggled(int b);
-  void AllVisibleContourROIToggled(bool b);
+  void AllVisibleContourROIToggled(int b);
   void ReloadCurrentROI();  
   void close();
+  void RemoveROI();
   vvSlicerManager * GetCurrentSlicerManager() { return mCurrentSlicerManager; }
 
 protected:
@@ -79,6 +85,7 @@ protected:
   
   int mNumberOfVisibleROI;
   int mNumberOfVisibleContourROI;
+  static int nbTotalROI;
 
   vtkSmartPointer<vtkLookupTable> mDefaultLUTColor;
 
index ec56fda68cfbd40d410ae0b2f1b78c0e76c7a35f..3cb12ef9a92200de7b54f4e7a94f725bdd5fbaab 100644 (file)
 #include "vvToolBase.h"
 
 // qt
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include <QTreeWidget>
 
 //------------------------------------------------------------------------------
index 29481651e21aad16311963d9557ea74155e107a1..a3ee90233c8d30b5a047b444a5dcfd2c8dd9336c 100644 (file)
 // vv
 #include "vvToolRigidReg.h"
 #include "vvSlicer.h"
+#include <vvBlendImageActor.h>
 
 // vtk
 #include <vtkImageData.h>
 #include <vtkSmartPointer.h>
+#include <vtkInformation.h>
 #include <vtkTransform.h>
+#include <vtkImageActor.h>
+#include <vtkImageMapper3D.h>
+#include <vtkOpenGLImageSliceMapper.h>
 
 // itk
 #include <itkEuler3DTransform.h>
@@ -431,14 +436,34 @@ void vvToolRigidReg::GetSlidersAndSpinBoxes(std::vector<QSlider *>&transSliders,
 }
 //------------------------------------------------------------------------------
 
+//------------------------------------------------------------------------------
+void vvToolRigidReg::ExtentMax(const double pointExtent[8][4], double maxExtent[2][3])
+{
+    double max, min;
+    for (int i=0; i<3; ++i) {
+        max = pointExtent[0][i];
+        min = pointExtent[0][i];
+        for (int j=1; j<8; ++j) {
+            if (pointExtent[j][i] > max) {
+                max = pointExtent[j][i];
+            }
+            if (pointExtent[j][i] < min) {
+                min = pointExtent[j][i];
+            }
+        }
+        maxExtent[0][i] = min;
+        maxExtent[1][i] = max;
+    }
+}
+//------------------------------------------------------------------------------
+
 //------------------------------------------------------------------------------
 void vvToolRigidReg::Render()
 {
-  for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++)
-    {
+for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
     mCurrentSlicerManager->GetSlicer(i)->ForceUpdateDisplayExtent();
     mCurrentSlicerManager->GetSlicer(i)->Render();
-    }
+}
 }
 //------------------------------------------------------------------------------
 
index 559aca5bfecb83ee3abe41c501d9648d61b9aae1..02d679b41ac033baa89b962c621e92791fc9128b 100644 (file)
@@ -55,6 +55,7 @@ protected:
   Ui::vvToolRigidReg ui;
   vvSlicerManager * mInput;
   vtkSmartPointer<vtkMatrix4x4> mInitialMatrix;
+  void ExtentMax(const double [8][4], double [2][3]);
   void SetTransform(vtkMatrix4x4 * matrix);
   void GetSlidersAndSpinBoxes(std::vector<QSlider *>&transSliders, std::vector<QSlider *>&rotSliders,
                               std::vector<QDoubleSpinBox *>&transSBs, std::vector<QDoubleSpinBox *>&rotSBs);
index 341084df8a4792c316ef0533d6b98a64c45190d1..63ff9b150f6cac958826bb87e83b9473310b9c0a 100644 (file)
@@ -34,6 +34,9 @@
 #include <QMessageBox>
 
 // vtk
+#include <vtkVersion.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkInformation.h>
 #include "vtkImageContinuousErode3D.h"
 #include "vtkImageContinuousDilate3D.h"
 #include "vtkRenderWindow.h"
@@ -399,10 +402,18 @@ void vvToolSegmentation::Erode()
   vtkImageContinuousErode3D* erode = vtkImageContinuousErode3D::New();
   erode->SetKernelSize(mKernelValue,mKernelValue,mKernelValue);
   vtkImageData* image = mCurrentMaskImage->GetVTKImages()[0];
+#if VTK_MAJOR_VERSION <= 5
   erode->SetInput(image);
+#else
+  erode->SetInputData(image);
+#endif
   erode->Update();
   image->DeepCopy(erode->GetOutput());
+#if VTK_MAJOR_VERSION <= 5
   image->Update();
+#else
+  //image->Update();
+#endif
   UpdateAndRenderNewMask();
   erode->Delete();
   QApplication::restoreOverrideCursor();
@@ -420,10 +431,18 @@ void vvToolSegmentation::Dilate()
   vtkImageContinuousDilate3D* dilate = vtkImageContinuousDilate3D::New();
   dilate->SetKernelSize(mKernelValue,mKernelValue,mKernelValue);
   vtkImageData* image = mCurrentMaskImage->GetVTKImages()[0];
+#if VTK_MAJOR_VERSION <= 5
   dilate->SetInput(image);
+#else
+  dilate->SetInputData(image);
+#endif
   dilate->Update();
   image->DeepCopy(dilate->GetOutput());
+#if VTK_MAJOR_VERSION <= 5
   image->Update();
+#else
+  //image->Update();
+#endif
   UpdateAndRenderNewMask();
   dilate->Delete();
   QApplication::restoreOverrideCursor();
@@ -557,7 +576,7 @@ void vvToolSegmentation::MousePositionChanged(int slicer)
   // mCurrentMousePositionInPixel[1] = Yover;
   // mCurrentMousePositionInPixel[2] = Zover;
   // DDV(mCurrentMousePositionInPixel, 3);
-
+#if VTK_MAJOR_VERSION <= 5
   if (Xover >= image->GetWholeExtent()[0] &&
       Xover <= image->GetWholeExtent()[1] &&
       Yover >= image->GetWholeExtent()[2] &&
@@ -579,6 +598,29 @@ void vvToolSegmentation::MousePositionChanged(int slicer)
     // DD("out of mask");
     mCurrentLabelUnderMousePointer = 0; // BG is always 0 in CCL
   }
+#else
+  if (Xover >= image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[0] &&
+      Xover <= image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[1] &&
+      Yover >= image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[2] &&
+      Yover <= image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[3] &&
+      Zover >= image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[4] &&
+      Zover <= image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[5]) {
+    if (mCurrentState == State_Default) { // inside the mask
+      mCurrentLabelUnderMousePointer = 1;
+      return; 
+    }
+    else { // inside the label image
+      vtkImageData * image = mCurrentCCLImage->GetFirstVTKImageData();
+      mCurrentLabelUnderMousePointer = 
+        mCurrentSlicerManager->GetSlicer(0)->GetScalarComponentAsDouble(image, Xover, Yover, Zover, ix, iy, iz, 0);
+      return;
+    }
+  }
+  else {
+    // DD("out of mask");
+    mCurrentLabelUnderMousePointer = 0; // BG is always 0 in CCL
+  }
+#endif
 }
 //------------------------------------------------------------------------------
 
index 5cd6e404b81d952b4237bd280b9378459a5b9521..9e3180bc0ac40d237e7b734e63a1db554ba29920 100644 (file)
 #ifndef VVTOOLSEGMENTATION_H
 #define VVTOOLSEGMENTATION_H
 
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
index 3cbc63e80de88f3371edcb4262decc042e003da6..46040e4b70cea25b263c84f608df13902018cfc0 100644 (file)
 ===========================================================================**/
 #ifndef VVTOOLSIMPLEINPUTSELECTORWIDGET_H
 #define VVTOOLSIMPLEINPUTSELECTORWIDGET_H
+
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include <QDialog>
 #include "ui_vvToolSimpleInputSelectorWidget.h"
 
diff --git a/vv/vvToolTest.cxx b/vv/vvToolTest.cxx
new file mode 100644 (file)
index 0000000..b364d8b
--- /dev/null
@@ -0,0 +1,331 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  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
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+  ===========================================================================**/
+
+// vv
+#include "vvToolTest.h"
+#include "vvSlicerManager.h"
+#include "vvSlicer.h"
+#include "vvToolInputSelectorWidget.h"
+
+// clitk
+#include "clitkBinarizeImageGenericFilter.h"
+
+// vtk
+#include <vtkImageActor.h>
+#include <vtkCamera.h>
+#include <vtkImageClip.h>
+#include <vtkRenderWindow.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkRenderer.h>
+#include <vtkSphereSource.h>
+#include <vtkProperty.h>
+
+#include <itkGDCMImageIO.h>
+
+//------------------------------------------------------------------------------
+// Create the tool and automagically (I like this word) insert it in
+// the main window menu.
+ADD_TOOL(vvToolTest);
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::Initialize()
+{ cout << __func__ << endl;
+  SetToolName("Test");
+  SetToolMenuName("Test");
+  SetToolIconFilename(":/common/icons/binarize.png");
+  SetToolTip("try to display a sphere.");
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolTest::vvToolTest(vvMainWindowBase * parent, Qt::WindowFlags f)
+  :vvToolWidgetBase(parent,f),
+   vvToolBase<vvToolTest>(parent),
+   Ui::vvToolTest()
+{ cout << __func__ << endl;
+  // GUI Initialization
+
+  // Connect signals & slots
+  
+  // Main filter
+  mFilter = clitk::BinarizeImageGenericFilter::New();
+
+  // Set how many inputs are needed for this tool
+  AddInputSelector("Select one image", mFilter);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolTest::~vvToolTest()
+{ cout << __func__ << endl;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+/*
+void vvToolTest::InteractiveDisplayToggled(bool b)
+{ cout << __func__ << endl;
+  mInteractiveDisplayIsEnabled = b;
+  if (!mInteractiveDisplayIsEnabled) {
+    RemoveVTKObjects();
+  } else {
+    for(unsigned int i=0; i<mImageContour.size(); i++) {
+      mImageContour[i]->ShowActors();
+      if (mRadioButtonLowerThan->isChecked())
+        mImageContourLower[i]->ShowActors();
+    }
+    if (mCurrentSlicerManager)
+      mCurrentSlicerManager->Render();
+  }
+}
+*/
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+bool vvToolTest::close()
+{ cout << __func__ << endl;
+  return vvToolWidgetBase::close();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::reject()
+{ cout << __func__ << endl;
+  // DD("vvToolBinarize::reject");
+  return vvToolWidgetBase::reject();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+void vvToolTest::InputIsSelected(vvSlicerManager * m)
+{ cout << __func__ << endl;
+  mCurrentSlicerManager = m;
+
+
+  vtkSmartPointer<vtkSphereSource> sphereSource = 
+      vtkSmartPointer<vtkSphereSource>::New();
+  sphereSource->SetCenter(0, 0, 0);
+  //sphereSource->SetCenter(235.351, 175.781, 141.0);
+  sphereSource->SetRadius(10.0);
+  sphereSource->Update();
+  vtkSmartPointer<vtkPolyDataMapper> sphereMapper =
+      vtkSmartPointer<vtkPolyDataMapper>::New();
+  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());
+  vtkSmartPointer<vtkActor> sphereActor = 
+      vtkSmartPointer<vtkActor>::New();
+  sphereActor->SetMapper(sphereMapper);
+  sphereActor->GetProperty()->SetColor(1.0, 0.0, 0.0);
+  sphereActor->GetProperty()->SetOpacity(0.995);
+  sphereActor->SetPosition(235.351, 175.781, -10);
+  
+  
+  // VTK Renderer
+  vtkSmartPointer<vtkRenderer> sphereRenderer = 
+      vtkSmartPointer<vtkRenderer>::New();
+  // Add Actor to renderer
+  for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+    mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->AddActor(sphereActor);
+  }
+  //sphereRenderer->AddActor(sphereActor); //mettre le vvSlicer
+   
+  // VTK/Qt wedded
+  //this->qvtkWidgetLeft->GetRenderWindow()->AddRenderer(leftRenderer);
+
+  // VTK objects for interactive display
+  valueChangedT1();
+
+  //connect(mThresholdSlider1, SIGNAL(valueChanged(double)), this, SLOT(valueChangedT1()));
+
+  connect(mCurrentSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
+  connect(mCurrentSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
+  
+  connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateSlice(int, int)));
+
+  //  connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int)));
+  //InteractiveDisplayToggled(mInteractiveDisplayIsEnabled);
+  
+  
+  
+typedef signed short InputPixelType;
+const unsigned int Dimension = 3;
+typedef itk::Image< InputPixelType, Dimension > InputImageType;
+typedef itk::ImageFileReader< InputImageType > ReaderType;
+ReaderType::Pointer reader = ReaderType::New();
+reader->SetFileName( "/home/tbaudier/BJ13/RTSTRUCT/1.2.840.113704.1.111.4140.1439902720.30/20160201/160325.000000_/2.16.840.1.113669.1919.1454339005/2.16.840.1.113669.1919.1454339005/1.2.840.10008.5.1.4.1.1.481.3.1454339000.dcm" );
+typedef itk::GDCMImageIO ImageIOType;
+ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
+reader->SetImageIO( gdcmImageIO ); 
+try
+{
+reader->Update();
+}
+catch (itk::ExceptionObject & e)
+{
+std::cerr << "exception in file reader " << std::endl;
+std::cerr << e.GetDescription() << std::endl;
+std::cerr << e.GetLocation() << std::endl;
+return;
+}
+  
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+// void vvToolBinarize::LeftButtonReleaseEvent(int slicer) {
+//   DD("LeftButtonReleaseEvent");
+//   for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+//     if (i == slicer);
+//     mCurrentSlicerManager->GetSlicer(i)->GetRenderWindow()->Render();
+//   }
+// }
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::apply()
+{ cout << __func__ << endl;
+  if (!mCurrentSlicerManager) close();
+  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+  //GetArgsInfoFromGUI();  
+  
+  // Main filter
+
+
+
+  // Output
+  QApplication::restoreOverrideCursor();
+  close();
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+void vvToolTest::UpdateSlice(int slicer,int slices)
+{ cout << __func__ << endl;
+  Update(slicer);
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+void vvToolTest::Update(int slicer)
+{ cout << __func__ << endl;
+  if (!mCurrentSlicerManager) close();
+  mCurrentSlicerManager->Render();
+  //mImageContour[slicer]->Update(mThresholdSlider1->GetValue());
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/* void vvToolTest::GetArgsInfoFromGUI()
+{ cout << __func__ << endl;
+
+  /* //KEEP THIS FOR READING GGO FROM FILE
+     int argc=1;
+     std::string a = "toto";
+     char * const* argv = new char*;
+     //a.c_str();
+     struct cmdline_parser_params p;
+     p.check_required = 0;
+     int good = cmdline_parser_ext(argc, argv, &args_info, &p);
+     DD(good);
+  */
+/*  cmdline_parser_clitkBinarizeImage_init(&mArgsInfo); // Initialisation to default
+  bool inverseBGandFG = false;
+
+  mArgsInfo.lower_given = 1;
+  mArgsInfo.lower_arg = mThresholdSlider1->GetValue();
+  if (mRadioButtonLowerThan->isChecked()) {
+    mArgsInfo.upper_given = 1;
+    mArgsInfo.upper_arg = mThresholdSlider2->GetValue();
+    if (mArgsInfo.upper_arg<mArgsInfo.lower_arg) {
+      mArgsInfo.upper_given = 0;
+      DD("TODO : lower thres greater than greater thres ! Ignoring ");
+    }
+  }
+
+  mArgsInfo.fg_arg = mFGSlider->GetValue();
+  mArgsInfo.bg_arg = mBGSlider->GetValue();
+
+  if (inverseBGandFG) {
+    mArgsInfo.fg_arg = mFGSlider->GetValue();
+    mArgsInfo.bg_arg = mBGSlider->GetValue();
+  }
+  mArgsInfo.fg_given = 1;
+  mArgsInfo.bg_given = 1;
+
+  if (mCheckBoxUseBG->isChecked()) {
+    if (mCheckBoxUseFG->isChecked()) mArgsInfo.mode_arg = (char*)"both";
+    else mArgsInfo.mode_arg = (char*)"BG";
+  } else mArgsInfo.mode_arg = (char*)"FG";
+
+  mArgsInfo.verbose_flag = false;
+
+  // // Required (even if not used)
+  // mArgsInfo.input_given = 0;
+  // mArgsInfo.output_given = 0;
+
+  // mArgsInfo.input_arg = new char;
+  // mArgsInfo.output_arg = new char;
+} */
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::valueChangedT1()
+{ cout << __func__ << endl;
+  //  DD("valueChangedT1");
+  if (!mCurrentSlicerManager) close();
+  for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+    //mImageContour[i]->Update(v);
+  }
+  mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
diff --git a/vv/vvToolTest.h b/vv/vvToolTest.h
new file mode 100644 (file)
index 0000000..f28a181
--- /dev/null
@@ -0,0 +1,62 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  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
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef VVTOOLTEST_H
+#define VVTOOLTEST_H
+
+#include <QtUiPlugin/QDesignerExportWidget>
+
+#include "vvToolBase.h"
+#include "vvToolWidgetBase.h"
+#include "vvImageContour.h"
+#include "ui_vvToolTest.h"
+
+
+//------------------------------------------------------------------------------
+class vvToolTest:
+  public vvToolWidgetBase,
+  public vvToolBase<vvToolTest>,
+  private Ui::vvToolTest 
+{
+  Q_OBJECT
+    public:
+  vvToolTest(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
+  ~vvToolTest();
+
+  //-----------------------------------------------------
+  static void Initialize();
+  //void GetArgsInfoFromGUI();
+  virtual void InputIsSelected(vvSlicerManager * m);
+
+  //-----------------------------------------------------
+  public slots:
+  virtual bool close();
+  virtual void reject();
+  virtual void apply();
+  void UpdateSlice(int slicer,int slices);
+  void valueChangedT1();
+
+ protected:
+  Ui::vvToolTest ui;
+  
+  void Update(int slicer);
+
+}; // end class vvToolTest
+//------------------------------------------------------------------------------
+
+#endif
+
index 6abc741ac47917b8fe6f671492a2b0398e957300..9c85336e2ab4f9a174b693850af92908b85f3710 100644 (file)
@@ -38,7 +38,7 @@ bool vvToolWidgetBase::mIsAnotherToolWaitInput = false;
 vvToolWidgetBase::vvToolWidgetBase(vvMainWindowBase * parent, Qt::WindowFlags f, bool initialize):
   QWidget(parent, f),
   Ui::vvToolWidgetBase()
-{
+{ 
   mMainWindow = parent;
   setAttribute(Qt::WA_DeleteOnClose);
   if (initialize) Initialization();
@@ -116,7 +116,7 @@ vvToolWidgetBase::vvToolWidgetBase(vvMainWindowBase * parent, Qt::WindowFlags f,
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::Initialization() 
-{
+{ 
   mCurrentSlicerManager = 0;
   mIsInitialized = false;
   mFilter = 0;
@@ -139,14 +139,14 @@ void vvToolWidgetBase::Initialization()
 
 //------------------------------------------------------------------------------
 vvToolWidgetBase::~vvToolWidgetBase()
-{
+{ 
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::keyPressEvent(QKeyEvent *event) 
-{
+{ 
   if (event->key() == Qt::Key_Escape) {
     reject();
     event->accept();
@@ -164,7 +164,7 @@ void vvToolWidgetBase::keyPressEvent(QKeyEvent *event)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::accept()
-{
+{ 
   apply();
 }
 //------------------------------------------------------------------------------
@@ -172,7 +172,7 @@ void vvToolWidgetBase::accept()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::reject()
-{
+{ 
   close();
 }
 //------------------------------------------------------------------------------
@@ -180,7 +180,7 @@ void vvToolWidgetBase::reject()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip)
-{
+{ 
   int j=0;
   mFilter = f;
   mSlicerManagersCompatible.clear();
@@ -219,7 +219,7 @@ void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFil
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::AddInputSelector(QString s, bool allowSkip)
-{
+{ 
   mSlicerManagersCompatible.clear();
   for(unsigned int i=0; i<mMainWindow->GetSlicerManagers().size(); i++) {
     mSlicerManagersCompatible.push_back(mMainWindow->GetSlicerManagers()[i]);
@@ -245,7 +245,7 @@ void vvToolWidgetBase::AddInputSelector(QString s, bool allowSkip)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::HideInputSelector()
-{
+{ 
   mToolInputSelectionWidget->hide();
 }
 //------------------------------------------------------------------------------
@@ -253,7 +253,7 @@ void vvToolWidgetBase::HideInputSelector()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::show()
-{
+{ 
   if (!mIsInitialized) {
     mToolInputSelectionWidget->Initialize();
     mIsInitialized = true;
@@ -265,7 +265,7 @@ void vvToolWidgetBase::show()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::closeEvent(QCloseEvent *event) 
-{
+{ 
   mIsAnotherToolWaitInput = false;
   if (isWindow()) {
     event->accept();//return QWidget::close();
@@ -292,7 +292,7 @@ void vvToolWidgetBase::closeEvent(QCloseEvent *event)
 
 //------------------------------------------------------------------------------
 bool vvToolWidgetBase::close()
-{
+{ 
   QApplication::restoreOverrideCursor();
   return QWidget::close();
 }
@@ -301,7 +301,7 @@ bool vvToolWidgetBase::close()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m)
-{
+{ 
   mToolInputSelectionWidget->AnImageIsBeingClosed(m);
   if (m == mCurrentSlicerManager) {
     close();
@@ -312,7 +312,7 @@ void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::SwapCurrentWidget()
-{
+{ 
   mStaticWidgetForTab->setUpdatesEnabled(false);
   QList<QObject*> l =mStaticWidgetForTab->children(); 
   for(int i=1; i<l.size(); i++) {
@@ -331,7 +331,7 @@ void vvToolWidgetBase::SwapCurrentWidget()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::SelectedImageHasChanged(vvSlicerManager * m)
-{
+{ 
   if (!isWindow()) { // When the tool is not in a window, it is in a tab : we only display if needed
     if (mCurrentSlicerManager == NULL) return;
     if (mToolWidget == NULL) return;
@@ -349,14 +349,14 @@ void vvToolWidgetBase::SelectedImageHasChanged(vvSlicerManager * m)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::InitializeInputs()
-{
+{ 
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::InputIsSelected()
-{
+{ 
   mMainButtonBox->setEnabled(true);
   std::vector<vvSlicerManager*> & l = mToolInputSelectionWidget->GetSelectedInputs();
   mCurrentSlicerManager = l[0];
@@ -372,7 +372,7 @@ void vvToolWidgetBase::InputIsSelected()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::InputIsSelected(vvSlicerManager * m)
-{
+{ 
   std::cerr << "You MUST overwrite this method vvToolWidgetBase::InputIsSelected(vvSlicerManager * m) if you use one single input" << std::endl;
   exit(0);
 }
@@ -381,7 +381,7 @@ void vvToolWidgetBase::InputIsSelected(vvSlicerManager * m)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::InputIsSelected(std::vector<vvSlicerManager*> & l)
-{
+{ 
   mMainButtonBox->setEnabled(true);
   if (l.size() == 1) InputIsSelected(l[0]);
   else {
index 2f33110aa9f0103712e1645d5031db98595eb6e5..17daa2ba1fdf99daaa7de0b6241d42ebf42aae75 100644 (file)
 #ifndef VVTOOLWIDGETBASE_H
 #define VVTOOLWIDGETBASE_H
 
+#include <QtGlobal>
+#if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
+#else
+#include <QtUiPlugin/QDesignerExportWidget>
+#endif
 #include "ui_vvToolWidgetBase.h"
 #include "clitkImageToImageGenericFilter.h"