public static void Write(DICOMBinaryWriter dw, DICOMIOSettings settings, DICOMObject d, bool isSequenceItem = false) { if (!isSequenceItem) { TransferSyntaxHelper.SetSyntax(d, settings.TransferSyntax); } for (var i = 0; i < d.Elements.Count; i++) { var el = d.Elements[i]; var currentSettings = IsFileMetaGroup(el) ? settings.GetFileMetaSettings() : settings; if (GroupWriter.IsGroupHeader(el)) { var skip = GroupWriter.WriteGroup(dw, currentSettings, d, el); i += skip; } else { _logger.LogInformation($"Writing element ${el.Tag.CompleteID}"); try { DICOMElementWriter.Write(dw, currentSettings, el); } catch (Exception e) { _logger.LogError($"Error writing : ${el.Tag.CompleteID}\n{e}"); throw e; } } } }
/// <summary> /// Ignores the rule of writing metadata in explicit VR little endian and instead writes all elements with the same passed in syntax /// Used in PData writing /// </summary> /// <param name="dw"></param> /// <param name="settings"></param> /// <param name="d"></param> /// <param name="isSequenceItem"></param> public static void WriteSameSyntax(DICOMBinaryWriter dw, DICOMIOSettings settings, DICOMObject d, bool isSequenceItem = false) { for (var i = 0; i < d.Elements.Count; i++) { var el = d.Elements[i]; if (GroupWriter.IsGroupHeader(el)) { var skip = GroupWriter.WriteGroup(dw, settings, d, el); i += skip; } else { DICOMElementWriter.Write(dw, settings, el); } } }
public static void WriteObjectLittleEndian(DICOMBinaryWriter dw, DICOMWriteSettings settings, DICOMObject d) { for (int i = 0; i < d.Elements.Count; i++) { IDICOMElement el = d.Elements[i]; DICOMWriteSettings currentSettings = IsFileMetaGroup(el) ? settings.GetFileMetaSettings() : settings; if (GroupWriter.IsGroupHeader(el)) { int skip = GroupWriter.WriteGroupLittleEndian(dw, currentSettings, d, el); i += skip; } else { DICOMElementWriter.WriteLittleEndian(dw, currentSettings, el); } } }
/// <summary> /// Ignores the rule of writing metadata in explicit VR little endian and instead writes all elements with the passed in syntax /// </summary> /// <param name="dw"></param> /// <param name="settings"></param> /// <param name="d"></param> /// <param name="isSequenceItem"></param> public static void WriteSameSyntax(DICOMBinaryWriter dw, DICOMWriteSettings settings, DICOMObject d, bool isSequenceItem = false) { for (int i = 0; i < d.Elements.Count; i++) { IDICOMElement el = d.Elements[i]; if (!isSequenceItem) { TransferSyntaxHelper.SetSyntax(d, settings.TransferSyntax); } if (GroupWriter.IsGroupHeader(el)) { int skip = GroupWriter.WriteGroup(dw, settings, d, el); i += skip; } else { DICOMElementWriter.Write(dw, settings, el); } } }
public static void Write(DICOMBinaryWriter dw, DICOMWriteSettings settings, DICOMObject d, bool isSequenceItem = false) { for (var i = 0; i < d.Elements.Count; i++) { var el = d.Elements[i]; if (!isSequenceItem) { TransferSyntaxHelper.SetSyntax(d, settings.TransferSyntax); } var currentSettings = IsFileMetaGroup(el) ? settings.GetFileMetaSettings() : settings; if (GroupWriter.IsGroupHeader(el)) { var skip = GroupWriter.WriteGroup(dw, currentSettings, d, el); i += skip; } else { DICOMElementWriter.Write(dw, currentSettings, el); } } }