Skip to content

Commit

Permalink
Undo applying transform on displacement field, to reset field for nex…
Browse files Browse the repository at this point in the history
…t use
  • Loading branch information
tdowrick committed Sep 11, 2020
1 parent 8f68a61 commit 22131db
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sksurgeryvtk/models/voxelise.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,18 @@ def apply_displacement_to_mesh(mesh: Union[vtk.vtkDataObject, str],
writer.SetFileName(save_mesh)
writer.Update()

# Undo transformation so that field is 'reset' for future use
tf = loadTransformationMatrix(field)
LOGGER.debug("Reversing transform")
tfFilter = vtk.vtkTransformFilter()
tfFilter.SetTransform(tf)
tfFilter.SetInputData(field)
tfFilter.Update()
field = tfFilter.GetOutput()

# Apply transformation also to all vector fields:
applyTransformation(field, tf)

return output

# class NonRigidAlignment:
Expand Down

0 comments on commit 22131db

Please sign in to comment.