internal void GetOutputValue() { //put methods here. if (_plan.StructureSet.Structures.FirstOrDefault(x => x.Id == Structure) == null) { OutputValue = -1.0; ToleranceMet = ToleranceEnum.None; return; } if (Metric == "Dose At Volume") { OutputValue = _plan.GetDoseAtVolume(_plan.StructureSet.Structures.FirstOrDefault(x => x.Id == Structure), InputValue, InputUnit == "%" ? VolumePresentation.Relative : VolumePresentation.AbsoluteCm3, OutputUnit == "%" ? DoseValuePresentation.Relative : DoseValuePresentation.Absolute).Dose; OutputValue = OutputValue / 100.0; if (ABRatio != 0.0 && OutputUnit != "%") { OutputEQD2 = OutputValue * ((ABRatio + (OutputValue / (double)_plan.NumberOfFractions)) / (ABRatio + 2.0)); OutputBED = OutputValue * (1 + (OutputValue / (double)_plan.NumberOfFractions) / ABRatio); } } else if (Metric == "Volume At Dose") { OutputValue = _plan.GetVolumeAtDose(_plan.StructureSet.Structures.FirstOrDefault(x => x.Id == Structure), new DoseValue(InputUnit == "%"?InputValue:InputValue / 100.0, (InputUnit == "%" ? DoseValue.DoseUnit.Percent : DoseValue.DoseUnit.cGy)), OutputUnit == "%" ? VolumePresentation.Relative : VolumePresentation.AbsoluteCm3); } else { throw new ApplicationException("Could not determine metric"); } if (!String.IsNullOrEmpty(Tolerance)) { if (Tolerance.Contains("<")) { ToleranceMet = OutputValue < Convert.ToDouble(Tolerance.TrimStart('<')) ? ToleranceEnum.Pass : ToleranceEnum.Fail; } else if (Tolerance.Contains(">")) { ToleranceMet = OutputValue > Convert.ToDouble(Tolerance.TrimStart('>')) ? ToleranceEnum.Pass : ToleranceEnum.Fail; } else if (Tolerance.Contains("=")) { ToleranceMet = OutputValue == Convert.ToDouble(Tolerance.TrimStart('=')) ? ToleranceEnum.Pass : ToleranceEnum.Fail; } else { //no tolerance specified } } }
internal void GetOutputValue() { //put methods here. if (_plan.StructureSet.Structures.FirstOrDefault(x => x.Id == Structure) == null) { OutputValue = -1.0; ToleranceMet = false; return; } if (Metric == "Dose At Volume") { OutputValue = _plan.GetDoseAtVolume(_plan.StructureSet.Structures.FirstOrDefault(x => x.Id == Structure), InputValue, InputUnit == "%" ? VolumePresentation.Relative : VolumePresentation.AbsoluteCm3, OutputUnit == "%" ? DoseValuePresentation.Relative : DoseValuePresentation.Absolute).Dose; } else if (Metric == "Volume At Dose") { OutputValue = _plan.GetVolumeAtDose(_plan.StructureSet.Structures.FirstOrDefault(x => x.Id == Structure), new DoseValue(InputValue, (InputUnit == "%" ? DoseValue.DoseUnit.Percent : DoseValue.DoseUnit.cGy)), OutputUnit == "%" ? VolumePresentation.Relative : VolumePresentation.AbsoluteCm3); } else { throw new ApplicationException("Could not determine metric"); } if (Tolerance.Contains("<")) { ToleranceMet = OutputValue < Convert.ToDouble(Tolerance.TrimStart('<')); } else if (Tolerance.Contains(">")) { ToleranceMet = OutputValue > Convert.ToDouble(Tolerance.TrimStart('>')); } else if (Tolerance.Contains("=")) { ToleranceMet = OutputValue == Convert.ToDouble(Tolerance.TrimStart('=')); } else { throw new ApplicationException("No Tolerance Specified"); } }