]> Creatis software - clitk.git/commitdiff
Removed direct modification of matrix elements which triggered vtk warnings.
authorsrit <srit>
Mon, 7 Mar 2011 16:22:06 +0000 (16:22 +0000)
committersrit <srit>
Mon, 7 Mar 2011 16:22:06 +0000 (16:22 +0000)
common/vvImage.txx
vv/vvImageReader.cxx

index 06f44af400ef2d75dc0bb12936ed80289672d84f..a84fa76669d7a317655d725e9e2e8371fd8f133c 100755 (executable)
@@ -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<vtkMatrix4x4> matrix = vtkSmartPointer<vtkMatrix4x4>::New();
+  matrix->Identity();
   for(unsigned int j=0; j<input->GetImageDimension(); j++)
     for(unsigned int i=0; i<input->GetImageDimension(); 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<vtkImageReslice>::New());
index 0076bf7663767d212d2306b7c52fe8c124fa012b..593ef7018e34eab3071db24c531e6ba9a1c814ac 100644 (file)
@@ -167,14 +167,14 @@ void vvImageReader::ReadMatImageTransform()
     
     itk::Matrix<double, 4, 4> itkMat = clitk::ReadMatrix3D(filename);
     
-    vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
-    transform->Identity();
+    vtkSmartPointer<vtkMatrix4x4> matrix = vtkSmartPointer<vtkMatrix4x4>::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();
   }
 }