Commit 61307eec authored by Stephen Thompson's avatar Stephen Thompson

Issue #16 implemented an app to call surgery core procrustes

parent 442440ba
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from sksurgerybard.ui.bard_procrustes_command_line import main
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
310.46 77.96 193.50
37.48 59.41 193.50
171.84 64.90 378.50
241.31 57.59 373.50
310.46 77.96 198.50
37.48 59.41 198.60
171.84 64.90 386.30
241.31 57.59 381.20
# coding=utf-8
"""An interface to surgerycore-procrustes for the BARD application"""
import numpy as np
from sksurgerycore.algorithms.procrustes import orthogonal_procrustes
def run_procrustes(fixed_points_file, moving_points_file):
""" Shows how to use surgery-cores procrustes
function, we could get the students to implement this?
"""
moving_points = np.loadtxt(moving_points_file)
fixed_points = np.loadtxt(fixed_points_file)
rotation, translation, fre = orthogonal_procrustes(
fixed_points, moving_points)
print("Orthogonal Procrustes Success: ")
print("Rotation = ", rotation)
print("Translation = ", translation)
print("Fiducial Registration Error = ", fre)
# coding=utf-8
"""Command line processing"""
import argparse
from sksurgerybard import __version__
from sksurgerybard.ui.bard_procrustes_app import run_procrustes
def main(args=None):
"""Entry point for scikit-surgerybard application"""
parser = argparse.ArgumentParser(
description='Basic Augmented Reality Demo - '
'Orthogonal Procustes')
# ADD POSITIONAL ARGUMENTS
parser.add_argument("-f", "--fixed",
required=True,
help='File containing the fixed points'
'nx3'
)
parser.add_argument("-m",
"--moving",
required=True,
help='File containing the moving points'
'nx3'
)
version_string = __version__
friendly_version_string = version_string if version_string else 'unknown'
parser.add_argument(
"--version",
action='version',
version='scikit-surgerybard version ' + friendly_version_string)
args = parser.parse_args(args)
# Gets the directory containing images.
fixed = args.fixed
moving = args.moving
run_procrustes(fixed, moving)
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