GetStringValue 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 String Values }
LEADDicom1.InsertElement(false, TAG_IMAGE_TYPE, VR_CS, false, 0);
{ insert some string values into the element }
LEADDicom1.StringValueCount := 5;
For x := 0 To 5 - 1 do
LEADDicom1.StringValues[x] := 'String #' + IntToStr(x + 1);
{ set the strings }
nRet := LEADDicom1.SetStringValue(5);
If nRet <> SUCCESS Then
begin
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
Exit;
End;
LEADDicom1.StringValueCount := 0; { free the values }
Memo1.Lines.Clear();
{ get the value count }
uCount := LEADDicom1.GetValueCount();
ShowMessage('There are ' + IntToStr(uCount) + ' values!');
{ get the values }
nRet := LEADDicom1.GetStringValue(0, uCount);
If nRet = SUCCESS Then
For x := 0 To LEADDicom1.StringValueCount - 1 do
{ display each value separated on a separate line }
Memo1.Lines.Add(LEADDicom1.StringValues[x]);
LEADDicom1.EnableMethodErrors := true;
ShowMessage('wait');
End;