J2KCompressionRatio 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 TestJ2KCompressionRatio() 
   LEADRasterView1.Raster.CreateBitmap(100, 100, 24)
LEADDICOM1.InitDS(LTDICLib.DicomClassConstants.DICOM_CLASS_CR_IMAGE_STORAGE, LTDICLib.DicomDataSetFlags.DS_EXPLICIT_VR + LTDICLib.DicomDataSetFlags.DS_METAHEADER_ABSENT + LTDICLib.DicomDataSetFlags.DS_LITTLE_ENDIAN)
   'insert the image into the element 
   LEADDICOM1.Bitmap = LEADRasterView1.Raster.Bitmap
   ' Use the Compression ratio 
   LEADDICOM1.J2KOptions.J2KCompressionControl  = LTDICLib.DicomJ2KCompressionControl.DICOM_J2K_COMP_RATIO 
   LEADDICOM1.J2KOptions.J2KCompressionRatio = 50.0# 
   'set the bitmap 
   LEADDICOM1.SetBitmapValue(LTDICLib.DicomImageCompressionConstants.DICOM_IMAGE_COMPRESSION_J2K_LOSSY, LTDICLib.DicomImagePhotometricConstants.DICOM_IMAGE_PHOTOMETRIC_MONOCHROME2, 0, 0, 0) 
End Sub