Ejemplo n.º 1
0
 public static void WriteLittleEndian(DICOMBinaryWriter dw, VR vr, DICOMWriteSettings settings,
                                      IDICOMElement toWrite)
 {
     byte[] data = DataComposer.GetDataLittleEndian(toWrite);
     LengthWriter.Write(dw, vr, settings, data != null ? data.Length : 0);
     dw.Write(data != null ? data : new byte[0]);
 }
Ejemplo n.º 2
0
        public static void WriteBigEndian(DICOMBinaryWriter dw, VR vr, DICOMIOSettings settings,
                                          IDICOMElement toWrite)
        {
            var data = DataComposer.GetDataBigEndian(toWrite, settings.StringEncoding);

            LengthWriter.Write(dw, vr, settings, data != null ? data.Length : 0);
            dw.Write(data != null ? data : new byte[0]);
        }
Ejemplo n.º 3
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.Write(dw, VR.Sequence, settings, itemsBytes.Length);
                dw.Write(itemsBytes);
            }
        }
Ejemplo n.º 4
0
 public static void WriteItemLittleEndian(DICOMBinaryWriter dw, DICOMWriteSettings settings, DICOMObject d)
 {
     DICOMTagWriter.WriteLittleEndian(dw, TagHelper.Item);
     using (var stream = new MemoryStream())
     {
         using (var itemDw = new DICOMBinaryWriter(stream))
         {
             DICOMObjectWriter.Write(itemDw, settings, d, true);
             if (!settings.DoWriteIndefiniteSequences)
             {
                 LengthWriter.Write(dw, VR.Null, settings, (int)stream.Length);
                 dw.Write(stream.ToArray());
             }
             else
             {
                 WriteIndefiniteLittleEndian(dw, stream.ToArray());
             }
         }
     }
 }