public double CalEvaluationCorr(IEnumerable <CCorrCpts> CorrCptsEb, DlgEvaluationMethod pdlgEvaluationMethod, List <double> dblEvaluationLt, List <double> dblSumEvaluationLt) { double dblSumLength = 0; dblEvaluationLt.Add(0); dblSumEvaluationLt.Add(0); var CorrCptsEt = CorrCptsEb.GetEnumerator(); CorrCptsEt.MoveNext(); //we may need to test whether this is successful var preCorrCpts = CorrCptsEt.Current; while (CorrCptsEt.MoveNext()) { var currentCorrCpts = CorrCptsEt.Current; double dblLength = pdlgEvaluationMethod(preCorrCpts, currentCorrCpts) / dblCorrection; dblSumLength += dblLength; dblEvaluationLt.Add(dblLength); dblSumEvaluationLt.Add(dblSumLength); preCorrCpts = currentCorrCpts; } return(dblSumLength); }
/// <summary> /// compute the cost between correspondences /// </summary> /// <param name="CorrCptsEb"></param> /// <param name="pdlgEvaluationMethod"></param> /// <param name="pStandardVectorCpt"></param> /// <returns></returns> public double CalEvaluationCorr(IEnumerable <CCorrCpts> CorrCptsEb, DlgEvaluationMethod pdlgEvaluationMethod, double dblFrTotalLength = 0, double dblToTotalLength = 0) { double dblSumLength = 0; var CorrCptsEt = CorrCptsEb.GetEnumerator(); CorrCptsEt.MoveNext(); //we may need to test whether this is successful var preCorrCpts = CorrCptsEt.Current; while (CorrCptsEt.MoveNext()) { var currentCorrCpts = CorrCptsEt.Current; double dblLength = pdlgEvaluationMethod(preCorrCpts, currentCorrCpts, dblFrTotalLength, dblToTotalLength); dblSumLength += dblLength; preCorrCpts = currentCorrCpts; } return(dblSumLength); }
public CEvaluation(int intSelectedIndex) { switch (intSelectedIndex) { case 0: this.dlgEvaluationMethod = CEvaluation.CalDeflectionCLIA; dblCorrection = 2; break; case 1: this.dlgEvaluationMethod = CEvaluation.CalTranslation; dblCorrection = 1; break; case 2: this.dlgEvaluationMethod = CEvaluation.CalDeflection; //this is about the weight of the cost between two line segments; sometimes the weight = (frlength + tolength)/2, we can actually divide the sum by 2 at last only once dblCorrection = 2; break; default: throw new ArgumentException("An undefined method! "); } }
protected void SetdlgEvaluationMethod(enumEvaluationMethods enumEvaluationMethod) { switch (enumEvaluationMethod) { case enumEvaluationMethods.DeflectionCLIA: this.dlgEvaluationMethod = CalDeflectionCLIA; dblCorrection = 2; break; case enumEvaluationMethods.Translation: this.dlgEvaluationMethod = CalTranslation; dblCorrection = 1; break; case enumEvaluationMethods.Deflection: this.dlgEvaluationMethod = CalDeflection; dblCorrection = 2; break; default: MessageBox.Show("Undefined morphing method! In:" + this.ToString() + ".cs "); break; } }