GetTimeValue Example for Delphi
var
uCount: Cardinal;
nRet: Integer;
begin
LEADDicom1.EnableMethodErrors := false;
{ move to the root element }
LEADDicom1.MoveFirstElement(false);
LEADDicom1.MoveRootElement();
{ insert a new element for the Time Value }
LEADDicom1.InsertElement(false, TAG_PATIENT_BIRTH_TIME, VR_TM, false, 0);
{ insert an Time value into the element }
LEADDicom1.TimeValueCount := 1;
LEADDicom1.TimeValues[0].Hours := 12;
LEADDicom1.TimeValues[0].Minutes := 25;
LEADDicom1.TimeValues[0].Seconds := 33;
LEADDicom1.TimeValues[0].Fractions := 50;
{ set the time }
nRet := LEADDicom1.SetTimeValue(1);
If nRet <> SUCCESS Then
begin
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
Exit;
End;
LEADDicom1.TimeValueCount := 0; { free the value }
Label1.Caption := '';
{ get the value count }
uCount := LEADDicom1.GetValueCount();
ShowMessage('There are ' + IntToStr(uCount) + ' values!');
{ get the value }
LEADDicom1.GetTimeValue(0, uCount);
{ display the value }
Label1.Caption := 'Hours: ' + IntToStr(LEADDicom1.TimeValues[0].Hours)
+ ' Minutes: ' + IntToStr(LEADDicom1.TimeValues[0].Minutes)
+ ' Seconds: ' + IntToStr(LEADDicom1.TimeValues[0].Seconds)
+ ' Fractions: ' + IntToStr(LEADDicom1.TimeValues[0].Fractions);
LEADDicom1.EnableMethodErrors := true;
ShowMessage('wait');
End;