]> Creatis software - clitk.git/blobdiff - vv/vvSlicer.cxx
Disabled NKI transform function
[clitk.git] / vv / vvSlicer.cxx
index c070d60bb4b6c11d491a764bc2a7157a4d2598f1..c9b50a7973ac827fa396b8ec59e16a976247ffc9 100644 (file)
@@ -743,8 +743,6 @@ void vvSlicer::UpdateDisplayExtent()
         mClipBox->SetBounds(bounds);
         UpdateLandmarks();
       }
-      // DD(mLandActor->GetPosition()[2]);
-      // DD(Renderer->GetActiveCamera()->GetPosition()[2]);
       mLandActor->SetPosition(0,0,-1.5);
       /*
       if (Renderer->GetActiveCamera()->GetPosition()[2] > this->Slice)
@@ -800,8 +798,6 @@ void vvSlicer::UpdateDisplayExtent()
         mClipBox->SetBounds(bounds);
         UpdateLandmarks();
       }
-      //      DD(mLandActor->GetPosition()[1]);
-      //DD(Renderer->GetActiveCamera()->GetPosition()[1]);
       if (Renderer->GetActiveCamera()->GetPosition()[1] > this->Slice)
         mLandActor->SetPosition(0,1.5,0);
       else
@@ -854,8 +850,6 @@ void vvSlicer::UpdateDisplayExtent()
         mClipBox->SetBounds(bounds);
         UpdateLandmarks();
       }
-      //      DD(mLandActor->GetPosition()[1]);
-      //      DD(Renderer->GetActiveCamera()->GetPosition()[1]);
       if (Renderer->GetActiveCamera()->GetPosition()[0] > this->Slice)
         mLandActor->SetPosition(1.5,0,0);
       else
@@ -1062,14 +1056,7 @@ void vvSlicer::SetRenderWindow(int orientation, vtkRenderWindow * rw)
 //----------------------------------------------------------------------------
 void vvSlicer::ResetCamera()
 {
-  if (this->GetInput()) {
-    double* input_bounds=this->GetInput()->GetBounds();
-    double bmax=input_bounds[1]-input_bounds[0];
-    if (bmax < input_bounds[3]-input_bounds[2]) bmax=input_bounds[3]-input_bounds[2];
-    if (bmax < input_bounds[5]-input_bounds[4]) bmax=input_bounds[5]-input_bounds[4];
-    this->GetRenderer()->ResetCamera();
-    this->GetRenderer()->GetActiveCamera()->SetParallelScale(bmax/2);
-  }
+  this->GetRenderer()->ResetCamera();
 }
 //----------------------------------------------------------------------------
 
@@ -1209,6 +1196,18 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max)
 }
 //----------------------------------------------------------------------------
 
+//----------------------------------------------------------------------------
+double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, int X, double Y, double Z, int &ix, int &iy, int &iz, int component)
+{
+  ix = lrint(X);
+  iy = lrint(Y);
+  iz = lrint(Z);
+  image->SetUpdateExtent(ix, ix, iy, iy, iz, iz);
+  image->Update();
+  return image->GetScalarComponentAsDouble(ix, iy, iz, component);
+}
+//----------------------------------------------------------------------------
+
 //----------------------------------------------------------------------------
 void vvSlicer::Render()
 {
@@ -1261,9 +1260,9 @@ void vvSlicer::Render()
         Y <= this->GetInput()->GetWholeExtent()[3] &&
         Z >= this->GetInput()->GetWholeExtent()[4] &&
         Z <= this->GetInput()->GetWholeExtent()[5]) {
-      int ix = lrint(X);
-      int iy = lrint(Y);
-      int iz = lrint(Z);
+      int ix, iy, iz;
+      double value = this->GetScalarComponentAsDouble(this->GetInput(), X, Y, Z, ix, iy, iz);
+
       std::stringstream pixel1;
       std::stringstream pixel2;
       std::stringstream pixel3;
@@ -1272,9 +1271,6 @@ void vvSlicer::Render()
       pixel2 << iy;
       pixel3 << iz;
       temps << mCurrentTSlice;
-      this->GetInput()->SetUpdateExtent(ix, ix, iy, iy, iz, iz);
-      this->GetInput()->Update();
-      double value = this->GetInput()->GetScalarComponentAsDouble(ix, iy, iz, 0);
 
       std::stringstream val;
       val << value;
@@ -1399,5 +1395,3 @@ void vvSlicer::PrintSelf(ostream& os, vtkIndent indent)
 
 
 
-
-