SetCurrentElement Example for Delphi
var
uCount: Cardinal;
bFound, bFinished: Boolean;
hPrevElement, hFirstElement: THandle;
sOut: String;
begin
bFound := false;
bFinished := false;
uCount := 0;
hPrevElement := 0;
LEADDicom1.MoveFirstElement(false);
hFirstElement := LEADDicom1.CurrentElement.hElement;
While not (bFound or bFinished) do
if LEADDicom1.CurrentElement.Tag = TAG_PIXEL_DATA then
bFound := true
else if LEADDicom1.CurrentElement.hElement = hPrevElement then
bFinished := true
else
begin
hPrevElement := LEADDicom1.CurrentElement.hElement;
LEADDicom1.MoveNextElement(false);
Inc(uCount);
end;
if bFound Then
begin
LEADDicom1.FindTag(LEADDicom1.CurrentElement.Tag);
sOut := 'Found Pixel Data Element: ' + LEADDicom1.CurrentTag.Name +#13;
LEADDicom1.SetCurrentElement(hFirstElement);
LEADDicom1.FindTag(LEADDicom1.CurrentElement.Tag);
sOut := sOut + 'First Data Element in list was: ' + LEADDicom1.CurrentTag.Name +#13;
sOut := sOut + 'There are ' + IntToStr(uCount) + ' Elements between the two';
ShowMessage(sOut);
end;
end;