GetDateValue 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 Date Value }
LEADDicom1.InsertElement(false, TAG_PATIENT_BIRTH_DATE, VR_DA, false, 0);
{ insert an Date value into the element }
LEADDicom1.DateValueCount := 1;
LEADDicom1.DateValues[0].Year := 1971;
LEADDicom1.DateValues[0].Month := 12;
LEADDicom1.DateValues[0].Day := 12;
{ set the date }
nRet := LEADDicom1.SetDateValue(1);
If nRet <> SUCCESS Then
begin
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
Exit;
End;
LEADDicom1.DateValueCount := 0; { free the value }
Label1.Caption := '';
{ get the value count }
uCount := LEADDicom1.GetValueCount();
ShowMessage('There are ' + IntToStr(uCount) + ' values!');
{ get the value }
LEADDicom1.GetDateValue(0, uCount);
{ display the value }
Label1.Caption := 'Year: ' + IntToStr(LEADDicom1.DateValues[0].Year) + ' Month: ' + IntToStr(LEADDicom1.DateValues[0].Month) + ' Day: ' + IntToStr(LEADDicom1.DateValues[0].Day);
LEADDicom1.EnableMethodErrors := true;
ShowMessage('wait');
End;