private static string getArgumentUnit(DvhTargetType targetType, DvhPresentationType presentationType) { switch (targetType) { case DvhTargetType.Volume: if (presentationType == DvhPresentationType.Abs) { return("Gy"); } else if (presentationType == DvhPresentationType.Rel) { return("%"); } else { return(string.Empty); } case DvhTargetType.Dose: if (presentationType == DvhPresentationType.Abs) { return("cc"); } else if (presentationType == DvhPresentationType.Rel) { return("%"); } else { return(string.Empty); } default: return(string.Empty); } }
public DvhObjective(ObjectiveCsv objectiveCsv) { ProtocolId = objectiveCsv.ProtocolId; OriginalProtocolId = objectiveCsv.OriginalProtocolId; Title = objectiveCsv.Title; StructureName = objectiveCsv.StructureName; ObjectiveType = (DvhObjectiveType)Enum.Parse(typeof(DvhObjectiveType), objectiveCsv.ObjectiveType); TargetType = (DvhTargetType)Enum.Parse(typeof(DvhTargetType), objectiveCsv.TargetType); ArgumentValue = string.IsNullOrEmpty(objectiveCsv.ArgumentValue) ? 0.0 : double.Parse(objectiveCsv.ArgumentValue); TargetValue = double.Parse(objectiveCsv.TargetValue); // If Acceptable Limit is not given, set to -1 AcceptableLimitValue = string.IsNullOrEmpty(objectiveCsv.AcceptableLimitValue) ? -1 : double.Parse(objectiveCsv.AcceptableLimitValue); Remarks = objectiveCsv.Remarks; StructureNameTps = objectiveCsv.StructureNameTps; string argumentUnit = objectiveCsv.ArgumentUnit; if (argumentUnit == "%") { argumentUnit = "Percent"; } string targetUnit = objectiveCsv.TargetUnit;; if (targetUnit == "%") { targetUnit = "Percent"; } switch (TargetType) { case DvhTargetType.Dose: DoseUnit = (DvhDoseUnit)Enum.Parse(typeof(DvhDoseUnit), targetUnit); VolumeUnit = string.IsNullOrEmpty(argumentUnit) ? DvhVolumeUnit.None : (DvhVolumeUnit)Enum.Parse(typeof(DvhVolumeUnit), argumentUnit); if (DoseUnit == DvhDoseUnit.Percent) { TargetUnit = DvhPresentationType.Rel; } else { TargetUnit = DvhPresentationType.Abs; } if (VolumeUnit == DvhVolumeUnit.Percent) { ArgumentUnit = DvhPresentationType.Rel; } else if (VolumeUnit == DvhVolumeUnit.None) { ArgumentUnit = DvhPresentationType.None; } else { ArgumentUnit = DvhPresentationType.Abs; } break; case DvhTargetType.Volume: DoseUnit = string.IsNullOrEmpty(argumentUnit) ? DvhDoseUnit.None : (DvhDoseUnit)Enum.Parse(typeof(DvhDoseUnit), argumentUnit); VolumeUnit = (DvhVolumeUnit)Enum.Parse(typeof(DvhVolumeUnit), targetUnit); if (VolumeUnit == DvhVolumeUnit.Percent) { TargetUnit = DvhPresentationType.Rel; } else { TargetUnit = DvhPresentationType.Abs; } if (DoseUnit == DvhDoseUnit.Percent) { ArgumentUnit = DvhPresentationType.Rel; } else if (DoseUnit == DvhDoseUnit.None) { ArgumentUnit = DvhPresentationType.None; } else { ArgumentUnit = DvhPresentationType.Abs; } break; } }