Converting DICOM Annotation Objects to LEAD Annotation Objects Example for Delphi
Procedure TForm1.DicomAnnToLEADAnn(objPresStateDS: TLEADDicomDS);
var
objRasterAnn: LEADRasterAnnotation;
begin
objRasterAnn:= coLEADRasterAnnotation.Create();
// Describe a DICOM graphic annotation object and then convert it to
// a LEAD annotation object
with (objPresStateDS.GraphicObjectAttributes) do
begin
type_:= DICOM_GRAPHIC_OBJECT_TYPE_POLYLINE;
Filled:= False;
PointCount:= 5;
PointsX[0]:= 90.7;
PointsY[0]:= 156.9;
PointsX[1]:= 195.9;
PointsY[1]:= 156.9;
PointsX[2]:= 195.9;
PointsY[2]:= 342.5;
PointsX[3]:= 90.7;
PointsY[3]:= 342.5;
PointsX[4]:= 90.7;
PointsY[4]:= 156.9;
end;
if(objPresStateDS.ConvertDicomAnnObjToLEADAnnObj (True) = DICOM_SUCCESS)then
begin
ShowMessage('The DICOM graphic annotation object was converted successfully.');
// The handle to the resulted LEAD annotation object is available from the
// LEADAnnObject property. You can now use the functionality of a LEAD Raster
// Annotation object to manipulate the object.
// Once done from the object, don//t forget to destroy it
objRasterAnn.AnnDestroy(objPresStateDS.LEADAnnObject, 0);
end;
// Describe a DICOM text annotation object and then convert it to a
// LEAD annotation object
with (objPresStateDS.TextObjectAttributes) do
begin
BoundingBoxUsed:= True;
AnchorPointUsed:= False;
TextValue:= 'Text annotation';
BoundingBoxTLHCornerX:= 290.5;
BoundingBoxTLHCornerY:= 158.1;
BoundingBoxBRHCornerX:= 424.1;
BoundingBoxBRHCornerY:= 176.1;
BoundingBoxTextJustification:= DICOM_TEXT_JUSTIFICATION_LEFT;
end;
if(objPresStateDS.ConvertDicomAnnObjToLEADAnnObj (False) = DICOM_SUCCESS)then
begin
ShowMessage('The DICOM text annotation object was converted successfully.');
// The handle to the resulted LEAD annotation object is available from the
// LEADAnnObject property. You can now use the functionality of a LEAD Raster
// Annotation object to manipulate the object.
// Once done from the object, don//t forget to destroy it
objRasterAnn.AnnDestroy(objPresStateDS.LEADAnnObject, 0);
end;
end;