ImageGear for .NET User Guide > Using ImageGear for .NET > Using ImageGear.Formats.DICOM Namespace > DICOM Metadata Support |
ImageGear for .NET uses its general metadata engine for all file formats, including DICOM. When ImageGear loads a DICOM image, it builds a metadata tree structure and attached it to the new ImGearPage Class object. Use ImageGear for .NET Metadata support classes to access data items in this tree.
A DICOM file includes one header with metadata, and zero, one, or multiple images. Metadata applies to all images in the file. ImageGear loads a copy of DICOM metadata into every loaded page. DICOM Document metadata is empty.
See the DICOM section in the ImageGear Imaging Formats Reference chapter information about the detailed structure of the DICOM Metadata tree.
DICOM tags map to ImageGear metadata tags as follows:
Tag group number, element number | |
Value Representation | ImGearMetadataLeaf.NativeType Field |
Value Length | Not stored explicitly. Application can use string and array lengths instead. |
Value Multiplicity (Item count) | Not stored explicitly. For values of OB/OW/OF it is always 1. For other Value Representations, if data is singular it is 1, otherwise it is equal to the length of the data array. |
Data | ImGearMetadataLeaf.Data Property |
"Sequence" (SQ) tags are represented by nested metadata trees. SQ contains one or more Sequence Items, and cannot contain normal DICOM tags. Sequence Item contains a set of DICOM tags.
The following tags are read from the file, but not added to the metadata tree:
The following table lists the mapping between DICOM Value Representations and .NET system types:
VR | Meaning | System type to which it converts on reading | Allowed system types on writing |
AE | Application Entity | String | String |
AS | Age String | String | String |
AT | Attribute Tag | String | String |
CS | Code String | String | String |
DA | Date | String | String |
DS | Decimal String | double | all numeric types, String |
DT | Date Time | String | String |
FL | Floating Point Single | float | all numeric types, String |
FD | Floating Point Double | double | all numeric types, String |
IS | Integer String | long (64-bit) | all integer types, String |
LO | Long String | String | String |
LT | Long Text | String | String |
OB | Other Byte String | byte[] | byte[] |
OW | Other Word String | ushort[] | ushort[] |
PN | Person Name | String | String |
SH | Short String | String | String |
SL | Signed Long | int | all integer types, String |
SQ | Sequence | - | - |
SS | Signed Short | short | all integer types, String |
ST | Short Text | String | String |
TM | Time | String | String |
UI | Unique Identifier | String | String |
UL | Unsigned Long | uint | all integer types, String |
UN | Unknown | byte[] | byte[] |
US | Unsigned Short | ushort | all integer types, String |
UT | Unlimited Text | String | String |
OF | Other Float String | float[] | float[], double[] |
For types other than OB, OW and OF, if the system type is an array, a multivalued data element is saved.
Example of conversion on metadata reading:
VR | Tag value | Metadata leaf data type | Metadata leaf value |
US | 0x0001 | ushort | 1 |
OW | 0x0001 0x0002 0x0003 | ushort[] | {1, 2, 3} |
DS | "0.12345\0.6789" | double[] | {0.12345, 0.6789} |
CS | "MR" | string | "MR" |
CS | "ORIGINAL\PRIMARY" | string[] | {"ORIGINAL", "PRIMARY"} |