public static void InferOutput(DicomItem input, DicomItem output, AnonExample example) { example = example ?? throw new ArgumentNullException(nameof(example)); if (output == null) { example.Output.Add("<removed>"); } else if (input == output) { example.Output.Add("<retained>"); } else if (output is DicomElement) { if (output is DicomDate) { var v = (output as DicomDate).Get <DateTime>(); example.Output.Add(v.ToShortDateString()); } else if (output is DicomTime) { var v = (output as DicomTime).Get <DateTime>(); example.Output.Add(v.TimeOfDay.ToString()); } else { var v = (output as DicomElement).Get <string>(); example.Output.Add(string.IsNullOrEmpty(v) ? "<empty>" : v); } } }
public static void InferOutput(DicomItem input, DicomItem output, AnonExample example) { if (output == null) { example.Output.Add("<removed>"); } else if (input == output) { example.Output.Add("<retained>"); } else if (output as DicomElement != null) { if (output as DicomDate != null) { var v = (output as DicomDate).Get <DateTime>(); example.Output.Add(v.ToShortDateString()); } else if (output as DicomTime != null) { var v = (output as DicomTime).Get <DateTime>(); example.Output.Add(v.TimeOfDay.ToString()); } else { var v = (output as DicomElement).Get <string>(); example.Output.Add(v == "" ? "<empty>" : v); } } }
public static List <AnonExample> KeepItemExamples() { var output = new AnonExample(); var v = "24.23"; var item = new DicomDecimalString(DicomTag.PatientWeight, v); output.Input.Add(item + ": " + v); var ans = KeepItem(null, null, item); AnonExample.InferOutput(item, ans, output); return(new List <AnonExample> { output }); }
public static List <AnonExample> RemoveItemExamples() { var output = new AnonExample(); var v = "Lorem Ipsum"; var item = new DicomShortString(DicomTag.PerformedLocation, v); output.Input.Add(item + ": " + v); var ans = RemoveItem(null, null, item); AnonExample.InferOutput(item, ans, output); return(new List <AnonExample> { output }); }