ImageGear for Java User Guide > Using ImageGear for Java > Using the com.accusoft.imagegear.formats.dicom Package > DICOM Metadata Support |
ImageGear for Java 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 object. Use ImageGear's 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 (ImGearPage). DICOM metadata is not loaded into the ImGearDocument object.
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 members as follows:
Tag group number, element number |
ImGearMetadataNode.tag Field |
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.getData and ImGearMetadataLeaf.setData methods |
"Sequence" (SQ) tags are represented by nested metadata trees. SQ contains one or more Sequence Items, and cannot contain normal DICOM tags. A Sequence Item contains a set of DICOM tags.
The following tags are read from the file, but not added to the metadata tree:
Group lengths Sequence Delimitation items Item delimitation items The following table lists the mapping between DICOM Value Representations and Java 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 primitive 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 | short[] | short[] |
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 | int | all integer types, String |
UN | Unknown | byte[] | byte[] |
US | Unsigned Short | short | 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 sy
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 | short | 1 |
OW | 0x0001 0x0002 0x0003 | short[] | {1, 2, 3} |
DS | "0.12345\0.6789" | double[] | {0.12345, 0.6789} |
CS | "MR" | string | "MR" |
CS | "ORIGINAL\PRIMARY" | string[] | {"ORIGINAL", "PRIMARY"} |