X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvToolRigidReg.cxx;h=508551da86a7dec2ed064921e170439f2d6faeff;hb=9850d1cd9cbe91c5e2b5e4fcf217d30cfcecc621;hp=57d7bcb085329ba1d4d004fd8c5887824be80fe4;hpb=1753519ccc5895a24e2bb5853bf6e9d33050ba12;p=clitk.git diff --git a/vv/vvToolRigidReg.cxx b/vv/vvToolRigidReg.cxx index 57d7bcb..508551d 100644 --- a/vv/vvToolRigidReg.cxx +++ b/vv/vvToolRigidReg.cxx @@ -108,9 +108,9 @@ void vvToolRigidReg::InputIsSelected(vvSlicerManager *input) imageorigin=mInput->GetImage()->GetOrigin(); std::vector imageSize = mInput->GetImage()->GetSize(); std::vector imageSpacing = mInput->GetImage()->GetSpacing(); - xcord=xcord.setNum(imageorigin[0]+imageSize[0]*imageSpacing[0]/2, 'g', 3); - ycord=ycord.setNum(imageorigin[1]+imageSize[1]*imageSpacing[1]/2, 'g', 3); - zcord=zcord.setNum(imageorigin[2]+imageSize[2]*imageSpacing[2]/2, 'g', 3); + xcord=xcord.setNum(imageorigin[0]+(imageSize[0]-1)*imageSpacing[0]*0.5, 'g', 3); + ycord=ycord.setNum(imageorigin[1]+(imageSize[1]-1)*imageSpacing[1]*0.5, 'g', 3); + zcord=zcord.setNum(imageorigin[2]+(imageSize[2]-1)*imageSpacing[2]*0.5, 'g', 3); Xval->setText(xcord); Yval->setText(ycord); Zval->setText(zcord); @@ -118,7 +118,8 @@ void vvToolRigidReg::InputIsSelected(vvSlicerManager *input) //backup original matrix for(int j=0; j<4; j++) for(int i=0; i<4; i++) - mInitialMatrix->SetElement(i,j, mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()->GetElement(i,j)); + // TODO SR and BP: check on the list of transforms and not the first only + mInitialMatrix->SetElement(i,j, mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix()->GetElement(i,j)); QString origTransformString = dynamic_cast(mMainWindow)->Get4x4MatrixDoubleAsString(mInitialMatrix); transformationLabel->setText(origTransformString); SetTransform(mInitialMatrix); @@ -242,7 +243,8 @@ void vvToolRigidReg::SpinBoxChange(double newVal) } // Compute transform and set - vtkSmartPointer transform_final=mInput->GetImage()->GetTransform(); + // TODO SR and BP: check on the list of transforms and not the first only + vtkSmartPointer transform_final=mInput->GetImage()->GetTransform()[0]; transform_final->Identity(); transform_final->PostMultiply(); @@ -294,7 +296,8 @@ void vvToolRigidReg::SaveFile() QFile file(filename); if (file.open(QFile::WriteOnly | QFile::Truncate)) { - vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix(); + // TODO SR and BP: check on the list of transforms and not the first only + vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix(); QString matrixStr = dynamic_cast(mMainWindow)->Get4x4MatrixDoubleAsString(matrix,16); QTextStream out(&file); out << matrixStr; @@ -332,7 +335,8 @@ void vvToolRigidReg::LoadFile() //------------------------------------------------------------------------------ void vvToolRigidReg::ChangeOfRotationCenter() { - SetTransform(mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()); + // TODO SR and BP: check on the list of transforms and not the first only + SetTransform(mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix()); } //------------------------------------------------------------------------------ @@ -347,7 +351,8 @@ void vvToolRigidReg::ResetTransform() void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix) { vtkSmartPointer transform=vtkSmartPointer::New(); - mCurrentSlicerManager->GetImage()->GetTransform()->SetMatrix(matrix); + // TODO SR and BP: check on the list of transforms and not the first only + mCurrentSlicerManager->GetImage()->GetTransform()[0]->SetMatrix(matrix); transform->Update(); Render(); dynamic_cast(mMainWindow)->ImageInfoChanged(); @@ -370,7 +375,6 @@ void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix) euler->SetMatrix(rotMat); euler->SetOffset(transVec); - // Modify GUI according to the new parameters std::vector transSliders, rotSliders; std::vector transSBs, rotSBs;