function buttoncomputesliceRAY(hObject, eventdata, parentfig, Empty_Button, Buttons, AxesAFS, AxesPLA, AxesSOL, Polysettings, roton, roton2, rotoff, Footnote, lcs, calcp)

data = get(Empty_Button,'UserData');

set(roton, 'Value', 0);
set(roton2, 'Value', 0);
set(rotoff, 'Value', 1);

MaxLang = getsetvar(Polysettings(3), 3, 50000, 1, 0);
MaxFunC = getsetvar(Polysettings(5), 30, 200000, 1, 0);
epsFun = 1.e-10;
epsRand = getsetvar(Polysettings(2), 1.E-8, 1.E-1, 0, 1);

mimi = max(1.E-2, 2*data.miminmf);
noiseC = -getsetvar(Polysettings(1), data.miminmf, mimi, 0, 0);
noiseA = noiseC;

PLA = [data.plane.x;
       data.plane.y;
       data.plane.z;
       data.plane.d];

[slice, GenInfo,tim] = computeSliceRAY(MaxLang, MaxFunC, epsFun, epsRand, noiseC, noiseA, data.s, data.U, data.S, data.V, PLA, data.InitT, data.plane.d2.pointsOUT, data.plane.d2.pointsINN, calcp);

if GenInfo == -3
    fprintf('computation canceled.\n');
    set(Footnote,'String','Slice computation canceled.','ForegroundColor','red');
    return;
end

fprintf('computing time: %2.2f s\n',tim);

if data.s == 3 && GenInfo(1,1) == -2
    set(Footnote,'String',['Warning: Maximal number of funcalls (',num2str(calls) ,') reached.'],'ForegroundColor','red');
    return;
end

if(data.s == 2 && GenInfo(1,1) <= 0)
    set(Footnote,'String',['Warning: Slice not computed.'],'ForegroundColor','red');
    return;
end

data.issliced = 1;
data.slice = slice;

set(Empty_Button,'UserData',data);

afsvw = get(AxesAFS, 'view');
plavw = get(AxesPLA, 'view');

plotafsRAY(parentfig, data, AxesAFS, AxesSOL, AxesPLA, lcs);

set(AxesAFS, 'view', afsvw);
set(AxesPLA, 'view', plavw);

set(Footnote,'String',['Slice computation time:  ',num2str(tim),' s.'],'ForegroundColor','black');
