public MaxDoseLimit(DoseValue doseLimit, double upperLimit_, DoseValuePresentation dvp_ = DoseValuePresentation.Absolute) { upperLimit = upperLimit_; doseConstraint = doseLimit; dvp = dvp_; }
// the method is released when a user clicks the "Submit" button when the radiobutton "GI" is checked public void CalculateGIResults() { var SelectedPlans = StaticCollCoursePlan.Where(plan => plan.IsCheckedPlan == true); CollResult = new ObservableCollection <Result>(); double GI; foreach (CoursePlan selectedPlan in SelectedPlans) { DoseValue prescribedDose = selectedPlan.Plan.TotalPrescribedDose; DoseValue halfPrescribedDose = new DoseValue(prescribedDose.Dose / 2.0, prescribedDose.Unit); Structure BODY = selectedPlan.StructureSet.Structures.Where(structure => structure.DicomType == "EXTERNAL").First(); double BODYwithPrescribedDoseVolume = selectedPlan.Plan.GetVolumeAtDose(BODY, prescribedDose, VolumePresentation.AbsoluteCm3); double BODYwithHalfPrescribedDoseVolume = selectedPlan.Plan.GetVolumeAtDose(BODY, halfPrescribedDose, VolumePresentation.AbsoluteCm3); if (BODYwithPrescribedDoseVolume < 0.001) { MessageBox.Show("For the plan " + selectedPlan.CoursePlanId + " the prescription dose is not achieved. The plan will not be taken into account in results."); } else { GI = BODYwithHalfPrescribedDoseVolume / BODYwithPrescribedDoseVolume; GI = Math.Round(GI, 4); CollResult.Add(new Result(selectedPlan.CoursePlanId, GI)); } } StaticCollResult = CollResult; }
private static void BuildMeanDoseConstraint(MayoConstraint mc, string structureName, PriorityType priority, out IConstraint c) { var doseUnit = GetDoseUnits(mc.Query.UnitsDesired); var dose = mc.ConstraintValue; var dv = new DoseValue(dose, doseUnit); switch (mc.Discriminator) { case Discriminator.EQUAL: case Discriminator.GREATER_THAN: case Discriminator.GREATHER_THAN_OR_EQUAL: c = new MinMeanDoseConstraint { ConstraintDose = dv, StructureName = structureName, Priority = priority }; break; case Discriminator.LESS_THAN: case Discriminator.LESS_THAN_OR_EQUAL: c = new MaxMeanDoseConstraint { ConstraintDose = dv, StructureName = structureName, Priority = priority }; break; default: c = null; break; } }
public void ApplyToPlan(PlanSetup myPlan) { plan = myPlan; SetupStructureDictionary(); Structure body, ptv; // get global dmax and PTV volume if (rtStructureDic.TryGetValue("BODY", out body) && body != null) { var dvh = plan.GetDVHCumulativeData(body, DoseValuePresentation.Absolute, VolumePresentation.AbsoluteCm3, 0.01); globalDmax = dvh.MaxDose; //globalDmax = plan.GetDoseAtVolume(body, 0, VolumePresentation.Relative, // DoseValuePresentation.Absolute); } //if (rtStructureDic["BODY"] != null) //{ // globalDmax = plan.GetDoseAtVolume(rtStructureDic["BODY"], 0, // VolumePresentation.Relative, DoseValuePresentation.Absolute); //} if (rtStructureDic.TryGetValue("PTV", out ptv)) { ptvVolume = (ptv != null) ? ptv.Volume : -1.0; } // cases that ptvVolume returns -1.0 even though PTV exists. Reason to be found. // ptvVolume = (rtStructureDic["PTV"] != null) ? rtStructureDic["PTV"].Volume : -1; ParsingMetric(); ParsingCriteria(); PerformMetricToCriteriaComparison(); return; }
public void analizarPlanEstructura(PlanningItem plan, Structure estructura) { VolumePresentation volumePresentation; double valorCorrespondienteGy = valorCorrespondiente; if (unidadCorrespondiente == "%") { valorCorrespondienteGy = valorCorrespondiente * prescripcionEstructura / 100; //Convierto el % a Gy para extraer } DoseValue dosis = new DoseValue(valorCorrespondienteGy * 100, DoseValue.DoseUnit.cGy); if (unidadValor == "%") { volumePresentation = VolumePresentation.Relative; } else { volumePresentation = VolumePresentation.AbsoluteCm3; } if (plan is PlanSetup) { valorMedido = Math.Round(((PlanSetup)plan).GetVolumeAtDose(estructura, dosis, volumePresentation), 1); } /*else if (plan.GetType() == typeof(ExternalPlanSetup)) * { * valorMedido = Math.Round(((ExternalPlanSetup)plan).GetVolumeAtDose(estructura, dosis, volumePresentation), 2); * }*/ else { DVHPoint[] curveData = ((PlanSum)plan).GetDVHCumulativeData(estructura, DoseValuePresentation.Absolute, volumePresentation, 0.01).CurveData; valorMedido = Math.Round(DVHDataExtensions_ESAPIX.GetVolumeAtDose(curveData, dosis), 1); } }
public void CalculateCNResults() { var SelectedPlans = StaticCollCoursePlan.Where(plan => plan.IsCheckedPlan == true); CollResult = new ObservableCollection <Result>(); double CN; foreach (CoursePlan selectedPlan in SelectedPlans) { DoseValue prescribedDose = selectedPlan.Plan.TotalPrescribedDose; //Structure BODY = selectedPlan.StructureSet.Structures.Where(structure => structure.Id == "BODY").First(); Structure BODY = selectedPlan.StructureSet.Structures.Where(structure => structure.DicomType == "EXTERNAL").First(); Structure TARGET = selectedPlan.StructureSet.Structures.Where(structure => structure.Id == selectedPlan.Plan.TargetVolumeID).First(); double TARGETvolume = TARGET.Volume; double BODYwithPrescribedDoseVolume = selectedPlan.Plan.GetVolumeAtDose(BODY, prescribedDose, VolumePresentation.AbsoluteCm3); double TARGETwithPrescribedDoseVolume = selectedPlan.Plan.GetVolumeAtDose(TARGET, prescribedDose, VolumePresentation.AbsoluteCm3); double dvalue1 = BODYwithPrescribedDoseVolume / TARGETvolume; //MessageBox.Show("Conformity Index: " + dvalue1.ToString()); /* * MessageBox.Show("TARGETwithPrescribedDoseVolume: " + TARGETwithPrescribedDoseVolume.ToString()); * MessageBox.Show("TARGETvolume: " + TARGETvolume.ToString()); * MessageBox.Show("BODYwithPrescribedDoseVolume: " + BODYwithPrescribedDoseVolume.ToString()); * double dvalue1 = (TARGETwithPrescribedDoseVolume / TARGETvolume); * double dvalue2 = (TARGETwithPrescribedDoseVolume * BODYwithPrescribedDoseVolume); * CN = dvalue1 * dvalue2; */ CN = (TARGETwithPrescribedDoseVolume / TARGETvolume) * (TARGETwithPrescribedDoseVolume / BODYwithPrescribedDoseVolume); CN = Math.Round(CN, 4); CollResult.Add(new Result(selectedPlan.CoursePlanId, CN)); } StaticCollResult = CollResult; }
//CI report: CI=BODY(V100%Dprc)/PTV(Vol) public static Double CI(PlanningItem my_plan, Structure ptv, Structure body, DoseValue Dose_presc) { double BV100 = my_plan.GetVolumeAtDose(body, Dose_presc, VolumePresentation.AbsoluteCm3); double PTVvol = ptv.Volume; return(BV100 / PTVvol); }
public static DoseValue Multiply(this DoseValue val, DoseValue val2) { var sameUnit = val2.GetDose(val.Unit); var mathOp = val.Dose * sameUnit; return(new DoseValue(mathOp, val.Unit)); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { // Load the JSON for the Result into a JObject var jo = JObject.Load(reader); // Read the properties which will be used as constructor parameters var value = (double)jo["Dose"]; var unitVal = jo["Unit"].Value <string>(); DoseValue.DoseUnit unit = DoseValue.DoseUnit.Unknown; switch (unitVal) { case "%": unit = DoseValue.DoseUnit.Percent; break; case "cGy": unit = DoseValue.DoseUnit.cGy; break; case "Gy": unit = DoseValue.DoseUnit.Gy; break; } // Construct the Result object using the non-default constructor var dv = new DoseValue(value, unit); // Return the result return(dv); }
/// <summary> /// Converts the units of a DoseValue between cGy and Gy /// </summary> /// <param name="dose">Dose</param> /// <param name="units">Requested units in string form</param> /// <returns>Dose converted to the new units</returns> private DoseValue ConvertDoseUnits(DoseValue dose, string units) { if (dose.Dose == 0 || dose.Unit == DoseValue.DoseUnit.Unknown) { return(dose); } if (dose.Unit != DoseValue.DoseUnit.cGy && dose.Unit != DoseValue.DoseUnit.Gy) { MessageBox.Show("Only units of cGy and Gy can be converted\nVariable: dose.Unit = " + dose.Unit.ToString(), "Invalid Dose Unit", MessageBoxButton.OK, MessageBoxImage.Error); throw new FormatException("Invalid dose unit"); } else if (units != "cGy" && units != "Gy") { MessageBox.Show("Can only convert to units of cGy and Gy\nVariable: units = " + units, "Invalid Dose Unit", MessageBoxButton.OK, MessageBoxImage.Error); throw new FormatException("Invalid dose unit"); } if (dose.Unit.ToString() == units) { return(dose); } else if (dose.Unit == DoseValue.DoseUnit.cGy) { return(new DoseValue(dose.Dose / 100.0, DoseValue.DoseUnit.Gy)); } else { return(new DoseValue(dose.Dose * 100.0, DoseValue.DoseUnit.cGy)); } }
public void addPQMInfo(PlanningItem plan, Structure organ, XmlWriter writer) { DVHData dvh = plan.GetDVHCumulativeData(organ, dvp, VolumePresentation.Relative, 0.1); if (dvh != null) { DoseValue dv = dvh.MeanDose; if (name.Length > 0) { PQMUtilities.addDosePQMInfo(name, PQMUtilities.DosePQMType.MeanDose, dv, doseConstraint, upperLimit, writer); } else { PQMUtilities.addDosePQMInfo(PQMUtilities.DosePQMType.MeanDose, dv, doseConstraint, upperLimit, writer); } } else { XElement pqm = new XElement("PQM", new XAttribute("type", "MeanDose"), new XAttribute("name", "Dmean < " + doseConstraint.ToString()), new XElement("Error", string.Format("Error calculating DVH for structure '{0}'.", organ.Id)) ); pqm.WriteTo(writer); } }
public static string GetCoveredVolumeAtDose(StructureSet structureSet, PlanningItemViewModel planningItem, StructureViewModel evalStructure, MatchCollection testMatch, Group evalunit) { try { var structure = structureSet.Structures.FirstOrDefault(x => x.Id == evalStructure.StructureName); //check for sufficient sampling and dose coverage DVHData dvh = planningItem.PlanningItemObject.GetDVHCumulativeData(structure, DoseValuePresentation.Absolute, VolumePresentation.Relative, 0.1); if ((dvh.SamplingCoverage < 0.9) || (dvh.Coverage < 0.9)) { return("Unable to calculate - insufficient dose or sampling coverage"); } Group eval = testMatch[0].Groups["evalpt"]; Group unit = testMatch[0].Groups["unit"]; DoseValue.DoseUnit du = (unit.Value.CompareTo("%") == 0) ? DoseValue.DoseUnit.Percent : (unit.Value.CompareTo("cGy") == 0) ? DoseValue.DoseUnit.cGy : DoseValue.DoseUnit.Unknown; VolumePresentation vp = (unit.Value.CompareTo("%") == 0) ? VolumePresentation.Relative : VolumePresentation.AbsoluteCm3; DoseValue dv = new DoseValue(double.Parse(eval.Value), du); double volume = double.Parse(eval.Value); VolumePresentation vpFinal = (evalunit.Value.CompareTo("%") == 0) ? VolumePresentation.Relative : VolumePresentation.AbsoluteCm3; DoseValuePresentation dvpFinal = (evalunit.Value.CompareTo("%") == 0) ? DoseValuePresentation.Relative : DoseValuePresentation.Absolute; double volumeAchieved = planningItem.PlanningItemObject.GetVolumeAtDose(structure, dv, vpFinal); double organVolume = Convert.ToDouble(evalStructure.VolumeValue); double coveredVolume = organVolume - volumeAchieved; return(string.Format("{0:0.00} {1}", coveredVolume, evalunit.Value)); // todo: better formatting based on VolumePresentation } catch (NullReferenceException) { return("Unable to calculate - DVH is not valid"); } }
public static DoseValue Divide(this DoseValue numerator, DoseValue denominator) { var sameUnit = denominator.GetDose(numerator.Unit); var mathOp = numerator.Dose / sameUnit; return(new DoseValue(mathOp, numerator.Unit)); }
public static XElement getEvaluateXML(DoseValue dv, DoseValue doseConstraint, double upperLimit) { double upperLimitMax = (doseConstraint.Dose * upperLimit); string pfw = "PASS"; if (dv.Dose > doseConstraint.Dose && dv.Dose <= upperLimitMax) { pfw = "WARN"; } else if (dv.Dose > upperLimitMax) { pfw = "FAIL"; } return (new XElement("Evaluate", new XElement("Limit", new XAttribute("type", "upper"), doseConstraint.ValueAsString), new XElement("Tolerance", new XAttribute("type", "leq"), upperLimit.ToString("0.000")), new XElement("Result", new XElement("MaxLimit", upperLimitMax.ToString("0.000")), new XElement("PFW", pfw)))); }
private static double QueryComplementVolume(DVHPoint[] dvh, MayoQuery query) { var doseUnit = query.GetDoseUnit(); var doseValue = new DoseValue(query.QueryValue, doseUnit); return(dvh.GetComplementVolumeAtDose(doseValue)); }
public static string GetVolumeAtDose(StructureSet structureSet, PlanningItem planningItem, Structure evalStructure, MatchCollection testMatch, Group evalunit) { //check for sufficient sampling and dose coverage DVHData dvh = planningItem.GetDVHCumulativeData(evalStructure, DoseValuePresentation.Absolute, VolumePresentation.Relative, 0.1); //MessageBox.Show(evalStructure.Id + "- Eval unit: " + evalunit.Value.ToString() + "Achieved unit: " + dvAchieved.UnitAsString + " - Sampling coverage: " + dvh.SamplingCoverage.ToString() + " Coverage: " + dvh.Coverage.ToString()); if ((dvh.SamplingCoverage < 0.9) || (dvh.Coverage < 0.9)) { return("Unable to calculate - insufficient dose or sampling coverage"); } Group eval = testMatch[0].Groups["evalpt"]; Group unit = testMatch[0].Groups["unit"]; DoseValue.DoseUnit du = (unit.Value.CompareTo("%") == 0) ? DoseValue.DoseUnit.Percent : (unit.Value.CompareTo("cGy") == 0) ? DoseValue.DoseUnit.cGy : DoseValue.DoseUnit.Unknown; VolumePresentation vp = (unit.Value.CompareTo("%") == 0) ? VolumePresentation.Relative : VolumePresentation.AbsoluteCm3; DoseValue dv = new DoseValue(double.Parse(eval.Value), du); double volume = double.Parse(eval.Value); VolumePresentation vpFinal = (evalunit.Value.CompareTo("%") == 0) ? VolumePresentation.Relative : VolumePresentation.AbsoluteCm3; DoseValuePresentation dvpFinal = (evalunit.Value.CompareTo("%") == 0) ? DoseValuePresentation.Relative : DoseValuePresentation.Absolute; double volumeAchieved = planningItem.GetVolumeAtDose(evalStructure, dv, vpFinal); return(string.Format("{0:0.00} {1}", volumeAchieved, evalunit.Value)); // todo: better formatting based on VolumePresentation //#if false // string message = string.Format("{0} - Dose unit = {1}, Volume Presentation = {2}, vpFinal = {3}, dvpFinal ={4}", // objective.DVHObjective, du.ToString(), vp.ToString(), vpFinal.ToString(), dvpFinal.ToString()); // MessageBox.Show(message); //#endif }
public static DoseValue DoseAtVolume(DVHData dvhData, double volume, DoseValue?psumTotalDose = null) { if (dvhData == null || dvhData.CurveData.Count() == 0) { return(DoseValue.UndefinedDose()); } double absVolume = dvhData.CurveData[0].VolumeUnit == "%" ? volume * dvhData.Volume * 0.01 : volume; if (volume < 0.0 || absVolume > dvhData.Volume) { return(DoseValue.UndefinedDose()); } DVHPoint[] hist = dvhData.CurveData; for (int i = 0; i < hist.Length; i++) { if (hist[i].Volume < volume) { if (psumTotalDose == null) { return(hist[i].DoseValue); } else { return(new DoseValue(hist[i].DoseValue.Dose / ((DoseValue)psumTotalDose).Dose * 100, DoseValue.DoseUnit.Percent)); } } } return(DoseValue.UndefinedDose()); }
/// <summary> /// Gets the Complement volume (volume about a certain dose point) for the structure dvh /// </summary> /// <param name="dvh">the dose volume histogram for this structure</param> /// <param name="dv">the dose value to sample the curve</param> /// <returns></returns> public static double GetComplementVolumeAtDose(this DVHPoint[] dvh, DoseValue dv) { var maxVol = dvh.Max(d => d.Volume); var normalVolume = dvh.GetVolumeAtDose(dv); return(maxVol - normalVolume); }
public static XElement getDVXML(DoseValue dv) { return (new XElement("DoseValue", new XAttribute("units", dv.UnitAsString), new XAttribute("calculated", true.ToString()), dv.ValueAsString)); }
/// <summary> /// Converts the units of the dose into dose value presentation /// </summary> /// <param name="dv">the current dose value</param> /// <returns>the dose value presentation corresponding to the units of the input dose</returns> public static DoseValuePresentation GetPresentation(this DoseValue dv) { if (dv.Unit == DoseValue.DoseUnit.Percent) { return(DoseValuePresentation.Relative); } return(DoseValuePresentation.Absolute); }
/// <summary> /// V{Dose_Metric}[%,cm3] < Vol_Goal Vol_repr=0 => Relative [%] Vol_repr=1 => Absolute [cm3] /// using VolumePresentatio Type /// </summary> /// <param name="my_plan"></param> /// <param name="structure"></param> /// <param name="Dose_Metric"></param> /// <param name="Vol_Goal"></param> /// <param name="Vol_repr"></param> /// <returns></returns> public static Tuple <Double, Boolean> V_X_less_than(PlanningItem my_plan, Structure structure, DoseValue Dose_Metric, Double Vol_Goal, VolumePresentation Vol_repr) { Double Vol_Metric = my_plan.GetVolumeAtDose(structure, Dose_Metric, Vol_repr); Boolean test = (Vol_Metric <= Vol_Goal); return(Tuple.Create(Vol_Metric, test)); }
public static PlanQualityMetric[] getPQMs(DoseValue totalPrescribedDose) { PlanQualityMetric[] PQMs = { new VolumeAtDose("V[95%(Rx) > 95%]", new DoseValue(totalPrescribedDose.Dose * .95, totalPrescribedDose.Unit), 95.0, 1.0, VolumePresentation.Relative, PQMUtilities.LimitType.lower) }; return(PQMs); }
public MeanDoseLimit(string name_, DoseValue doseLimit, double upperLimit_, DoseValuePresentation dvp_ = DoseValuePresentation.Absolute) { name = name_; upperLimit = upperLimit_; doseConstraint = doseLimit; dvp = dvp_; }
/// <summary> /// Returns the volume of the input structure at a given input dose /// </summary> /// <param name="pi">the current planning item</param> /// <param name="s">the structure to query</param> /// <param name="dv">the dose value to query</param> /// <param name="vPres">the volume presentation to return</param> /// <returns>the volume at the requested presentation</returns> public static double GetVolumeAtDose(this PlanningItem pi, Structure s, DoseValue dv, VolumePresentation vPres) { var dPres = dv.GetPresentation(); var dvhCurve = pi.GetComplexDVH(new List <Structure> { s }, vPres, dPres); return(dvhCurve.GetVolumeAtDose(dv)); }
/// <summary> /// Returns the volume of the input structure at a given input dose /// </summary> /// <param name="pi">the current planning item</param> /// <param name="ss">the structure to query</param> /// <param name="dv">the dose value to query</param> /// <param name="vPres">the volume presentation to return</param> /// <returns>the volume at the requested presentation</returns> public static double GetVolumeAtDose(this PlanningItem pi, Structure s, DoseValue dv, VolumePresentation vPres) { var dpres = dv.GetPresentation(); return(pi .GetDVHCumulativeData(s, dpres, vPres, 0.1) .CurveData .GetVolumeAtDose(dv)); }
/// <summary> /// This method exists to guess the prescription of a plan sum by summing all plan setup prescribed doses and /// generating a /// relative dvh curve. Can't technically do relative dose with plan sum...but let's try to do it anyway /// </summary> /// <param name="ps">the plan sum where relative dose dvh curve is desired</param> /// <param name="s">the structure to sample</param> /// <param name="vPres">the volume presentation to create the curve</param> /// <param name="binWidth">the bin width to create the curve</param> /// <returns></returns> public static DVHPoint[] GetRelativeDVHCumulativeData(this PlanSum ps, Structure s, VolumePresentation vPres, double binWidth) { var guessedRxGy = ps.TotalPrescribedDoseGy(); var psDVH = ps.GetDVHCumulativeData(s, DoseValuePresentation.Absolute, vPres, binWidth); var scalingPoint = new DoseValue(guessedRxGy, DoseValue.DoseUnit.Gy); var dvhCurve = psDVH.CurveData.ConvertToRelativeDose(scalingPoint); return(dvhCurve); }
/// <summary> /// Returns the min dose from the dvh curve /// </summary> /// <param name="dvh">the dvh curve</param> /// <returns>the minimum dose in the same units as the curve</returns> public static DoseValue MinDose(this DVHPoint[] dvh) { if (dvh.Any()) { var unit = dvh.First().DoseValue.Unit; var minVal = dvh.Min(d => d.DoseValue.Dose); return(new DoseValue(minVal, unit)); } return(DoseValue.UndefinedDose()); }
public VolumeAtDose(string name_, DoseValue doseValue, double volConstraint, double upperLimitTol, VolumePresentation vpp = VolumePresentation.Relative, PQMUtilities.LimitType lt_ = PQMUtilities.LimitType.upper) { volumeConstraint = volConstraint; upperLimit = upperLimitTol; vp = vpp; dv = doseValue; name = name_; lt = lt_; }
public static double BeamPointDose(Beam beam, VVector pointDicom) { DoseValue dose = beam.Dose.GetDoseToPoint(pointDicom); double muPerGy = beam.MetersetPerGy; double mu = beam.Meterset.Value; double refDose = mu / muPerGy; double pointDose = refDose * dose.Dose; return(pointDose); }
public void SerializeDeserializeDoseValue() { var doseValue = new DoseValue(25, DoseValue.DoseUnit.Gy); var serialized = FacadeSerializer.Serialize(doseValue); var deserialized = FacadeSerializer.Deserialize <DoseValue>(serialized); Assert.AreEqual(deserialized.Dose, doseValue.Dose); Assert.AreEqual(deserialized.Unit, doseValue.Unit); }
/// <summary> /// Populates this medication instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the medication data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a medication node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("medication"); Validator.ThrowInvalidIfNull(itemNav, "MedicationUnexpectedNode"); // <name> _name = XPathHelper.GetOptNavValue(itemNav, "name"); // <code> _code.Clear(); XPathNodeIterator codeIterator = itemNav.Select("code"); foreach (XPathNavigator codeNav in codeIterator) { _code.Add(codeNav.ValueAsInt); } // <date-discontinued> _dateDiscontinued = XPathHelper.GetOptNavValue<ApproximateDateTime>( itemNav, "date-discontinued"); // <date-filled> _dateFilled = XPathHelper.GetOptNavValue<ApproximateDateTime>( itemNav, "date-filled"); // <date-prescribed> _datePrescribed = XPathHelper.GetOptNavValue<ApproximateDateTime>( itemNav, "date-prescribed"); // <is-prescribed> _isPrescribed = XPathHelper.GetOptNavValueAsBool(itemNav, "is-prescribed"); // <indication> _indication = XPathHelper.GetOptNavValue(itemNav, "indication"); // <amount-prescribed> _amountPrescribed = XPathHelper.GetOptNavValue(itemNav, "amount-prescribed"); // <dose-value> _doseValue = XPathHelper.GetOptNavValue<DoseValue>(itemNav, "dose-value"); // <dose-unit> _doseUnit = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "dose-unit"); // <strength-value> _strengthValue = XPathHelper.GetOptNavValueAsInt(itemNav, "strength-value"); // <strength-unit> _strengthUnit = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "strength-unit"); // <frequency> _frequency = XPathHelper.GetOptNavValue(itemNav, "frequency"); // <route> _route = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "route"); // <duration> _duration = XPathHelper.GetOptNavValue( itemNav, "duration"); // <duration-unit> _durationUnit = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "duration-unit"); // <refills> _refills = XPathHelper.GetOptNavValueAsInt(itemNav, "refills"); // <refills-left> _refillsLeft = XPathHelper.GetOptNavValueAsInt(itemNav, "refills-left"); // <days-supply> _daysSupply = XPathHelper.GetOptNavValueAsInt(itemNav, "days-supply"); // <prescription-duration> _prescriptionDuration = XPathHelper.GetOptNavValue<DurationValue>( itemNav, "prescription-duration"); // <instructions> _instructions = XPathHelper.GetOptNavValue(itemNav, "instructions"); // <substitution-permitted> _substitutionPermitted = XPathHelper.GetOptNavValueAsBool( itemNav, "substitution-permitted"); // <pharmacy> _pharmacy = XPathHelper.GetOptNavValue<ContactInfo>( itemNav, "pharmacy"); // <prescription-number> _prescriptionNumber = XPathHelper.GetOptNavValue( itemNav, "prescription-number"); }