InsertBitmapValue 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 TestInsertBitmapValue ( )
{
   int lCount = 0;
   short nRet = 0;
   LTRASTERIOLib.LEADRasterIO IO = new LTRASTERIOLib.LEADRasterIO();
   LTRASTERPROCLib.LEADRasterProcess Process = new LTRASTERPROCLib.LEADRasterProcess();
   LEADDICOM1.EnableMethodErrors = false;
   //move to the first image element and delete what's there
   nRet = LEADDICOM1.FindFirstElement((int)LTDICLib.DicomDataSetTagConstants9.TAG_PIXEL_DATA, false);
   nRet = LEADDICOM1.DeleteElement();
   nRet = LEADDICOM1.InsertElement(false, (int)LTDICLib.DicomDataSetTagConstants9.TAG_PIXEL_DATA, (short)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, (int)LTDICLib.DicomImageCompressionConstants.DICOM_IMAGE_COMPRESSION_NONE, (int)LTDICLib.DicomImagePhotometricConstants.DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0);
   if (nRet != 0)
   {
      MessageBox.Show("Error");
      return;
   }
   Process.Flip(LEADRasterView1.Raster);
   nRet = LEADDICOM1.InsertBitmapValue(LEADRasterView1.Raster.Bitmap, lCount + 1, (int)LTDICLib.DicomImageCompressionConstants.DICOM_IMAGE_COMPRESSION_NONE, (int)LTDICLib.DicomImagePhotometricConstants.DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0);
   if (nRet != 0)
   {
      MessageBox.Show("Error");
      return;
   }
   Process.Reverse(LEADRasterView1.Raster);
   nRet = LEADDICOM1.InsertBitmapValue(LEADRasterView1.Raster.Bitmap, lCount + 2, (int)LTDICLib.DicomImageCompressionConstants.DICOM_IMAGE_COMPRESSION_NONE, (int)LTDICLib.DicomImagePhotometricConstants.DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0);
   if (nRet != 0)
   {
      MessageBox.Show("Error");
      return;
   }
   MessageBox.Show("Images inserted - Wait");
}