Commit 4ef9cf65 authored by Stephen Thompson's avatar Stephen Thompson

Issue #1 started to implement distance test

parent 3a81f3ec
Pipeline #3726 failed with stages
in 5 minutes and 24 seconds
......@@ -11,22 +11,37 @@ from sksurgeryvtk.models.vtk_cylinder_model import VTKCylinderModel
def test_using_pytest_sksurgeryeval():
with pytest.raises(ValueError):
run_demo("empty", True)
run_demo("empty", True)
def test_populate_models():
populate_models("data")
def test_point_in_locator():
locators=[]
for i in range (10):
model = VTKCylinderModel(10, 5, (1.0, 1.0, 1.0), "name",
0.0, (1.0, 0.0, 0.0 ), 88,
True, 1.0)
locator = vtk.vtkPointLocator()
for x in range (-2,2,1):
for y in range (-2,2,1):
for z in range (-2,2,1):
model = VTKCylinderModel(10, 5, (1.0, 1.0, 1.0), "name",
0.0, (1.0, 0.0, 0.0 ), 88,
True, 1.0)
transform_vector = (1.0, 0.0, 0.0, float(x), 0.0, 1.0, 0.0, float(y), 0.0, 0.0, 1.0, float(z), 0.0, 0.0, 0.0, 1.0)
transform = vtk.vtkTransform()
transform.SetMatrix(transform_vector)
# print(transform)
model.transform_filter.SetInputData(model.source)
model.transform_filter.SetTransform(transform)
model.mapper.Update()
locator = vtk.vtkPointLocator()
locator.SetDataSet(model.source)
locator.SetDataSet(model.source)
locators.append(locator)
locators.append(locator)
point_in, distance = point_in_locator ( (0.1,0.0,0.0), locators, 1.0 )
print (point_in, distance)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment