ClearCanvas.Dicom.DicomFragmentSequence.CalculateWriteLength C# (CSharp) Method

CalculateWriteLength() private method

private CalculateWriteLength ( ClearCanvas.Dicom.TransferSyntax syntax, DicomWriteOptions options ) : uint
syntax ClearCanvas.Dicom.TransferSyntax
options DicomWriteOptions
return uint
		internal override uint CalculateWriteLength(TransferSyntax syntax, DicomWriteOptions options)
		{
			uint length = 0;
			length += 4; // element tag
			if (syntax.ExplicitVr)
			{
				length += 2; // vr
				length += 6; // length
			}
			else
			{
				length += 4; // length
			}

			// write the offset table (item tag is always present, though content may be zero length)
			length += 4 + 4; // item tag and length
			if (Flags.IsSet(options, DicomWriteOptions.WriteFragmentOffsetTable) && _table != null)
				length += (uint) (_table.Count*4);

			foreach (DicomFragment fragment in this._fragments)
			{
				length += 4; // item tag
				length += 4; // fragment length
				length += fragment.Length;

				// no Item Delimitation Item (fragments are always explicit length)
			}

			length += 4 + 4; // Sequence Delimitation Item (fragment sequences are always undefined length)

			return length;
		}