J2KROIControl example for C#

//This example uses the predefined variable “LEADRasterView1” of type “AxLEADRasterView” from “LEADTOOLS Toolkit”.
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestJ2KROIControl()
{
   LEADRasterView1.Raster.CreateBitmap(100, 100, 24);
   LEADDICOM1.InitDS((int)LTDICLib.DicomClassConstants.DICOM_CLASS_CR_IMAGE_STORAGE, (short)LTDICLib.DicomDataSetFlags.DS_EXPLICIT_VR + (short)LTDICLib.DicomDataSetFlags.DS_METAHEADER_ABSENT + (short)LTDICLib.DicomDataSetFlags.DS_LITTLE_ENDIAN);
   //insert the image into the element
   LEADDICOM1.Bitmap = LEADRasterView1.Raster.Bitmap;
   LEADDICOM1.J2KOptions().J2KSetDefaults();
   LEADDICOM1.J2KOptions().J2KCompressionControl = LTDICLib.DicomJ2KCompressionControl.DICOM_J2K_COMP_RATIO;
   LEADDICOM1.J2KOptions().J2KCompressionRatio = 100.0F;
   LEADDICOM1.J2KOptions().J2KUseROI = true;
   LEADDICOM1.J2KOptions().J2KROIControl =    LTDICLib.J2KRegionOfInterest.J2K_USEOPTION_RECT;
   LEADDICOM1.J2KOptions().J2KROILeft = 200;
   LEADDICOM1.J2KOptions().J2KROITop = 200;
   LEADDICOM1.J2KOptions().J2KROIWidth = 400;
   LEADDICOM1.J2KOptions().J2KROIHeight = 400;
   LEADDICOM1.J2KOptions().J2KXTsiz = 100;
   LEADDICOM1.J2KOptions().J2KYTsiz = 100;
   //set the bitmap
   LEADDICOM1.SetBitmapValue((int)LTDICLib.DicomImageCompressionConstants.DICOM_IMAGE_COMPRESSION_J2K_LOSSY, (int)LTDICLib.DicomImagePhotometricConstants.DICOM_IMAGE_PHOTOMETRIC_MONOCHROME2, 0, 0, 0);
}