Commit dbb1e879 authored by Matt Clarkson's avatar Matt Clarkson

Merge branch '16-pivot-output' into 'master'

Resolve "pivot.py having function pivot_calibration is not returning the complete values."

See merge request WEISS/SoftwareRepositories/SNAPPY/scikit-surgerycore!14
parents 42b41344 ed030ef5
......@@ -77,7 +77,7 @@ def pivot_calibration(matrices4x4):
if item != 0:
rank += 1
if rank < 6: # pylint: disable=literal-comparison
if rank < 6: # pylint: disable=literal-comparison
raise ValueError("PivotCalibration: Failed. Rank < 6")
# Residual Matrix
......@@ -95,14 +95,16 @@ def pivot_calibration(matrices4x4):
# Output
# MakeIdentity matrix
output_matrix = np.identity(4)
# output_matrix = np.identity(4)
#
# output_matrix[0, 3] = x_values[0, 0]
# output_matrix[1, 3] = x_values[1, 0]
# output_matrix[2, 3] = x_values[2, 0]
output_matrix[0, 3] = x_values[0, 0]
output_matrix[1, 3] = x_values[1, 0]
output_matrix[2, 3] = x_values[2, 0]
# print("pivotCalibration=(", x_values[3, 0], ","
# , x_values[4, 0], ",", x_values[5, 0],
# "),residual=", residual_error)
print("pivotCalibration=(", x_values[3, 0], ","
, x_values[4, 0], ",", x_values[5, 0],
"),residual=", residual_error)
# print(x_values)
return residual_error, x_values[0, 0], x_values[1, 0], x_values[2, 0]
return np.matrix(x_values), residual_error
......@@ -8,14 +8,15 @@ def run_demo(console, text):
"""Show message"""
six.print_(text)
if not console:
from tkinter import Tk, Label
root = Tk()
label = Label(root, text=text)
label.pack()
six.print_(console)
# if not console:
# from tkinter import Tk, Label
#
# root = Tk()
#
# label = Label(root, text=text)
# label.pack()
#uncomment root.mainloop() to enter tk main loop.
#Delete any unit tests covering this section first
......
......@@ -43,11 +43,14 @@ def test_return_value():
matrices = np.concatenate(arrays)
numberOf4x4Matrices = int(matrices.size/16)
matrices4x4 = matrices.reshape(numberOf4x4Matrices, 4, 4)
residual_error, x_value_1, x_value_2, x_value_3 = p.pivot_calibration(matrices4x4)
x_values, residual_error =p.pivot_calibration(matrices4x4)
assert 1.838 == round(residual_error, 3)
assert -14.476 == round(x_value_1, 3)
assert 395.143 == round(x_value_2, 3)
assert -7.558 == round(x_value_3, 3)
assert -14.476 == round(x_values[0, 0], 3)
assert 395.143 == round(x_values[1, 0], 3)
assert -7.558 == round(x_values[2, 0], 3)
assert -805.285 == round(x_values[3, 0], 3)
assert -85.448 == round(x_values[4, 0], 3)
assert -2112.066 == round(x_values[5, 0], 3)
def test_rank_if_condition():
......
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