]> Creatis software - clitk.git/blobdiff - vv/vvSlicer.cxx
Merge branch 'VTK6_Qt5' into VTK6_Qt5_LineProfile
[clitk.git] / vv / vvSlicer.cxx
index b2f3969582480229524a31374d405c1cece85189..f74bdb8873559cf29a59548df95df303faacdcc7 100644 (file)
@@ -1070,6 +1070,7 @@ int vvSlicer::GetOrientation()
 //----------------------------------------------------------------------------
 void vvSlicer::UpdateDisplayExtent()
 { 
+  emit UpdateDisplayExtentBegin(mSlicerNumber);
   vtkImageData *input = this->GetInput();
   if (!input || !this->ImageActor) {
     return;
@@ -1190,17 +1191,19 @@ void vvSlicer::UpdateDisplayExtent()
   }
   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;
@@ -1225,7 +1228,14 @@ void vvSlicer::UpdateDisplayExtent()
         cam->SetClippingRange(range - sumSpacing, range + sumSpacing);
       }
     }
+    
+    if (mLandActor) {
+        if (mClipBox) {
+            DisplayLandmarks();
+        }
+    }
   }
+  emit UpdateDisplayExtentEnd(mSlicerNumber);
 }
 //----------------------------------------------------------------------------
 
@@ -1757,8 +1767,10 @@ void vvSlicer::Render()
 #endif
     mFusionMapper->Update();
   }
-  if (mLandMapper)
-    UpdateLandmarks();
+  if (mLandMapper) {
+    RemoveLandmarks();
+    DisplayLandmarks();
+  }
 
     this->GetRenderWindow()->Render();
 }
@@ -1778,24 +1790,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);