GetFloatValue 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 Float Values */
LEADDicom1->InsertElement(false, TAG_TABLE_OF_PARAMETER_VALUES, VR_FL, false, 0);
/* insert some float values into the element */
LEADDicom1->FloatValueCount = 5;
for(x=0; x<5; x++)
LEADDicom1->FloatValues[x] = x * 1.99;
/* set the floats */
nRet = LEADDicom1->SetFloatValue(5);
if(nRet != SUCCESS)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
return;
}
LEADDicom1->FloatValueCount = 0; /* free the values */
Memo1->Lines->Clear();
/* get the value count */
uCount = LEADDicom1->GetValueCount();
ShowMessage("There are " + IntToStr(uCount) + " values!");
/* get the values */
nRet = LEADDicom1->GetFloatValue(0, uCount);
if(nRet == SUCCESS)
for(x=0; x<LEADDicom1->FloatValueCount; x++)
/* display each value in a new line */
Memo1->Lines->Add(FloatToStr(LEADDicom1->FloatValues[x]));
LEADDicom1->EnableMethodErrors = true;
ShowMessage("wait");