GetAgeValue Example for C++Builder
Cardinal uCount;
int nRet;
Label1->Caption = "";
LEADDicom1->EnableMethodErrors = false;
/* move to the root element */
LEADDicom1->MoveFirstElement(false);
LEADDicom1->MoveRootElement();
/* insert a new element for the Age Value */
LEADDicom1->InsertElement(false, TAG_PATIENT_AGE, VR_AS, false, 0);
/* insert an Age value into the element */
LEADDicom1->AgeValueCount = 1;
LEADDicom1->AgeValues[0]->Number = 21;
LEADDicom1->AgeValues[0]->Reference = VALUE_AGE_YEARS;
/* set the age */
nRet = LEADDicom1->SetAgeValue(1);
if(nRet != SUCCESS)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
return;
}
LEADDicom1->AgeValueCount = 0; /* free the value */
/* get the value count */
uCount = LEADDicom1->GetValueCount();
ShowMessage("There are " + IntToStr(uCount) + " values!");
/* get the value */
LEADDicom1->GetAgeValue(0, uCount);
/* display the value */
Label1->Caption = "Number: " + IntToStr(LEADDicom1->AgeValues[0]->Number) + " Ref: " + LEADDicom1->AgeValues[0]->Reference;
LEADDicom1->EnableMethodErrors = true;
ShowMessage("wait");