Setting the attributes and bitmaps for all overlays inside a DICOM dataset Example for Visual Basic
' This function will store the overlays associated
' with a bitmap handle inside the DICOM dataset
Dim OverlayAttributesDS As LEADOverlayAttributes
Dim OverlayAttributesRaster As LEADOverlayAttributes
Dim GroupNumber As Long
Dim IsOverlayInDataset As Boolean
Dim OverlayCount As Long
Dim OverlayIndex As Long
Dim iRet As Integer
Dim Process As New LEADRasterProcess
IsOverlayInDataset = False
GroupNumber = 0
OverlayIndex = 0
Process.EnableMethodErrors = False
' Do we have any overlays at all?
OverlayCount = Process.GetOverlayCount (LEADRasterView1.Raster, 0)
' If no overlays just exit sub
If (OverlayCount = 0) Then
MsgBox ("error")
Exit Sub
End If
' Blow away all the overlays in the file
For OverlayIndex = 0 To OverlayCount - 1
LEADDICOM1.DeleteOverlay OverlayIndex, 0
Next
Set OverlayAttributesDS = LEADDICOM1.OverlayAttributes
' Loop through the overlays and add them into the DICOM file
For OverlayIndex = 0 To OverlayCount - 1
' Get overlay attributes
iRet = Process.GetOverlayAttributes (LEADRasterView1.Raster, OverlayIndex, OVERLAYATTRIBUTES_ORIGIN Or OVERLAYATTRIBUTES_FLAGS Or OVERLAYATTRIBUTES_BITINDEX Or OVERLAYATTRIBUTES_DICOM)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If
Set OverlayAttributesRaster = Process.OverlayAttributes
OverlayAttributesDS.OriginX = OverlayAttributesRaster.OriginX
OverlayAttributesDS.OriginY = OverlayAttributesRaster.OriginY
OverlayAttributesDS.Flags = OverlayAttributesRaster.Flags
OverlayAttributesDS.Color = OverlayAttributesRaster.Color
OverlayAttributesDS.BitPosition = OverlayAttributesRaster.BitPosition
OverlayAttributesDS.Rows = OverlayAttributesRaster.Rows
OverlayAttributesDS.Columns = OverlayAttributesRaster.Columns
OverlayAttributesDS.Type = OverlayAttributesRaster.Type
OverlayAttributesDS.BitsAllocated = OverlayAttributesRaster.BitsAllocated
OverlayAttributesDS.Subtype = OverlayAttributesRaster.Subtype
OverlayAttributesDS.Label = OverlayAttributesRaster.Label
OverlayAttributesDS.ROIArea = OverlayAttributesRaster.ROIArea
OverlayAttributesDS.ROIMean = OverlayAttributesRaster.ROIMean
OverlayAttributesDS.ROIStandardDeviation = OverlayAttributesRaster.ROIStandardDeviation
OverlayAttributesDS.NumberFramesInOverlay = OverlayAttributesRaster.NumberFramesInOverlay
OverlayAttributesDS.ImageFrameOrigin = OverlayAttributesRaster.ImageFrameOrigin
OverlayAttributesDS.ActivationLayer = OverlayAttributesRaster.ActivationLayer
OverlayAttributesDS.Description = OverlayAttributesRaster.Description
' Set overlay attributes inside DICOM
iRet = LEADDICOM1.SetOverlayAttributes (OverlayIndex, 0)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If
' burn overlays which need to be part of the image
If (OverlayAttributesRaster.Flags And OVERLAY_USEBITPLANE) Then
iRet = Process.UpdateOverlayBits(LEADRasterView1.Raster(), OverlayIndex, SETOVERLAYBITS_FROMOVERLAY)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If
End If
' Get the overlay data (if it's not part of the image)
LEADRasterView2.Raster.Free
iRet = Process.GetOverlayBitmap (LEADRasterView1.Raster, OverlayIndex, LEADRasterView2.Raster, OVERLAY_COPY)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If
' Set overlay data into DICOM
LEADDICOM1.OverlayBitmap = LEADRasterView2.Raster.Bitmap
iRet = LEADDICOM1.SetOverlayBitmap (OverlayIndex, 0)
If (iRet <> 0) Then
MsgBox ("error")
Exit Sub
End If
Next