]> Creatis software - clitk.git/commitdiff
Debug try with ImageReslice update and autoCrop
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 9 Dec 2015 10:57:16 +0000 (11:57 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 9 Dec 2015 10:57:16 +0000 (11:57 +0100)
1  2 
vv/vvSlicer.cxx
vv/vvSlicer.h
vv/vvToolRigidReg.cxx

diff --cc vv/vvSlicer.cxx
index 0a54a6a7db2c55fdf1e8236d76920c7b93ae726f,3773aa0477cec92a846084869972b6a03d3c8d26..c35e8cc4bcd39d974e4018df2fd4ba9317785194
@@@ -1096,29 -1095,32 +1095,42 @@@ void vvSlicer::UpdateDisplayExtent(
    
    // Image actor
    this->ImageActor->SetVisibility(mImageVisibility);
- #if VTK_MAJOR_VERSION <= 5
    this->ImageActor->SetDisplayExtent(w_ext);
- #else
+ #if VTK_MAJOR_VERSION >= 6
++//mSlicingTransform->Print(cout);
++//GetImage()->GetTransform()[0]->Print(cout);
++//mSlicingTransform = GetImage()->GetTransform()[0];
++//mImageReslice->SetResliceTransform(mSlicingTransform);
++//mImageReslice->AutoCropOutputOff();
++//mImageReslice->Update();
++int* extentTest = mImageReslice->GetOutput()->GetExtent();
++cout<< extentTest[0] << " " << extentTest[1] << " " <<  extentTest[2] << " " <<  extentTest[3] << " " <<  extentTest[4] << " " <<  extentTest[5] << endl;
++//this->GetInput()->Print(cout);
++//GetImageActor()->GetMapper()->Print(cout);
    vtkSmartPointer<vtkOpenGLImageSliceMapper> mapperOpenGL= vtkSmartPointer<vtkOpenGLImageSliceMapper>::New();
 -
    try {
 -        mapperOpenGL = dynamic_cast<vtkOpenGLImageSliceMapper*>(GetImageActor()->GetMapper());
 +    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;
 +    std::cerr << e.what() << std::endl;
 +      std::cerr << "Conversion error" << std::endl;
 +      return;
    }
    if (mFirstSetSliceOrientation) {
      copyExtent(ext, mRegisterExtent);
-     this->ImageActor->SetDisplayExtent(w_ext); //initialisation
    } else {
      int w_croppingRegion[6];
-     copyExtent(mRegisterExtent, w_croppingRegion);
-     this->ImageActor->SetDisplayExtent(w_ext);
+     if (mUseReducedExtent) {
 -        copyExtent(mReducedExtent, w_croppingRegion);
++        copyExtent(extentTest, w_croppingRegion);
+     } else {
 -        copyExtent(mRegisterExtent, w_croppingRegion);
++        copyExtent(extentTest, w_croppingRegion);
+     }
 -    this->ImageActor->SetDisplayExtent(w_ext);
++    cout << "w_ext : " << w_ext[0] << " " << w_ext[1] << " " << w_ext[2] << " " << w_ext[3] << " " << w_ext[4] << " " << w_ext[5] << endl;
      w_croppingRegion[ this->SliceOrientation*2   ] = this->Slice;
      w_croppingRegion[ this->SliceOrientation*2+1 ] = this->Slice;
 -    mapperOpenGL->SetCroppingRegion(w_croppingRegion);    
 +    mapperOpenGL->SetCroppingRegion(w_croppingRegion);
++    cout << "w_croppingRegion : " << w_croppingRegion[0] << " " << w_croppingRegion[1] << " " << w_croppingRegion[2] << " " << w_croppingRegion[3] << " " << w_croppingRegion[4] << " " << w_croppingRegion[5] << endl;
    }
 -#endif 
 +#endif
    
  #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
    // Fix for bug #1882
@@@ -1593,7 -1595,8 +1606,7 @@@ double vvSlicer::GetScalarComponentAsDo
  
  //----------------------------------------------------------------------------
  void vvSlicer::Render()
- { cout << __func__ << endl;
+ { //out << __func__ << endl;
 -
    if (this->mFusion && mFusionActor->GetVisibility() && showFusionLegend) {
      legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable());
      legend->UseOpacityOn();
diff --cc vv/vvSlicer.h
index 48d14de3c80272cdcdfccd2a2fadf359a5ace108,48d14de3c80272cdcdfccd2a2fadf359a5ace108..1818e6c190c812e85f32a2db8d76e354eb63872b
@@@ -148,7 -148,7 +148,6 @@@ public
    double* GetCursorPosition() {
      return mCursor;
    }
--
    vtkTransform * GetSlicingTransform() { return mSlicingTransform; }
    vtkTransform * GetConcatenatedTransform() { return mConcatenatedTransform; }
    vtkTransform * GetConcatenatedFusionTransform() { return mConcatenatedFusionTransform; }
index 644920b4435fa420e35c7d33664c5ad9697a5c2e,5cc862d5aaf2b34fefac0a35b4a24cef2839f148..0c4199325904b32d212f1dd093764ce068573cc2
@@@ -359,6 -358,6 +359,7 @@@ void vvToolRigidReg::SetTransform(vtkMa
    vtkSmartPointer<vtkTransform> transform=vtkSmartPointer<vtkTransform>::New();
    // TODO SR and BP: check on the list of transforms and not the first only
    mCurrentSlicerManager->GetImage()->GetTransform()[0]->SetMatrix(matrix);
++  //mCurrentSlicerManager->GetSlicer(2)->GetSlicingTransform()->SetMatrix(matrix);
    transform->Update();
    Render();
    dynamic_cast<vvMainWindow*>(mMainWindow)->ImageInfoChanged();
        rotSliders[i]->setValue(iAngle);
        rotSliders[i]->blockSignals(false);
      }
--  }
++  }cout << euler->GetParameters()[0+3] << " " << euler->GetParameters()[1+3] << " " << euler->GetParameters()[2+3] << endl;
  }
  //------------------------------------------------------------------------------
  
@@@ -460,9 -459,7 +461,9 @@@ void vvToolRigidReg::ExtentMax(const do
  //------------------------------------------------------------------------------
  void vvToolRigidReg::Render()
  { //out << __func__ << endl;
--#if VTK_MAJOR_VERSION > 5
++#if VTK_MAJOR_VERSION > 7
 +double translationValues[4], translationValuesUpdate[4];
 +mCurrentSlicerManager->GetImage()->GetTransform()[0]->Print(cout);
  vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix();
  vtkMatrix4x4* matrixTranspose = matrix->NewInstance();
  for (int i=0; i<3; ++i) {
          matrixTranspose->SetElement(i,j,matrix->GetElement(j,i));
      }
  }
 -for (int i=0; i<4; ++i) {
 -   matrixTranspose->SetElement(3,i,matrix->GetElement(3,i));
 +for (int j=0; j<3; ++j)
 +{
 +    translationValues[j] = matrix->GetElement(j,3);
 +}
 +translationValues[3] = 0.0;
 +matrix->MultiplyPoint(translationValues, translationValuesUpdate);
 +for (int i=0; i<3; ++i) {
 +   matrixTranspose->SetElement(i,3,translationValuesUpdate[i]);
  }
  for (int i=0; i<4; ++i) {
 -   matrixTranspose->SetElement(i,3,matrix->GetElement(i,3));
 +   matrixTranspose->SetElement(3,i,matrix->GetElement(3,i));
  }
 +
  #endif
 -  for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++)
 -    {
 -#if VTK_MAJOR_VERSION > 5 
 -    double pointExtent[8][4], pointExtentUpdate[8][4];
 +for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
- #if VTK_MAJOR_VERSION > 5 
++#if VTK_MAJOR_VERSION > 7
 +    double pointExtent[8][4], pointExtentUpdate[8][4], pointOverlayExtent[8][4], pointOverlayExtentUpdate[8][4], centre[3], translation[3];
      std::vector<int> w_ext;
      w_ext=mCurrentSlicerManager->GetImage()->GetSize();
      pointExtent[0][0] = 0.0;