public static void Write(string filePath, DICOMWriteSettings settings, DICOMObject toWrite) { using (DICOMBinaryWriter dw = new DICOMBinaryWriter(filePath)) { DICOMPreambleWriter.Write(dw); TransferSyntaxHelper.SetSyntax(toWrite, settings.TransferSyntax); DICOMObjectWriter.WriteObjectLittleEndian(dw, settings, toWrite); } }
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()); } } } }