MoveFirstVR Example for C++Builder
void DisplayItem(AnsiString sPrompt)
{
int nRestrict;
AnsiString sOut, sTmp;
sOut = sPrompt + "\n";
Form1->LEADDicom1->EnableMethodErrors = true;
try
{
/* display the items information */
switch(Form1->LEADDicom1->CurrentVR->Code)
{
case VR_AE:
sTmp = "AE";
break;
case VR_AS:
sTmp = "AS";
break;
case VR_AT:
sTmp = "AT";
break;
case VR_CS:
sTmp = "CS";
break;
case VR_DA:
sTmp = "DA";
break;
case VR_DS:
sTmp = "DS";
break;
case VR_DT:
sTmp = "DT";
break;
case VR_FD:
sTmp = "FD";
break;
case VR_FL:
sTmp = "FL";
break;
case VR_IS:
sTmp = "IS";
break;
case VR_LO:
sTmp = "LO";
break;
case VR_LT:
sTmp = "LT";
break;
case VR_OB:
sTmp = "OB";
break;
case VR_OW:
sTmp = "OW";
break;
case VR_PN:
sTmp = "PN";
break;
case VR_SH:
sTmp = "SH";
break;
case VR_SL:
sTmp = "SL";
break;
case VR_SQ:
sTmp = "SQ";
break;
case VR_SS:
sTmp = "SS";
break;
case VR_ST:
sTmp = "ST";
break;
case VR_TM:
sTmp = "TM";
break;
case VR_UI:
sTmp = "UI";
break;
case VR_UL:
sTmp = "UL";
break;
case VR_UN:
sTmp = "UN";
break;
case VR_US:
sTmp = "US";
break;
case VR_UT:
sTmp = "UT";
break;
default:
sTmp = IntToStr(Form1->LEADDicom1->CurrentVR->Code);
break;
}
sOut = sOut + "Code: " + sTmp + "\n";
sOut = sOut + "Name: " + Form1->LEADDicom1->CurrentVR->Name + "\n";
sOut = sOut + "Length: " + IntToStr(Form1->LEADDicom1->CurrentVR->Length) + "\n";
nRestrict = Form1->LEADDicom1->CurrentVR->Restrict;
nRestrict = nRestrict & ~VR_BINARY;
nRestrict = nRestrict & ~VR_STRING;
nRestrict = nRestrict & ~VR_TEXT;
switch(nRestrict)
{
case VR_FIXED:
sTmp = "Fixed";
break;
case VR_MAXIMUM:
sTmp = "Maximum";
break;
case VR_MAXIMUM_GROUP:
sTmp = "Maximum Group";
break;
case VR_ANY:
sTmp = "Any Length";
break;
case VR_NOT_APPLICABLE:
sTmp = "Not Applicable";
break;
case VR_MAX:
sTmp = "Max";
break;
default:
sTmp = IntToStr(Form1->LEADDicom1->CurrentVR->Restrict);
break;
}
sOut = sOut + "Restrict: " + sTmp + "\n";
sOut = sOut + "UnitSize: " + IntToStr(Form1->LEADDicom1->CurrentVR->UnitSize) + "\n";
ShowMessage(sOut);
}
catch(ELEADDicomError *e)
{
ShowMessage("Error Number: " + IntToStr(Form1->LEADDicom1->Error));
}
} /* end of DisplayItem */
void __fastcall TForm1::MoveVR1Click(TObject *Sender)
{
LEADDicom1->MoveFirstVR();
DisplayItem("FirstVR");
LEADDicom1->MoveNextVR();
DisplayItem("NextVR");
LEADDicom1->MoveLastVR();
DisplayItem("LastVR");
LEADDicom1->MovePrevVR();
DisplayItem("PrevVR");
}