AddImgToRepository

Declaration: AddImgToRepository(Data: TDouble2DArray; Caption, Subcaption: string): integer;
Adds the data in the array Data to the special images of the 2D Imager. The size of the matrix Data has to be the same as the lateral size of the data cube. The parameter Caption specifies the caption of the selection tab. It must not be longer than 15 characters. The parameter Subcaption is displayed above the image and is not restricted in length. The function returns an access handle to the special image (1 to 16), or a negative number in the case of an error:
-1 ... the maximum number of special images (16) has been reached
-2 ... the size of the Data array does not match the data cube
Please note that the access handle can be used to adjust image parameters (colors, zoom, display mode etc.) later on.

Sample program: The following code lets you select a few layers, then calculates the sum of the selected layers and visualizes the resulting matrix as a special image in the 2D Imager:

program LayerSum;

var
  imgmat    : TDouble2DArray;
  i         : integer;
  ll        : TIntArray;
  Weights   : TDoubleArray;

begin
SetLength(ll,0);
if SelectLayer (1,true,true,ll,'Please select the layers to be added up') > 0 then
  begin
  SetLength(Weights, length(ll));
  for i:=1 to length(ll) do
    Weights[i-1] := 1;
  WeightedSumOfLayers (ll, Weights, 1, imgmat);
  AddImgToRepository(imgmat, 'Sum',
        'sum of the following layers: '+IntList(ll,'; '));
  end;
end.


Last Update: 2017-Jun-20