InsertBitmapValue Example for VB.NET
'LEADDICOM1 is a DICOM Dataset defined outside this method
'This example uses the predefined variable "LEADRasterView1"
of type "AxLEADRasterView" from "LEADTOOLS Toolkit".
Private Sub TestInsertBitmapValue()
Dim lCount
As Integer
Dim nRet
As Short
Dim IO As
New LTRASTERIOLib.LEADRasterIO
Dim Process
As New LTRASTERPROCLib.LEADRasterProcess
LEADDICOM1.EnableMethodErrors = False
'move to the first image element and delete what's there
nRet = LEADDICOM1.FindFirstElement(LTDICLib.DicomDataSetTagConstants9.TAG_PIXEL_DATA, False)
nRet = LEADDICOM1.DeleteElement()
nRet = LEADDICOM1.InsertElement(False, LTDICLib.DicomDataSetTagConstants9.TAG_PIXEL_DATA, LTDICLib.DicomVRCodeConstants.VR_OB, False, 0)
'load an image
IO.Load(LEADRasterView1.Raster, "d:\lead14\dist\images\image1.cmp", 0, 1, 1)
MessageBox.Show("Image loaded from File - Wait")
lCount = LEADDICOM1.GetBitmapCount
'insert some images
nRet = LEADDICOM1.InsertBitmapValue(LEADRasterView1.Raster.Bitmap, lCount, LTDICLib.DicomImageCompressionConstants.DICOM_IMAGE_COMPRESSION_NONE, LTDICLib.DicomImagePhotometricConstants.DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0)
If (nRet <> 0) Then
MessageBox.Show("Error")
Exit Sub
End If
Process.Flip(LEADRasterView1.Raster)
nRet = LEADDICOM1.InsertBitmapValue(LEADRasterView1.Raster.Bitmap, lCount + 1, LTDICLib.DicomImageCompressionConstants.DICOM_IMAGE_COMPRESSION_NONE, LTDICLib.DicomImagePhotometricConstants.DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0) If (nRet <> 0) Then MessageBox.Show("Error") Exit Sub End If Process.Reverse(LEADRasterView1.Raster) nRet = LEADDICOM1.InsertBitmapValue(LEADRasterView1.Raster.Bitmap, lCount + 2, LTDICLib.DicomImageCompressionConstants.DICOM_IMAGE_COMPRESSION_NONE, LTDICLib.DicomImagePhotometricConstants.DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0) If (nRet <> 0) Then MessageBox.Show("Error") Exit Sub End If
MessageBox.Show("Images inserted - Wait")
End Sub