Program optimization

profiled Main.m, biggest hoggers are
BNS_LoadImageFrame
imaqdevice.getsnapshot
FocusEff
sped up BNS_LoadImageFrame
rate-limiting method is handles.slm_lut
When the LUT is linear.LUT, this step does no more than convert the data
type of ImageMatrix from double to uint8.
commented out the above method. and used unit8(ImageMatrix) to force
conversion.
forced ImageMatrix to be uint8 in Mosaic.m to speed up even more
sped up imaqdevice.getsnapshot
This function is slow. See the following post
http://www.mathworks.com/matlabcentral/newsreader/view_thread/129705
changed to

set(vidobj, 'FramesPerTrigger', 1);
set(vidobj, 'TriggerRepeat', Inf);
triggerconfig(vidobj, 'manual');
start(vidobj);
for
trigger(vidobj);
snapshot = getdata(vidobj);
end
sped up FocusEff