GetDoubleValue Example for C++Builder
Cardinal uCount, x;
int nRet;
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; x<5; x++)
LEADDicom1->DoubleValues[x] = 10 * x * 199.77;
/* set the numbers */
nRet = LEADDicom1->SetDoubleValue(5);
if(nRet != SUCCESS)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
return;
}
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)
for(x=0; x<LEADDicom1->DoubleValueCount; x++)
/* display each value separated by " X " */
Label1->Caption = Label1->Caption + " X " + FloatToStr(LEADDicom1->DoubleValues[x]);
LEADDicom1->EnableMethodErrors = true;