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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Get DICOM tag value

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
rbeaulieu Posted - Mar 07 2013 : 05:54:35
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.
2   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Mar 09 2013 : 12:27:40
Nice solution

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
rbeaulieu Posted - Mar 09 2013 : 07:35:17
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.