function [videoscale] = convertUint16(video) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Converts a video to uint16 by linearly scaling the values to lie within %the uint16 range % Inputs: % - video: MxNxT matrix of the video % Output: % - videoscale: an MxNxT matrix of the video scaled to a uin16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [d1 d2 d3] = size(video); minvid = min(video(:)); maxvid = max(video(:)); for fn = 1:d3 videoscale(:, :, fn) = uint16(floor(((video(:, :, fn)-minvid)./(maxvid-minvid))*2^16-1)); end end