ImageEn, unit iexBitmaps

TIEMultiBitmap.GetTIEBitmap

TIEMultiBitmap.GetTIEBitmap


Declaration

function GetTIEBitmap(idx: Integer): TIEBitmap;


Description

Creates a TIEBitmap object from the image at index, idx.
You will need to call ReleaseBitmap to free the TIEBitmap object (and update the TImageEnMView if changes were made).

Note:
 If ParamsEnabled=True then the returned TIEBitmap will have Params.
 If sufficient memory cannot be allocated, result will be nil


Examples

// Save the fifth image to file
bmp := MBitmap.GetTIEBitmap( 4 );
bmp.Write( 'D:\alfa.png' );
MBitmap.ReleaseBitmap( 4, False );


// Create a multi-frame DICOM image from a source file list
procedure TForm1.CreateMultiDicom(sl: TStrings; SaveFilename: string);
var
  mbmp: TIEMultiBitmap;
  bmp : TIEBitmap;
  i: Integer;
begin
  mbmp := TIEMultiBitmap.Create;

  for i := 0 to sl.count-1 do
  begin
    bmp := TIEBitmap.Create();
    bmp.ParamsEnabled := True;
    bmp.Read(sl[i]);
    mbmp.AppendImage(bmp);
    bmp.Free;
  end;

  // Ensure all frames of DICOM are same size
  for i := 1 to mbmp.Count - 1 do
  begin
    bmp := mbmp.GetTIEBitmap( i );
    bmp.Resample( mbmp.ImageWidth[0], mbmp.ImageHeight[0], rfFastLinear );
    mbmp.ReleaseBitmap( i, True );
  end;

  // Ensure all frames of DICOM have same duplication and pixel format info
  mbmp.DuplicateCompressionInfo();

  mbmp.Write( SaveFilename, ioDICOM );
  mbmp.free;
end;