Skip to content

Commit

Permalink
Merge branch '162-us-probe-relative-to-model'
Browse files Browse the repository at this point in the history
  • Loading branch information
MattClarkson committed Jan 18, 2021
2 parents 2d405c0 + ed567a4 commit 37e5a4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions sksurgeryvtk/models/vtk_surface_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ def set_model_transform(self, matrix):
Sets the model to world transform onto a vtkPolyDataFilter.
This enables all the points and point data to be transformed
according to a vtkMatrix4x4 similarity transform.
:param matrix: vtkMatrix4x4
"""
mu.validate_vtk_matrix_4x4(matrix)
self.transform.SetMatrix(matrix)
self.transform_filter.SetTransform(self.transform)
self.transform_filter.Update()

def get_model_transform(self):
"""
Expand Down Expand Up @@ -177,8 +179,9 @@ def get_points_as_numpy(self):
as_numpy = numpy_support.vtk_to_numpy(vtk_points.GetData())
return as_numpy

def get_vtk_data(self) -> vtk.vtkPolyData:
"""Return vtk poly data for this object
def get_vtk_source_data(self) -> vtk.vtkPolyData:
"""
Return original vtk poly data for this object
:return: vtkPolyData
:rtype: vtk.vtkPolyData
Expand Down
5 changes: 5 additions & 0 deletions sksurgeryvtk/widgets/vtk_lus_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class VTKLUSSimulator(rg.VTKRenderingGenerator):
respect to a stationary camera, placed at the world origin,
and pointing along +ve z axis, as per OpenCV conventions.
Note: The mesh representing the LUS probe body must be called 'probe',
and there must be at least one other mesh called 'liver'. Any other
meshes, e.g. gallbladder, arterties etc., will have the same transform
applied as the liver surface.
:param models_json_file: JSON file describing VTK models, in SNAPPY format
:param background_image_file: RGB image to render in background
:param camera_intrinsics_file: [3x3] matrix in text file, in numpy format
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_voxelise.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_preop_from_vtkdata():
size = 0.3
grid_elements = 64

grid = voxelise.voxelise(input_mesh=model.get_vtk_data(),
grid = voxelise.voxelise(input_mesh=model.get_vtk_source_data(),
scale_input=0.001,
center=True,
size=size,
Expand Down

0 comments on commit 37e5a4f

Please sign in to comment.