本文整理汇总了C#中DicomSequenceItem.CalculateWriteLength方法的典型用法代码示例。如果您正苦于以下问题:C# DicomSequenceItem.CalculateWriteLength方法的具体用法?C# DicomSequenceItem.CalculateWriteLength怎么用?C# DicomSequenceItem.CalculateWriteLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DicomSequenceItem
的用法示例。
在下文中一共展示了DicomSequenceItem.CalculateWriteLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSequenceImplicitVr2
public void TestSequenceImplicitVr2()
{
var syntax = TransferSyntax.ImplicitVrLittleEndian;
var sq = new DicomAttributeSQ(DicomTags.IconImageSequence);
var item1 = new DicomSequenceItem();
item1[DicomTags.AccessionNumber].SetStringValue("ABCDEFG");
sq.AddSequenceItem(item1);
var item2 = new DicomSequenceItem();
item2[DicomTags.AccessionNumber].SetStringValue("XYZ");
sq.AddSequenceItem(item2);
// note: both sequence and item delimiter tags are calculated as part of the sequence - the item considers only the total length of its contents
// item1_length = contents(16)
Assert.AreEqual(16, item1[DicomTags.AccessionNumber].CalculateWriteLength(syntax, DicomWriteOptions.None), "Attr1 Length");
Assert.AreEqual(16, item1.CalculateWriteLength(syntax, DicomWriteOptions.None), "Item1 Length");
// item2_length = contents(12)
Assert.AreEqual(12, item2[DicomTags.AccessionNumber].CalculateWriteLength(syntax, DicomWriteOptions.None), "Attr2 Length");
Assert.AreEqual(12, item2.CalculateWriteLength(syntax, DicomWriteOptions.None), "Item2 Length");
// sq_length = tag(4) + len(4) + item_tag(4) + item_len(4) + item1_length(16) + item_delimiter_tag(4) + item_delimiter_len(4)
// + item_tag(4) + item_len(4) + item2_length(12) + item_delimiter_tag(4) + item_delimiter_len(4)
// + sq_delimiter_tag(4) + sq_delimiter_len(4)
var options = DicomWriteOptions.None;
Assert.AreEqual(76, sq.CalculateWriteLength(syntax, options), "SQ Length (Options={0})", options);
// sq_length = tag(4) + len(4) + item_tag(4) + item_len(4) + item1_length(16) + item_delimiter_tag(4) + item_delimiter_len(4)
// + item_tag(4) + item_len(4) + item2_length(12) + item_delimiter_tag(4) + item_delimiter_len(4)
options = DicomWriteOptions.ExplicitLengthSequence;
Assert.AreEqual(68, sq.CalculateWriteLength(syntax, options), "SQ Length (Options={0})", options);
// sq_length = tag(4) + len(4) + item_tag(4) + item_len(4) + item1_length(16)
// + item_tag(4) + item_len(4) + item2_length(12)
// + sq_delimiter_tag(4) + sq_delimiter_len(4)
options = DicomWriteOptions.ExplicitLengthSequenceItem;
Assert.AreEqual(60, sq.CalculateWriteLength(syntax, options), "SQ Length (Options={0})", options);
// sq_length = tag(4) + len(4) + item_tag(4) + item_len(4) + item1_length(16)
// + item_tag(4) + item_len(4) + item2_length(12)
options = DicomWriteOptions.ExplicitLengthSequence | DicomWriteOptions.ExplicitLengthSequenceItem;
Assert.AreEqual(52, sq.CalculateWriteLength(syntax, options), "SQ Length (Options={0})", options);
}