MoveFirstVR Example for Delphi
procedure TForm1.MoveVR1Click(Sender: TObject);
{ DisplayItem is a local procedure within MoveVR1Click }
procedure DisplayItem(sPrompt: String);
var
nRestrict: Integer;
sOut, sTmp: String;
begin
sOut := sPrompt + #13;
LEADDicom1.EnableMethodErrors := true;
try
{ display the items information }
Case LEADDicom1.CurrentVR.Code of
VR_AE: sTmp := 'AE';
VR_AS: sTmp := 'AS';
VR_AT: sTmp := 'AT';
VR_CS: sTmp := 'CS';
VR_DA: sTmp := 'DA';
VR_DS: sTmp := 'DS';
VR_DT: sTmp := 'DT';
VR_FD: sTmp := 'FD';
VR_FL: sTmp := 'FL';
VR_IS: sTmp := 'IS';
VR_LO: sTmp := 'LO';
VR_LT: sTmp := 'LT';
VR_OB: sTmp := 'OB';
VR_OW: sTmp := 'OW';
VR_PN: sTmp := 'PN';
VR_SH: sTmp := 'SH';
VR_SL: sTmp := 'SL';
VR_SQ: sTmp := 'SQ';
VR_SS: sTmp := 'SS';
VR_ST: sTmp := 'ST';
VR_TM: sTmp := 'TM';
VR_UI: sTmp := 'UI';
VR_UL: sTmp := 'UL';
VR_UN: sTmp := 'UN';
VR_US: sTmp := 'US';
VR_UT: sTmp := 'UT';
Else sTmp := IntToStr(LEADDicom1.CurrentVR.Code);
End;
sOut := sOut + 'Code: ' + sTmp + #13;
sOut := sOut + 'Name: ' + LEADDicom1.CurrentVR.Name + #13;
sOut := sOut + 'Length: ' + IntToStr(LEADDicom1.CurrentVR.Length) + #13;
nRestrict := LEADDicom1.CurrentVR.Restrict;
nRestrict := nRestrict And Not VR_BINARY;
nRestrict := nRestrict And Not VR_STRING;
nRestrict := nRestrict And Not VR_TEXT;
Case nRestrict of
VR_FIXED: sTmp := 'Fixed';
VR_MAXIMUM: sTmp := 'Maximum';
VR_MAXIMUM_GROUP: sTmp := 'Maximum Group';
VR_ANY: sTmp := 'Any Length';
VR_NOT_APPLICABLE: sTmp := 'Not Applicable';
VR_MAX: sTmp := 'Max';
Else sTmp := IntToStr(LEADDicom1.CurrentVR.Restrict);
End;
sOut := sOut + 'Restrict: ' + sTmp + #13;
sOut := sOut + 'UnitSize: ' + IntToStr(LEADDicom1.CurrentVR.UnitSize) + #13;
ShowMessage(sOut);
except
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
end;
end; { DisplayItem }
begin { MoveVR1Click }
LEADDicom1.MoveFirstVR();
DisplayItem('FirstVR');
LEADDicom1.MoveNextVR();
DisplayItem('NextVR');
LEADDicom1.MoveLastVR();
DisplayItem('LastVR');
LEADDicom1.MovePrevVR();
DisplayItem('PrevVR');
End;