dicom学习笔记之二:数据元素编码

2023-10-02 17 0

        VM:value multiply =如果数据类型是字符串,就会用反斜杠把相关的值区分开来;如果是字节流,就需要用长度和当前的类型进行除法运算来获取。

        

        在显式语法中,如果VR值是OB, OW, OF, SQ, UT, UN类型

Tag

VR

Value Length

Value

Group

Number

(16-bit

unsigned

integer)

Element

Number

(16-bit

unsigned

integer)

VR(2 byte character string) of

"OB",

"OW",

“OF”,

“SQ”, “UT”

or "UN"

Reserved

(2 bytes)

set to a

value of

0000H

32-bit unsigned

integer

Even number of bytes containing the Data Element Value(s) encoded according to the VR and negotiated Transfer Syntax. Delimited with

Sequence Delimitation Item if of Undefined

Length.

2 bytes

2 bytes

2 bytes

2 bytes

4 bytes

'Value Length' bytes if of Explicit Length

        否则的话,     

Tag

VR

Value Length

Value

Group

Number

(16-bit

unsigned

integer)

Element

Number

(16-bit

unsigned

integer)

VR

(2 byte character

string)

(16-bit unsigned

integer)

Even number of bytes containing the Data Element Value(s) encoded according to the VR and negotiated Transfer Syntax.

2 bytes

2 bytes

2 bytes

2 bytes

'Value Length' bytes

        在隐式的情况下:

Tag

Value Length

Value

Group

Number

(16-bit

unsigned

integer)

Element

Number

(16-bit

unsigned

integer)

32-bit unsigned integer

Even number of bytes

containing the Data

Elements Value

encoded according to

the VR specified in PS

3.6 and the negotiated

Transfer Syntax.

Delimited with

Sequence Delimitation

Item if of Undefined

Length.

2 bytes

2 bytes

4 bytes

'Value Length' bytes or

Undefined Length

 在dcmtk代码如下:

 /* read the value in the length field. In some cases, it is 4 bytes wide, in other *//* cases only 2 bytes (see DICOM standard (year 2000) part 5, section 7.1.1) (or the *//* corresponding section in a later version of the standard) */if (xferSyn.isImplicitVR() || nxtobj == EVR_na)   //note that delimitation items don't have a VR{inStream.read(&valueLength, 4);            //length field is 4 bytes wideswapIfNecessary(gLocalByteOrder, byteOrder, &valueLength, 4, 4);bytesRead += 4;} else {                                       //the transfer syntax is explicit VRDcmVR vr(newTag.getEVR());if (vr.usesExtendedLengthEncoding()){Uint16 reserved;inStream.read(&reserved, 2);           // 2 reserved bytesinStream.read(&valueLength, 4);        // length field is 4 bytes wideswapIfNecessary(gLocalByteOrder, byteOrder, &valueLength, 4, 4);bytesRead += 6;} else {Uint16 tmpValueLength;inStream.read(&tmpValueLength, 2);     // length field is 2 bytes wideswapIfNecessary(gLocalByteOrder, byteOrder, &tmpValueLength, 2, 2);bytesRead += 2;valueLength = tmpValueLength;}}

代码编程
赞赏

相关文章

数商云食品行业解决方案:新技术加持食品行业,为企业快速发展提供有力支撑
星期零斩获2021新消费领域“投资界50强企业”和“中国食品工业创新品牌”奖项
2022-2028年中国食品产业园区行业市场运行格局及发展策略分析报告
工业互联网业务知识
面试3_:不修改数组找出重复的数字
劲牌公司荣获2020年度“中国食品工业协会科学技术奖”特等奖