InsertTag Example for Delphi
const
TAB_CHAR = #9;
NEW_LINE = #10#13;
var
nRet: Integer;
sOutput, sItem: String;
sItemL: String;
sItemR: String;
begin
LEADDicom1.EnableMethodErrors := false;
nRet := LEADDicom1.FindTag($20007);
If nRet = SUCCESS Then
begin
ShowMessage('Already Exists!');
Exit;
End;
nRet := LEADDicom1.InsertTag($20007, Cardinal(-1), 'My Test Tag', VR_OB, 1, 1, 1);
If nRet <> SUCCESS Then
begin
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
exit;
End;
LEADDicom1.EnableMethodErrors := true;
try
{ Display added item }
sOutput := 'Inserted tag:' + NEW_LINE;
sItem := IntToHex(LEADDicom1.CurrentTag.Code, 8);
sItemR := copy(sItem, 1, 4);
sItemL := copy(sItem, 5, 4);
sOutput := sOutput + 'Code = ' + TAB_CHAR + sItemL + ':' + sItemR + NEW_LINE;
sItem := IntToHex(LEADDicom1.CurrentTag.Mask, 8);
sItemR := Copy(sItem, 1, 4);
sItemL := Copy(sItem, 5, 4);
sOutput := sOutput + 'Mask = ' + TAB_CHAR + sItemL + ':' + sItemR + NEW_LINE;
sOutput := sOutput + 'Name = ' + TAB_CHAR + LEADDicom1.CurrentTag.Name + NEW_LINE;
sOutput := sOutput + 'VR = ' + TAB_CHAR + IntToStr(LEADDicom1.CurrentTag.VR) + NEW_LINE;
sOutput := sOutput + 'MinVM = ' + TAB_CHAR + IntToStr(LEADDicom1.CurrentTag.MinVM) + NEW_LINE;
sOutput := sOutput + 'MaxVM = ' + TAB_CHAR + IntToStr(LEADDicom1.CurrentTag.MaxVM) + NEW_LINE;
sOutput := sOutput + 'DivideVM = ' + TAB_CHAR + IntToStr(LEADDicom1.CurrentTag.DivideVM) + NEW_LINE;
ShowMessage(sOutput);
except
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
end;
End;