From 647a6322e7d8f4c456bfe56414d8d9a879fb7f3a Mon Sep 17 00:00:00 2001 From: srit Date: Mon, 7 Mar 2011 16:22:06 +0000 Subject: [PATCH] Removed direct modification of matrix elements which triggered vtk warnings. --- common/vvImage.txx | 7 +++++-- vv/vvImageReader.cxx | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) 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(); } } -- 2.47.1