Exemplo n.º 1
0
        public static void WriteLittleEndian(DICOMBinaryWriter dw, DICOMWriteSettings settings, IDICOMElement toWrite)
        {
            Sequence s = toWrite as Sequence;

            DICOMTagWriter.WriteLittleEndian(dw, toWrite.Tag);
            VRWriter.WriteVR(dw, settings, VR.Sequence);
            if (settings.DoWriteIndefiniteSequences)
            {
                WriteIndefiniteLength(settings, dw);
                SequenceItemWriter.WriteItemsLittleEndian(dw, settings, s.Items);
                WriteEndOfSequenceLittleEndian(dw);
            }
            else
            {
                byte[] itemsBytes = SequenceItemWriter.WriteItemsLittleEndian(settings, s.Items);
                LengthWriter.WriteLittleEndian(dw, VR.Sequence, settings, itemsBytes.Length);
                dw.Write(itemsBytes);
            }
        }
Exemplo n.º 2
0
 public static void WriteItemLittleEndian(DICOMBinaryWriter dw, DICOMWriteSettings settings, DICOMObject d)
 {
     DICOMTagWriter.WriteLittleEndian(dw, TagHelper.SEQUENCE_ITEM);
     using (MemoryStream stream = new MemoryStream())
     {
         using (DICOMBinaryWriter itemDw = new DICOMBinaryWriter(stream))
         {
             DICOMObjectWriter.WriteObjectLittleEndian(itemDw, settings, d);
             if (!settings.DoWriteIndefiniteSequences)
             {
                 LengthWriter.WriteLittleEndian(dw, VR.Null, settings, (int)stream.Length);
                 dw.Write(stream.ToArray());
             }
             else
             {
                 WriteIndefiniteLittleEndian(dw, stream.ToArray());
             }
         }
     }
 }
Exemplo n.º 3
0
 public static void WriteLittleEndian(DICOMBinaryWriter dw, VR vr, DICOMWriteSettings settings, IDICOMElement toWrite)
 {
     byte[] data = DataComposer.GetDataLittleEndian(toWrite);
     LengthWriter.WriteLittleEndian(dw, vr, settings, data != null ? data.Length : 0);
     dw.Write(data != null ? data : new byte[0]);
 }