private void buttonCalcMetrics_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { string key = comboBoxMoving.SelectedValue.ToString(); List <sitk.VectorOfParameterMap> map = registrationParameters.TransformationParameterMap[key]; /*string parametersFilename = registrationParameters.OutputDirectory + "\\1\\TransformParameters.0.txt"; * List<sitk.VectorOfParameterMap> map = new List<sitk.VectorOfParameterMap>(); * map.Add(InvertTransformParameters(parametersFilename));*/ registrationParameters.MovingImagePointSetFilename = filenameMovingPointSet; registrationParameters.FixedImagePointSetFilename = filenameFixedPointSet; string filenameOutputPoints = VisualizationEvaluationUtils.TransfromPointSet(map, registrationParameters); var movingPointsDict = ReadWriteUtils.ReadFixedPointSet(filenameMovingPointSet).Values.ToList(); var transformedPointsDict = ReadWriteUtils.ReadTransformedPointSets(filenameOutputPoints).Values.ToList(); RegistrationError registrationError = VisualizationEvaluationUtils.GetRegistrationError(movingPointsDict, transformedPointsDict); labelMeanDiff.Text = registrationError.MeanRegistrationError.ToString("0.###"); labelStdDev.Text = registrationError.StdDevRegistrationError.ToString("0.###"); labelMax.Text = registrationError.MaximumRegistrationError.ToString("0.###"); } catch (Exception ex) { Console.WriteLine(ex); } Cursor.Current = Cursors.Default; }
/// <summary> /// Only for debug / evaluation use. /// </summary> /// <param name="pointsetFixed"></param> /// <param name="pointsetMov"></param> private void CalculateTRE(string pointsetFixed, string pointsetMov) { var fixedPointsDict = ReadWriteUtils.ReadFixedPointSet(pointsetFixed).Values.ToList(); var movPointsDict = ReadWriteUtils.ReadFixedPointSet(pointsetMov).Values.ToList(); RegistrationError registrationError = VisualizationEvaluationUtils.GetRegistrationError(fixedPointsDict, movPointsDict); //Console.WriteLine(string.Format("Absolute TRE: {0}", registrationError.AbsoluteRegistrationError)); //Console.WriteLine(string.Format("Max TRE: {0}", registrationError.MaximumRegistrationError)); //Console.WriteLine(string.Format("Mean TRE: {0}", registrationError.MeanRegistrationError)); //Console.WriteLine(string.Format("Std deviation RE: {0}", registrationError.StdDevRegistrationError)); }