MoveRootElement Example for C++Builder
int nRet1, nRet2;
LEADDicom1->EnableMethodErrors = true;
try
{
/* move to first element in Data Set */
LEADDicom1->MoveFirstElement(false);
LEADDicom1->FindTag(LEADDicom1->CurrentElement->Tag);
ShowMessage("Element: " + LEADDicom1->CurrentTag->Name);
/* move to next element in the same level of the Data Set */
LEADDicom1->MoveNextElement(true);
LEADDicom1->FindTag(LEADDicom1->CurrentElement->Tag);
ShowMessage("Element: " + LEADDicom1->CurrentTag->Name);
/* move to last element in the same level of the Data Set */
LEADDicom1->MoveLastElement(true);
LEADDicom1->FindTag(LEADDicom1->CurrentElement->Tag);
ShowMessage("Element: " + LEADDicom1->CurrentTag->Name);
/* move to previous element in the same level of the Data Set */
LEADDicom1->MovePrevElement(true);
LEADDicom1->FindTag(LEADDicom1->CurrentElement->Tag);
ShowMessage("Element: " + LEADDicom1->CurrentTag->Name);
/* find the first element that has a child */
LEADDicom1->EnableMethodErrors = false;
nRet1 = LEADDicom1->MoveFirstElement(false);
while(nRet1 == SUCCESS)
{
nRet2 = LEADDicom1->MoveChildElement();
if(nRet2 == SUCCESS)
{
LEADDicom1->FindTag(LEADDicom1->CurrentElement->Tag);
ShowMessage("Element: " + LEADDicom1->CurrentTag->Name);
nRet1 = SUCCESS+1; /* end loop */
}
if(nRet1 != SUCCESS+1)
/* check next element in this same level */
nRet1 = LEADDicom1->MoveNextElement(true);
}
LEADDicom1->EnableMethodErrors = true;
/* move back to the element/* s parent */
if(nRet1 == 1)
{
LEADDicom1->MoveParentElement();
LEADDicom1->FindTag(LEADDicom1->CurrentElement->Tag);
ShowMessage("Element: " + LEADDicom1->CurrentTag->Name);
}
}
catch(ELEADDicomError *e)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
}