GetShortValue 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 Short Values }
LEADDicom1.InsertElement(false, TAG_RECORD_IN_USE_FLAG, VR_US, false, 0);
Label1.Caption := '';
{ insert some short values into the element }
LEADDicom1.ShortValueCount := 5;
For x := 0 To 5 - 1 do
LEADDicom1.ShortValues[x] := x * 100;
{ set the shorts }
nRet := LEADDicom1.SetShortValue(5);
If nRet <> SUCCESS Then
begin
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
Exit;
End;
LEADDicom1.ShortValueCount := 0; { free the values }
{ get the value count }
uCount := LEADDicom1.GetValueCount();
ShowMessage('There are ' + IntToStr(uCount) + ' values!');
{ get the values }
nRet := LEADDicom1.GetShortValue(0, uCount);
If nRet = SUCCESS Then
For x := 0 To LEADDicom1.ShortValueCount - 1 do
{ display each value separated by a ' X ' }
Label1.Caption := Label1.Caption + ' X ' + IntToStr(LEADDicom1.ShortValues[x]);
ShowMessage('wait');
LEADDicom1.EnableMethodErrors := true;
End;