GetDoubleValue Example for Delphi
var
uCount: Cardinal;
x: Cardinal;
nRet: Integer;
begin
LEADDicom1.EnableMethodErrors := false;
{ move to the root element }
LEADDicom1.MoveFirstElement(false);
LEADDicom1.MoveRootElement();
{ insert a new element for the Double Values }
LEADDicom1.InsertElement(false, TAG_REFERENCE_PIXEL_PHYSICAL_VALUE_X, VR_FD, false, 0);
{ insert some Double values into the element }
LEADDicom1.DoubleValueCount := 5;
For x := 0 To 5 - 1 do
LEADDicom1.DoubleValues[x] := 10 * x * 199.77;
{ set the numbers }
nRet := LEADDicom1.SetDoubleValue(5);
If nRet <> SUCCESS Then
begin
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
Exit;
End;
LEADDicom1.DoubleValueCount := 0; { free the values }
Label1.Caption := '';
{ get the value count }
uCount := LEADDicom1.GetValueCount();
ShowMessage('There are ' + IntToStr(uCount) + ' values!');
{ get the values }
nRet := LEADDicom1.GetDoubleValue(0, uCount);
If nRet = SUCCESS Then
For x := 0 To LEADDicom1.DoubleValueCount - 1 do
{ display each value separated by ' X ' }
Label1.Caption := Label1.Caption + ' X ' + FloatToStr(LEADDicom1.DoubleValues[x]);
LEADDicom1.EnableMethodErrors := true;
End;