TIEDicomTags.GetTagChildren
Declaration
function GetTagChildren(Group, Element: Word): TObjectList;
function GetTagChildren(Index: integer): TObjectList;
Description
Returns the children of DICOM tag as TIEDicomTags object. You can specify it by Group/Element or its
index.
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;
ol: TObjectList;
begin
// Parse children of Sequence of Ultrasound Regions (0018,6011)
ol := ImageEnView1.IO.Params.DICOM_Tags.GetTagChildren($0018, $6011);
if assigned(ol) = False then
memo1.Lines.Add( 'Tag not found' )
else
if ol.Count = 0 then
memo1.Lines.Add( 'Tag has no children' )
else
begin
memo1.Lines.Add( 'Children: ' + IntToStr( ol.Count ));
for i := 0 to ol.Count - 1 do
ShowTags( Memo1, ol[i] as TIEDicomTags, 0 );
end;
end;