J2KTargetFileSize example for Visual Basic

Private Sub TestProcBitmap()
LEADDICOM1.InitDS DICOM_CLASS_CR_IMAGE_STORAGE, DS_EXPLICIT_VR + _
DS_METAHEADER_ABSENT + DS_LITTLE_ENDIAN
'insert the image into the element
LEADDICOM1.Bitmap = LEADRasterView1.Raster.Bitmap
' Use the Compression ratio
LEADDICOM1.J2KOptions.J2KCompressionControl = DICOM_J2K_COMP_TARGETSIZE
LEADDICOM1.J2KOptions.J2KTargetFileSize = 15 * 1024
'set the bitmap
LEADDICOM1.SetBitmapValue DICOM_IMAGE_COMPRESSION_J2K_LOSSY, _
DICOM_IMAGE_PHOTOMETRIC_MONOCHROME2, 0, 0, 0
End Sub