本文整理汇总了C#中Dicom.Data.DcmDataset.SelectByteOrder方法的典型用法代码示例。如果您正苦于以下问题:C# DcmDataset.SelectByteOrder方法的具体用法?C# DcmDataset.SelectByteOrder怎么用?C# DcmDataset.SelectByteOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dicom.Data.DcmDataset
的用法示例。
在下文中一共展示了DcmDataset.SelectByteOrder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
/// <summary>
/// Write dataset to stream
/// </summary>
/// <param name="dataset">Dataset</param>
/// <param name="options">DICOM write options</param>
/// <returns>Status code</returns>
public DicomWriteStatus Write(DcmDataset dataset, DicomWriteOptions options) {
TransferSyntax = dataset.InternalTransferSyntax;
dataset.SelectByteOrder(_syntax.Endian);
foreach (DcmItem item in dataset.Elements) {
if (item.Tag.Element == 0x0000)
continue;
if (Flags.IsSet(options, DicomWriteOptions.CalculateGroupLengths)
&& item.Tag.Group != _group && item.Tag.Group <= 0x7fe0)
{
_group = item.Tag.Group;
_writer.Write((ushort)_group);
_writer.Write((ushort)0x0000);
if (_syntax.IsExplicitVR) {
_writer.Write((byte)'U');
_writer.Write((byte)'L');
_writer.Write((ushort)4);
} else {
_writer.Write((uint)4);
}
_writer.Write((uint)dataset.CalculateGroupWriteLength(_group, _syntax, options));
}
_writer.Write((ushort)item.Tag.Group);
_writer.Write((ushort)item.Tag.Element);
if (_syntax.IsExplicitVR) {
_writer.Write((byte)item.VR.VR[0]);
_writer.Write((byte)item.VR.VR[1]);
}
if (item is DcmItemSequence) {
DcmItemSequence sq = item as DcmItemSequence;
if (_syntax.IsExplicitVR)
_writer.Write((ushort)0x0000);
if (Flags.IsSet(options, DicomWriteOptions.ExplicitLengthSequence) || (item.Tag.IsPrivate && !_syntax.IsExplicitVR)) {
int hl = _syntax.IsExplicitVR ? 12 : 8;
_writer.Write((uint)sq.CalculateWriteLength(_syntax, options & ~DicomWriteOptions.CalculateGroupLengths) - (uint)hl);
} else {
_writer.Write((uint)UndefinedLength);
}
foreach (DcmItemSequenceItem ids in sq.SequenceItems) {
ids.Dataset.ChangeTransferSyntax(dataset.InternalTransferSyntax, null);
_writer.Write((ushort)DicomTags.Item.Group);
_writer.Write((ushort)DicomTags.Item.Element);
if (Flags.IsSet(options, DicomWriteOptions.ExplicitLengthSequenceItem)) {
_writer.Write((uint)ids.CalculateWriteLength(_syntax, options & ~DicomWriteOptions.CalculateGroupLengths) - (uint)8);
} else {
_writer.Write((uint)UndefinedLength);
}
Write(ids.Dataset, options & ~DicomWriteOptions.CalculateGroupLengths);
if (!Flags.IsSet(options, DicomWriteOptions.ExplicitLengthSequenceItem)) {
_writer.Write((ushort)DicomTags.ItemDelimitationItem.Group);
_writer.Write((ushort)DicomTags.ItemDelimitationItem.Element);
_writer.Write((uint)0x00000000);
}
}
if (!Flags.IsSet(options, DicomWriteOptions.ExplicitLengthSequence) && !(item.Tag.IsPrivate && !_syntax.IsExplicitVR)) {
_writer.Write((ushort)DicomTags.SequenceDelimitationItem.Group);
_writer.Write((ushort)DicomTags.SequenceDelimitationItem.Element);
_writer.Write((uint)0x00000000);
}
}
else if (item is DcmFragmentSequence) {
DcmFragmentSequence fs = item as DcmFragmentSequence;
if (_syntax.IsExplicitVR)
_writer.Write((ushort)0x0000);
_writer.Write((uint)UndefinedLength);
_writer.Write((ushort)DicomTags.Item.Group);
_writer.Write((ushort)DicomTags.Item.Element);
if (Flags.IsSet(options, DicomWriteOptions.WriteFragmentOffsetTable) && fs.HasOffsetTable) {
_writer.Write((uint)fs.OffsetTableBuffer.Length);
fs.OffsetTableBuffer.CopyTo(_writer.BaseStream);
} else {
_writer.Write((uint)0x00000000);
}
foreach (ByteBuffer bb in fs.Fragments) {
_writer.Write((ushort)DicomTags.Item.Group);
_writer.Write((ushort)DicomTags.Item.Element);
_writer.Write((uint)bb.Length);
//.........这里部分代码省略.........