Converting DICOM Annotation Objects to LEAD Annotation Objects example for C++ 5.0 and later

void DicomAnnToLEADAnn(ILEADDicomDSPtr& spPresStateDS)
{
   ILEADRasterAnnotationPtr spRasterAnn(__uuidof(LEADRasterAnnotation));
   
   // Describe a DICOM graphic annotation object and then convert it to
   // a LEAD annotation object
   IDicomGraphicObjectAttributesPtr spGraphicObjAttribs;
   spGraphicObjAttribs = spPresStateDS->GraphicObjectAttributes;
   spGraphicObjAttribs->Type = DICOM_GRAPHIC_OBJECT_TYPE_POLYLINE;
   spGraphicObjAttribs->Filled = VARIANT_FALSE;
   spGraphicObjAttribs->PointCount = 5;
   spGraphicObjAttribs->PointsX [0] = float(90.7);
   spGraphicObjAttribs->PointsY [0] = float(156.9);
   spGraphicObjAttribs->PointsX [1] = float(195.9);
   spGraphicObjAttribs->PointsY [1] = float(156.9);
   spGraphicObjAttribs->PointsX [2] = float(195.9);
   spGraphicObjAttribs->PointsY [2] = float(342.5);
   spGraphicObjAttribs->PointsX [3] = float(90.7);
   spGraphicObjAttribs->PointsY [3] = float(342.5);
   spGraphicObjAttribs->PointsX [4] = float(90.7);
   spGraphicObjAttribs->PointsY [4] = float(156.9);
   if (spPresStateDS->ConvertDicomAnnObjToLEADAnnObj (VARIANT_TRUE) == DICOM_SUCCESS)
   {
      MessageBox(NULL, "The DICOM graphic annotation object was converted successfully.",
                 "Converting A DICOM Annotation Object", MB_OK);
      
      // 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
      spRasterAnn->AnnDestroy(spPresStateDS->LEADAnnObject, 0);
   }
   
   // Describe a DICOM text annotation object and then convert it to a
   // LEAD annotation object
   IDicomTextObjectAttributesPtr spTextObjAttribs;
   spTextObjAttribs = spPresStateDS->TextObjectAttributes;
   spTextObjAttribs->BoundingBoxUsed = VARIANT_TRUE;
   spTextObjAttribs->AnchorPointUsed = VARIANT_FALSE;
   spTextObjAttribs->TextValue = "Text annotation";
   spTextObjAttribs->BoundingBoxTLHCornerX = float(290.5);
   spTextObjAttribs->BoundingBoxTLHCornerY = float(158.1);
   spTextObjAttribs->BoundingBoxBRHCornerX= float(424.1);
   spTextObjAttribs->BoundingBoxBRHCornerY = float(176.1);
   spTextObjAttribs->BoundingBoxTextJustification = DICOM_TEXT_JUSTIFICATION_LEFT;
   if (spPresStateDS->ConvertDicomAnnObjToLEADAnnObj (VARIANT_FALSE) == DICOM_SUCCESS)
   {
      MessageBox(NULL, "The DICOM text annotation object was converted successfully.",
                 "Converting A DICOM Annotation Object", MB_OK);
      
      // 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
      spRasterAnn->AnnDestroy(spPresStateDS->LEADAnnObject, 0);
   }
}