I’ve written a simple metric for Perk Tutor (see code below) to analyze the deviation between the tool and an entry point. Instead of returning the final RMS deviation, I also want to return the R, A, S components of the error. How would I do this? I tried returning multipel values in GetMetric(), but this isn’t allowed.

```
import math
import vtk
from PythonMetricsCalculator import PerkEvaluatorMetric
class EntryDeviation( PerkEvaluatorMetric ):
# Static methods
@staticmethod
def GetMetricName():
return "Entry Deviation"
@staticmethod
def GetMetricUnit():
return "mm"
@staticmethod
def GetTransformRoles():
return [ "Needle" ]
@staticmethod
def GetAnatomyRoles():
return { "Targets": "vtkMRMLMarkupsFiducialNode" }
# Instance methods
def __init__( self ):
PerkEvaluatorMetric.__init__( self )
self.R_deviation = []
self.A_deviation = []
self.S_deviation = []
self.needleTipTargetDistance = []
def SetAnatomy( self, role, node ):
if ( role == "Targets" ):
self.targets = node
return True
return False
def AddTimestamp( self, time, matrix, point, role ):
currTargetPosition = [ 0, 0, 0 ]
self.targets.GetNthFiducialPosition(0, currTargetPosition ) #Assume first fid point is the entry point
currTargetPosition_RAS = [ currTargetPosition[ 0 ], currTargetPosition[ 1 ], currTargetPosition[ 2 ] ]
# Find the needle tip in RAS
needleTip_RAS = point[0:3]
self.R_deviation.append(currTargetPosition[0] - needleTip_RAS[0])
self.A_deviation.append(currTargetPosition[1] - needleTip_RAS[1])
self.S_deviation.append(currTargetPosition[2] - needleTip_RAS[2])
self.needleTipTargetDistance.append(math.sqrt( vtk.vtkMath.Distance2BetweenPoints( currTargetPosition_RAS, needleTip_RAS ) ))
def GetMetric( self ):
return self.needleTipTargetDistance[-1]
```