SetBitmapValue example for Visual Basic
Private Sub TestProcBitmap()
Dim lCount As Long
Dim nRet As Integer
Dim IO As New LEADRasterIO
LEADDICOM1.EnableMethodErrors = False
'move to the root element
LEADDICOM1.MoveFirstElement False
LEADDICOM1.MoveRootElement
'insert a new element for the Bitmap Value
nRet = LEADDICOM1.FindFirstElement (TAG_PIXEL_DATA, False)
nRet = LEADDICOM1.DeleteElement()
nRet = LEADDICOM1.InsertElement (False, TAG_PIXEL_DATA, VR_OB, False, 0)
'load an image
IO.Load LEADRasterView1.Raster, "d:\lead14\dist\images\image1.cmp", 0, 1, 1
MsgBox "Image loaded from File - Wait"
'insert the image into the element
LEADDICOM1.Bitmap = LEADRasterView1.Raster.Bitmap
'set the bitmap
nRet = LEADDICOM1.SetBitmapValue (DICOM_IMAGE_COMPRESSION_NONE, DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0)
If (nRet <> 0) Then
MsgBox "Error"
Exit Sub
End If
MsgBox "Image set to Data Set - Wait"
LEADDICOM1.Bitmap = 0 'free the value
MsgBox "Image cleared from memory - Wait"
'get the bitmap back
If (nRet = 0) Then
gbQuit = False
LEADDICOM1.GetBitmapValue 0, 0, ORDER_RGB, 0
LEADRasterView1.Raster.Bitmap = LEADDICOM1.Bitmap
LEADRasterView1.ForceRepaint
End If
LEADDICOM1.EnableMethodErrors = True
MsgBox "Image loaded from Data Set - Wait"
End Sub