GetLongValue 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 Long Values */
LEADDicom1->InsertElement(false, TAG_OFFSET_CHILD_DIRECTORY, VR_UL, false, 0);
Label1->Caption = "";
/* insert some long values into the element */
LEADDicom1->LongValueCount = 5;
for(x=0; x<5; x++)
LEADDicom1->LongValues[x] = x * 100000;
/* set the longs */
nRet = LEADDicom1->SetLongValue(5);
if(nRet != SUCCESS)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
return;
}
LEADDicom1->LongValueCount = 0; /* free the values */
/* get the value count */
uCount = LEADDicom1->GetValueCount();
ShowMessage("There are " + IntToStr(uCount) + " values!");
/* get the values */
nRet = LEADDicom1->GetLongValue(0, uCount);
if(nRet == SUCCESS)
for(x=0; x<LEADDicom1->LongValueCount; x++)
/* display each value separated by " X " */
Label1->Caption = Label1->Caption + " X " + IntToStr(LEADDicom1->LongValues[x]);
LEADDicom1->EnableMethodErrors = true;
ShowMessage("wait");