function prepareAndRender( handles )
%Prepare user input and render the image
%handles is from gui, so I can access sliders

imgs = getappdata(handles.loadLF, 'images');

%Havent loaded the images yet
if(isempty(imgs))
    disp('Images are empty...try loading LF first');
    return;
end

%camx and camy should start at 1, not 0
camx = get(handles.cameraX, 'Value')+1;
camy = get(handles.cameraY, 'Value')+1;
camz = get(handles.cameraZ, 'Value');
dispar = get(handles.focalDist, 'Value');
apature = get(handles.apature, 'Value');
%Get the final rendered image
image = render(imgs, camx, camy, camz, dispar, apature);
%Draw it in the panel
uip = handles.uipanel2;
myaxes = axes('parent', uip);
imagesc(image);
axis off;
drawnow;


end

