ImageEn, unit iexBitmaps

TIEDicomTags.GetTag

TIEDicomTags.GetTag


Declaration

function GetTag(Index: integer): PIEDicomTag; overload;
function GetTag(Group, Element: Word): PIEDicomTag; overload;


Description

Returns a pointer to a raw dicom tag. You can specify it by Group/Element or its index.


Example

procedure TMainForm.btnUltrasoundRegionsClick(Sender: TObject);
  //
  procedure ShowTags(memo: TMemo; tags: TIEDicomTags; indent: integer = 0);
  var
    i, j, k: integer;
    tag: PIEDicomTag;
    sDescription, sDataType, indentStr: string;
  begin
    indentStr := '';
    for k := 1 to Indent do
      indentStr := indentStr + ' ';
    for i := 0 to tags.Count - 1 do
    begin
      tag := tags.GetTag(i);
      sDescription := IEGetDicomTagDescription( tags, i );
      if sDescription = '' then
        sDescription := 'Unknown';
      sDataType := String( DicomTagToStr(tag^.DataType) );
      memo.Lines.Add( indentStr + Format('%d of %d: (%.4x,%.4x) %s (%s) : "%s"', [i+1, tags.Count, tag^.Group, tag^.Element, sDescription, sDataType, tags.GetTagString(i)]));
      if assigned(tag.Children) then
      begin
        // tag.Children is a TObjectList object, where each item is a TIEDicomTags object to pass recursively into ShowRawTags
        for j := 0 to tag.Children.Count - 1 do
        begin
          memo.Lines.Add( indentStr + Format('- Child %d of %d:', [j+1, tag.Children.Count]));
          ShowTags( memo, tag.Children[j] as TIEDicomTags, indent + 1 );
        end;
      end;
    end;
  end;
  //
var
  i: integer;
  destFN: string;
  sq: PIEDicomTag;
begin
  // Parse children of Sequence of Ultrasound Regions (0018,6011)
  sq := ImageEnView1.IO.Params.DICOM_Tags.GetTag($0018,$6011);
  if assigned(sq) = False then
    memo1.Lines.Add( 'Tag not found' )
  else
  if sq.Children.Count = 0 then
    memo1.Lines.Add( 'Tag has no children' )
  else
  begin
    memo1.Lines.Add( 'Children: ' + IntToStr( sq.Children.Count ));
    for i := 0 to sq.Children.Count - 1 do
      ShowTags( Memo1, sq.Children[i] as TIEDicomTags, 0 );
  end;
end;


See Also

- GetTagChildren
- GetTagString
- GetTagNumeric
- IEGetDicomTagDescription
- Advanced Meta Helpers