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, 0, 0, 'Sum',
'sum of the following layers: '+IntList(ll,'; '));
end;
end.
|