private static DicomDataset ReadFragment(byte[] bytes, Endian endian, bool explicitVr)
 {
   var dataset = new DicomDataset();
   var reader = new DicomReader { IsExplicitVR = explicitVr };
   var byteSource = new ByteBufferByteSource(new MemoryByteBuffer(bytes)) { Endian = endian };
   reader.Read(byteSource, new DicomDatasetReaderObserver(dataset));
   return dataset;
 }
Exemplo n.º 2
0
            internal RLEDecoder(IByteBuffer data)
            {
                var source = new ByteBufferByteSource(data) { Endian = Endian.Little };
                this.NumberOfSegments = source.GetInt32();

                this.offsets = new int[15];
                for (var i = 0; i < 15; ++i)
                {
                    this.offsets[i] = source.GetInt32();
                }

                this.data = data.Data;
            }
    private DicomDataset DeepClone_(DicomDataset dataset)
    {
      var ms = new MemoryStream();
      var target = new StreamByteTarget(ms);
      var writer = new DicomWriter(DicomTransferSyntax.ImplicitVRLittleEndian, DicomWriteOptions.Default, target);
      var walker = new DicomDatasetWalker(dataset);
      walker.Walk(writer);

      var clone = new DicomDataset();
      var reader = new DicomReader { IsExplicitVR = false };
      var byteSource = new ByteBufferByteSource(
        new MemoryByteBuffer(ms.ToArray()));
      reader.Read(byteSource, new DicomDatasetReaderObserver(clone));
      return clone;
    }