This is my solution:
Sample call:
TagValueStr :=GetDicomTagValue(ImageEn1, $0008, $0010);
The code of this function:
function TForm1.GetDicomTagValue(theImageEn: TImageEn; theGroup, theElement: Word): string;
var
theTag: PIEDICOMTag;
theIndex: Integer;
dt: array [0 .. 1] of AnsiChar;
begin
result := '?';
theIndex := theImageEn.IO.Params.DICOM_Tags.IndexOf(theGroup,
theElement);
if theIndex > -1 then
begin
theTag := theImageEn.IO.Params.DICOM_Tags.GetTag(theIndex);
dt[0] := theTag.DataType[0];
dt[1] := theTag.DataType[1];
if dt = 'FL' then
result := floattoStrF(single(theTag.Data^), ffFixed, 18, 6)
else if dt = 'SL' then
result := intToStr(long(theTag.Data^))
else if dt = 'SS' then
result := intToStr(short(theTag.Data^))
else if dt = 'UL' then
result := intToStr(uLong(theTag.Data^))
else if dt = 'US' then
result := intToStr(uShort(theTag.Data^))
else // For all other types try (like PN)
result := PAnsiChar(theTag.Data);
end;
end;
Regards.