From: srit Date: Mon, 7 Mar 2011 16:22:06 +0000 (+0000) Subject: Removed direct modification of matrix elements which triggered vtk warnings. X-Git-Tag: v1.2.0~193 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=647a6322e7d8f4c456bfe56414d8d9a879fb7f3a;p=clitk.git Removed direct modification of matrix elements which triggered vtk warnings. --- diff --git a/common/vvImage.txx b/common/vvImage.txx index 06f44af..a84fa76 100755 --- a/common/vvImage.txx +++ b/common/vvImage.txx @@ -13,11 +13,14 @@ void vvImage::AddItkImage(TItkImageType *input) converter->Update(); mVtkImages.push_back( converter->GetOutput() ); - // Account for direction in transform. The offset is already accounted for + // Account for direction in transform. The offset is already accounted for // in the VTK image coordinates, no need to put it in the transform. + vtkSmartPointer matrix = vtkSmartPointer::New(); + matrix->Identity(); for(unsigned int j=0; jGetImageDimension(); j++) for(unsigned int i=0; iGetImageDimension(); i++) - mTransform->GetMatrix()->SetElement(i,j, input->GetDirection()[i][j]); + (*matrix)[i][j] = input->GetDirection()[i][j]; + mTransform->SetMatrix(matrix); // Create the corresponding transformed image mVtkImageReslice.push_back(vtkSmartPointer::New()); diff --git a/vv/vvImageReader.cxx b/vv/vvImageReader.cxx index 0076bf7..593ef70 100644 --- a/vv/vvImageReader.cxx +++ b/vv/vvImageReader.cxx @@ -167,14 +167,14 @@ void vvImageReader::ReadMatImageTransform() itk::Matrix itkMat = clitk::ReadMatrix3D(filename); - vtkSmartPointer transform = vtkSmartPointer::New(); - transform->Identity(); + vtkSmartPointer matrix = vtkSmartPointer::New(); + matrix->Identity(); for(int j=0; j<4; j++) for(int i=0; i<4; i++) - transform->GetMatrix()->SetElement(j,i,itkMat[j][i]); + matrix->SetElement(j,i,itkMat[j][i]); mImage->GetTransform()->PostMultiply(); - mImage->GetTransform()->Concatenate(transform->GetMatrix()); + mImage->GetTransform()->Concatenate(matrix); mImage->GetTransform()->Update(); } }