Beispiel #1
0
 def WriteITKIO(self):
     if self.OutputFileName == '':
         self.PrintError('Error: no OutputFileName.')
     writer = vtkvmtk.vtkvmtkITKImageWriter()
     writer.SetInput(self.Image)
     writer.SetFileName(self.OutputFileName)
     writer.SetUseCompression(1)
     if self.ApplyTransform and self.RasToIjkMatrixCoefficients:
         matrix = vtk.vtkMatrix4x4()
         matrix.DeepCopy(self.RasToIjkMatrixCoefficients)
         writer.SetRasToIJKMatrix(matrix)
     writer.Write()
 def WriteITKIO(self):
     if self.OutputFileName == '':
         self.PrintError('Error: no OutputFileName.')
     writer = vtkvmtk.vtkvmtkITKImageWriter()
     writer.SetInput(self.Image)
     writer.SetFileName(self.OutputFileName)
     writer.SetUseCompression(1)
     if self.ApplyTransform and self.RasToIjkMatrixCoefficients:
         matrix = vtk.vtkMatrix4x4()
         matrix.DeepCopy(self.RasToIjkMatrixCoefficients)
         writer.SetRasToIJKMatrix(matrix)
     writer.Write()
Beispiel #3
0
 def WriteITKIO(self):
     if self.OutputFileName == '':
         self.PrintError('Error: no OutputFileName.')
     writer = vtkvmtk.vtkvmtkITKImageWriter()
     writer.SetInputData(self.Image)
     writer.SetFileName(self.OutputFileName)
     writer.SetUseCompression(1)
     if self.ApplyTransform == 0:
         origin = self.Image.GetOrigin()
         spacing = self.Image.GetSpacing()
         matrix = vtk.vtkMatrix4x4()
         matrix.DeepCopy((1/spacing[0], 0, 0, - origin[0]/spacing[0], 
                      0, 1/spacing[1], 0, - origin[1]/spacing[1],
                      0, 0, 1/spacing[2], - origin[2]/spacing[2],
                      0, 0, 0, 1)) #LPI convention with correct origin and spacing 
     else:
         if self.RasToIjkMatrixCoefficients == None:
             self.PrintError('Error: no RasToIjkMatrixCoefficients.')
         matrix = vtk.vtkMatrix4x4()
         matrix.DeepCopy(self.RasToIjkMatrixCoefficients)
     writer.SetRasToIJKMatrix(matrix)
     writer.Write()
Beispiel #4
0
 def WriteITKIO(self):
     if self.OutputFileName == '':
         self.PrintError('Error: no OutputFileName.')
     writer = vtkvmtk.vtkvmtkITKImageWriter()
     writer.SetInputData(self.Image)
     writer.SetFileName(self.OutputFileName)
     writer.SetUseCompression(1)
     if self.ApplyTransform == 0:
         origin = self.Image.GetOrigin()
         spacing = self.Image.GetSpacing()
         matrix = vtk.vtkMatrix4x4()
         matrix.DeepCopy(
             (1 / spacing[0], 0, 0, -origin[0] / spacing[0], 0,
              1 / spacing[1], 0, -origin[1] / spacing[1], 0, 0,
              1 / spacing[2], -origin[2] / spacing[2], 0, 0, 0,
              1))  #LPI convention with correct origin and spacing
     else:
         if self.RasToIjkMatrixCoefficients == None:
             self.PrintError('Error: no RasToIjkMatrixCoefficients.')
         matrix = vtk.vtkMatrix4x4()
         matrix.DeepCopy(self.RasToIjkMatrixCoefficients)
     writer.SetRasToIJKMatrix(matrix)
     writer.Write()