]> Creatis software - clitk.git/blobdiff - vv/vvSlicer.h
Ensure the compilation with Qt4 and Qt5
[clitk.git] / vv / vvSlicer.h
index 9a750e14d69a6db41596d143e4d3ff30c33b9fae..5b317b40c74b4df4c312e7d3bcd691a95388c03a 100644 (file)
 #include <iostream>
 #include <vector>
 
+#include <QString> //TODO delete
+#include <QMessageBox>
+
 #include "vvLandmarks.h"
 #include "vvImage.h"
 #include "vvMesh.h"
 #include "vvMeshActor.h"
+#include "vvClipPolyData.h"
 
 #include <vtkSmartPointer.h>
 #include <vtkImageViewer2.h>
 #include <vtkImageReslice.h>
 #include <vtkImageMapToColors.h>
+#include <vtkCaptionActor2D.h>
 
 class vtkActor;
 class vtkActor2D;
@@ -57,7 +62,7 @@ class vvSlicer: public vtkImageViewer2
 {
 public:
   static vvSlicer *New();
-  vtkTypeRevisionMacro(vvSlicer,vtkImageViewer2);
+  vtkTypeMacro(vvSlicer,vtkImageViewer2);
   void PrintSelf(ostream& os, vtkIndent indent);
 
   void SetImage(vvImage::Pointer inputImages);
@@ -76,7 +81,7 @@ public:
   vtkActor* GetVFActor() ;
   vtkCornerAnnotation* GetAnnotation();
     
-  void SetFusion(vvImage::Pointer inputFusion);
+  void SetFusion(vvImage::Pointer inputFusion, int fusionSequenceCode = -1);
   vvImage::Pointer GetFusion() {
     return mFusion;
   }
@@ -95,7 +100,10 @@ public:
   }
 
   void SetLandmarks(vvLandmarks* landmarks);
-  void SetTSlice(int t);
+  void SetTSlice(int t, bool updateLinkedImages = true);
+
+  void SetFusionSequenceTSlice(int t);
+
   void SetSliceOrientation(int orientation);
   void AdjustResliceToSliceOrientation(vtkImageReslice *reslice);
   int GetTSlice();
@@ -140,7 +148,6 @@ public:
   double* GetCursorPosition() {
     return mCursor;
   }
-
   vtkTransform * GetSlicingTransform() { return mSlicingTransform; }
   vtkTransform * GetConcatenatedTransform() { return mConcatenatedTransform; }
   vtkTransform * GetConcatenatedFusionTransform() { return mConcatenatedFusionTransform; }
@@ -189,7 +196,7 @@ public:
   void EnableReducedExtent(bool b);
   void SetReducedExtent(int * ext);
 
-  void ClipDisplayedExtent(int extent[6], int refExtent[6]);
+  bool ClipDisplayedExtent(int extent[6], int refExtent[6]);
   int GetOrientation();
   int * GetExtent();
 
@@ -197,7 +204,12 @@ 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]);
+  
 protected:
   vvSlicer();
   ~vvSlicer();
@@ -210,6 +222,8 @@ protected:
 
   vvLandmarks* mLandmarks;
 
+  int mFusionSequenceCode; //-1: not involved in a fusion sequence, 0: main sequence (CT), 1: secondary sequence (US)
+
   //                         __________ Image coordinates accounting for spacing and origin
   //                            Λ  Λ
   //                            |  | vvImage.GetTransform()
@@ -244,9 +258,10 @@ protected:
   vtkSmartPointer<vtkActor> mVFActor;
   vtkSmartPointer<vtkGlyph3D> mLandGlyph;
   vtkSmartPointer<vtkCursor3D> mCross;
-  vtkSmartPointer<vtkClipPolyData> mLandClipper;
+  vtkSmartPointer<vvClipPolyData> mLandClipper;
   vtkSmartPointer<vtkPolyDataMapper> mLandMapper;
   vtkSmartPointer<vtkActor> mLandActor;
+  std::vector<vtkSmartPointer<vtkCaptionActor2D> > mLandLabelActors;
   vtkSmartPointer<vtkBox> mClipBox;
   vtkSmartPointer<vtkScalarBarActor> legend;
   std::vector<vvMeshActor*> mSurfaceCutActors;
@@ -264,18 +279,28 @@ 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
   void SetContourSlice();
 
-
+  // Visibility of the different elements that can be set from outside the object.
+  // Note that vvSlicer also check if the element is to be displayed according to
+  // the extent of the displayed object.
+  // These members have been introduced to fix Bug #1883.
+  bool mImageVisibility;
+  bool mOverlayVisibility;
+  bool mFusionVisibility;
+  bool mVFVisibility;
+  bool mFirstSetSliceOrientation;
 };
 #endif