SetBitmapValue Example for Delphi
Procedure TForm1.TestProcBitmap();
var
nRet: Integer;
begin
LEADDicomDS1.EnableMethodErrors:= False;
//move to the root element
LEADDicomDS1.MoveFirstElement (False);
LEADDicomDS1.MoveRootElement ();
//insert a new element for the Bitmap Value
nRet:= LEADDicomDS1.FindFirstElement (TAG_PIXEL_DATA, False);
if(nRet <> 0)then
begin
ShowMessage('Error');
Exit;
end;
nRet:= LEADDicomDS1.DeleteElement ();
if(nRet <> 0)then
begin
ShowMessage('Error');
Exit;
end;
nRet:= LEADDicomDS1.InsertElement (False, TAG_PIXEL_DATA, VR_OB, False, 0);
if(nRet <> 0)then
begin
ShowMessage('Error');
Exit;
end;
//load an image
LEADRasterIO1.Load(LEADRasterView1.Raster, 'd:\lead14\dist\images\image1.cmp', 0, 1, 1);
ShowMessage('Image loaded from File - Wait');
//insert the image into the element
LEADDicomDS1.Bitmap:= LEADRasterView1.Raster.Bitmap;
//set the bitmap
nRet:= LEADDicomDS1.SetBitmapValue (DICOM_IMAGE_COMPRESSION_NONE, DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0);
if(nRet <> 0)then
begin
ShowMessage('Error');
Exit;
end;
ShowMessage('Image set to Data Set - Wait');
LEADDicomDS1.Bitmap:= 0; //free the value
ShowMessage('Image cleared from memory - Wait');
//get the bitmap back
if(nRet = 0)then
begin
gbQuit:= False;
LEADDicomDS1.GetBitmapValue (0, 0, ORDER_RGB, 0);
LEADRasterView1.Raster.Bitmap:= LEADDicomDS1.Bitmap;
LEADRasterView1.ForceRepaint();
end;
LEADDicomDS1.EnableMethodErrors:= True;
ShowMessage('Image loaded from Data Set - Wait');
end;