SetBitmapValue Example for Delphi
var
nRet: Integer;
begin
LEADDicom1.EnableMethodErrors := false;
{ move to the root element }
LEADDicom1.MoveFirstElement(false);
LEADDicom1.MoveRootElement();
{ insert a new element for the Bitmap Value }
LEADDicom1.FindFirstElement(TAG_PIXEL_DATA, false);
LEADDicom1.DeleteElement();
LEADDicom1.InsertElement(false, TAG_PIXEL_DATA, VR_OB, false, 0);
{ load an image }
LEADImage1.Load ('c:\lead\images\image1.cmp', 0, 1, 1);
ShowMessage('Image loaded from File - Wait');
{ insert the image into the element }
LEADDicom1.Bitmap := LEADImage1.Bitmap;
{ set the bitmap }
nRet := LEADDicom1.SetBitmapValue(DICOM_IMAGE_COMPRESSION_NONE, DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0);
If nRet <> SUCCESS Then
begin
ShowMessage('Error Number: ' + IntToStr(LEADDicom1.Error));
exit;
end;
ShowMessage('Image set to Data Set - Wait');
LEADDicom1.Bitmap := 0; { free the value }
ShowMessage('Image cleared from memory - Wait');
{ get the bitmap back }
If nRet = SUCCESS Then
begin
LEADDicom1.GetBitmapValue(0, 0, ORDER_RGB);
LEADImage1.Bitmap := LEADDicom1.Bitmap;
LEADImage1.ForceRepaint;
End;
LEADDicom1.EnableMethodErrors := true;
ShowMessage('Image loaded from Data Set - Wait');
End;