InsertBitmapValue Example for Delphi

Procedure TForm1.TestProcInsertBitmap();
var
   nRet: Integer;
   nCount: Integer;
   IO: LEADRasterIO;
   Process: LEADRasterProcess;
begin
   IO:= coLEADRasterIO.Create();
   Process:= coLEADRasterProcess.Create();

   LEADDicomDS1.EnableMethodErrors:= False;
   
   //move to the first image element and delete what//s there
   nRet:= LEADDicomDS1.FindFirstElement (TAG_PIXEL_DATA, False);
   nRet:= LEADDicomDS1.DeleteElement ();
   nRet:= LEADDicomDS1.InsertElement (False, TAG_PIXEL_DATA, VR_OB, False, 0);
    
   //load an image
   IO.Load(LEADRasterView1.Raster, 'd:\lead14\dist\images\image1.cmp', 0, 1, 1);
   ShowMessage('Image loaded from File - Wait');
    
   nCount:= LEADDicomDS1.GetBitmapCount ();
    
   //insert some images
   nRet:= LEADDicomDS1.InsertBitmapValue (LEADRasterView1.Raster.Bitmap, nCount, DICOM_IMAGE_COMPRESSION_NONE, DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0);

   if(nRet <> 0)then
   begin
      ShowMessage('Error');
      Exit;
   end;
   Process.Flip(LEADRasterView1.Raster);
   nRet:= LEADDicomDS1.InsertBitmapValue (LEADRasterView1.Raster.Bitmap, nCount + 1, DICOM_IMAGE_COMPRESSION_NONE, DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0);
   if(nRet <> 0)then
   begin
      ShowMessage('Error');
      Exit;
   end;
   Process.Reverse(LEADRasterView1.Raster);
   nRet:= LEADDicomDS1.InsertBitmapValue (LEADRasterView1.Raster.Bitmap, nCount + 2, DICOM_IMAGE_COMPRESSION_NONE, DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0);
   if(nRet <> 0)then
   begin
      ShowMessage('Error');
      Exit;
   end;

   ShowMessage('Images inserted - Wait');
end;