ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Get DICOM tag value
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

rbeaulieu

Canada
15 Posts

Posted - Mar 07 2013 :  05:54:35  Show Profile  Reply
Hi,

I try to get some DICOM tags value with GetTagString function. The values of most tag are well return, but some have garbage characters in the return value.

The line above return '¶'#$D instead of 4644 which is the number of colums.

ImageEn1.IO.Params.DICOM_Tags.GetTagString(ImageEn1.IO.Params.DICOM_Tags.IndexOf($0028, $0011))


Regards.

rbeaulieu

Canada
15 Posts

Posted - Mar 09 2013 :  07:35:17  Show Profile  Reply
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.
Go to Top of Page

xequte

39142 Posts

Posted - Mar 09 2013 :  12:27:40  Show Profile  Reply
Nice solution

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: