cnn_setenv;
mCNN.TemGroup = 'temlib_diff';

input = loadCNN('flow_input.bmp');
mCNN.INPUT1 = input;
init_state = zeros(size(input));
mCNN.STATE = 1.*init_state; %init_state;
mCNN.UseMask = 1;
mCNN.MASK = loadCNN('gates.bmp');
mCNN.Boundary = 2; % [-1 ... 1] --> const, 2 --> zeroflux, 3 --> periodic
mCNN.TimeStep = 0.1;
mCNN.IterNum = 5;
loadtem('FLOW');

% and plot the results:
figure;
subplot(1, 3, 1);
surf(input);
title('input', 'FontSize', 12, 'FontWeight', 'bold');
subplot(1, 3, 2);
surf(mCNN.MASK); %init_state);
title('Mask', 'FontSize', 12, 'FontWeight', 'bold');
subplot(1, 3, 3);
for ind = 1:500
    runtem; % run the simulator
    surf(mCNN.OUTPUT);
    set(gca, 'ZLim', [-1, 1]);
    drawnow
    title(['output i=', num2str(ind)], 'FontSize', 12, 'FontWeight', 'bold');
end

