Converting DICOM Annotation Objects to LEAD Annotation Objects Example for VB.NET

Private Sub DicomAnnToLEADAnn(ByRef objPresStateDS As LTDICLib.LEADDicomDS)
   Dim objRasterAnn As New LTANNLib.LEADRasterAnnotation
   ' Describe a DICOM graphic annotation object and then convert it to
   ' a LEAD annotation object
   With objPresStateDS.GraphicObjectAttributes
      .Type = LTDICLib.DicomGraphicObjectTypes.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 With
   If objPresStateDS.ConvertDicomAnnObjToLEADAnnObj(True) = LTDicomKernelLib.DicomErrorCodes.DICOM_SUCCESS Then
      MessageBox.Show("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 If

   ' Describe a DICOM text annotation object and then convert it to a
   ' LEAD annotation object
   With objPresStateDS.TextObjectAttributes
      .BoundingBoxUsed = True
      .AnchorPointUsed = False
      .TextValue = "Text annotation"
      .BoundingBoxTLHCornerX = 290.5
      .BoundingBoxTLHCornerY = 158.1
      .BoundingBoxBRHCornerX = 424.1
      .BoundingBoxBRHCornerY = 176.1
      .BoundingBoxTextJustification = LTDICLib.DicomTextJustificationTypes.DICOM_TEXT_JUSTIFICATION_LEFT
   End With
   If objPresStateDS.ConvertDicomAnnObjToLEADAnnObj(False) = LTDicomKernelLib.DicomErrorCodes.DICOM_SUCCESS Then
      MessageBox.Show("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 If
End Sub