From: tbaudier Date: Wed, 9 Dec 2015 10:57:16 +0000 (+0100) Subject: Debug try with ImageReslice update and autoCrop X-Git-Tag: v1.4.0~83^2~2 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4f5c82fca3e8209bc02be1ce3e9ed55308ad5dfe;p=clitk.git Debug try with ImageReslice update and autoCrop --- 4f5c82fca3e8209bc02be1ce3e9ed55308ad5dfe diff --cc vv/vvSlicer.cxx index 0a54a6a,3773aa0..c35e8cc --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@@ -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 mapperOpenGL= vtkSmartPointer::New(); - try { - mapperOpenGL = dynamic_cast(GetImageActor()->GetMapper()); + mapperOpenGL = dynamic_cast(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 48d14de,48d14de..1818e6c --- a/vv/vvSlicer.h +++ b/vv/vvSlicer.h @@@ -148,7 -148,7 +148,6 @@@ public double* GetCursorPosition() { return mCursor; } -- vtkTransform * GetSlicingTransform() { return mSlicingTransform; } vtkTransform * GetConcatenatedTransform() { return mConcatenatedTransform; } vtkTransform * GetConcatenatedFusionTransform() { return mConcatenatedFusionTransform; } diff --cc vv/vvToolRigidReg.cxx index 644920b,5cc862d..0c41993 --- a/vv/vvToolRigidReg.cxx +++ b/vv/vvToolRigidReg.cxx @@@ -359,6 -358,6 +359,7 @@@ void vvToolRigidReg::SetTransform(vtkMa vtkSmartPointer transform=vtkSmartPointer::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(mMainWindow)->ImageInfoChanged(); @@@ -409,7 -408,7 +410,7 @@@ 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) { @@@ -471,23 -468,17 +472,23 @@@ 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; iGetNumberOfSlicers(); i++) - { -#if VTK_MAJOR_VERSION > 5 - double pointExtent[8][4], pointExtentUpdate[8][4]; +for (int i=0; iGetNumberOfSlicers(); 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 w_ext; w_ext=mCurrentSlicerManager->GetImage()->GetSize(); pointExtent[0][0] = 0.0;