GetLongValue Example for Delphi
var
uCount, x: Cardinal;
nRet: Integer;
begin
LEADDicom1.EnableMethodErrors := false;
{ move to the root element }
LEADDicom1.MoveFirstElement(false);
LEADDicom1.MoveRootElement();
{ insert a new element for the Long Values }
LEADDicom1.InsertElement(false, TAG_OFFSET_CHILD_DIRECTORY, VR_UL, false, 0);
Label1.Caption := '';
{ insert some long values into the element }
LEADDicom1.LongValueCount := 5;
For x := 0 To 5 - 1 do
LEADDicom1.LongValues[x] := x * 100000;
{ set the longs }
nRet := LEADDicom1.SetLongValue(5);
If nRet <> SUCCESS Then
begin
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
Exit;
End;
LEADDicom1.LongValueCount := 0; { free the values }
{ get the value count }
uCount := LEADDicom1.GetValueCount();
ShowMessage('There are ' + IntToStr(uCount) + ' values!');
{ get the values }
nRet := LEADDicom1.GetLongValue(0, uCount);
If nRet = SUCCESS Then
For x := 0 To LEADDicom1.LongValueCount - 1 do
{ display each value separated by ' X ' }
Label1.Caption := Label1.Caption + ' X ' + IntToStr(LEADDicom1.LongValues[x]);
LEADDicom1.EnableMethodErrors := true;
ShowMessage('wait');
End;