示例#1
0
        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;
                    }
                }
            }
        }
示例#2
0
 /// <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);
         }
     }
 }
示例#3
0
        public static void Write(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.WriteGroup(dw, currentSettings, d, el);
                    i += skip;
                }
                else
                {
                    DICOMElementWriter.Write(dw, currentSettings, el);
                }
            }
        }
示例#4
0
 /// <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);
         }
     }
 }
示例#5
0
 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);
         }
     }
 }