InsertTag Example for C++Builder
int nRet;
AnsiString sOutput, sItem, sItemL, sItemR;
LEADDicom1->EnableMethodErrors = false;
nRet = LEADDicom1->FindTag(0x20007);
if(nRet == SUCCESS)
{
ShowMessage("Already Exists!");
return;
}
nRet = LEADDicom1->InsertTag(0x20007, Cardinal(-1), "My Test Tag", VR_OB, 1, 1, 1);
if(nRet != SUCCESS)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
return;
}
LEADDicom1->EnableMethodErrors = true;
try
{
/* Display added item */
sOutput = "Inserted tag:\n";
sItem = IntToHex(LEADDicom1->CurrentTag->Code, 8);
sItemR = sItem.SubString(1, 4);
sItemL = sItem.SubString(5, 4);
sOutput = sOutput + "Code = \t" + sItemL + ":" + sItemR + "\n";
sItem = IntToHex(LEADDicom1->CurrentTag->Mask, 8);
sItemR = sItem.SubString(1, 4);
sItemL = sItem.SubString(5, 4);
sOutput = sOutput + "Mask = \t" + sItemL + ":" + sItemR + "\n";
sOutput = sOutput + "Name = \t" + LEADDicom1->CurrentTag->Name + "\n";
sOutput = sOutput + "VR = \t" + IntToStr(LEADDicom1->CurrentTag->VR) + "\n";
sOutput = sOutput + "MinVM = \t" + IntToStr(LEADDicom1->CurrentTag->MinVM) + "\n";
sOutput = sOutput + "MaxVM = \t" + IntToStr(LEADDicom1->CurrentTag->MaxVM) + "\n";
sOutput = sOutput + "DivideVM = \t" + IntToStr(LEADDicom1->CurrentTag->DivideVM) + "\n";
ShowMessage(sOutput);
}
catch(ELEADDicomError *e)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
}