function varargout = pm_ff_unwrap(varargin) % Performs phase-unwrapping along the shore of a flood-fill % progressing from some seed in a low-variance area towards % higher variance areas. % FORMAT [pm,wm] = pm_ff_unwrap(pm,vm,wm,mask,thres) % % Input: % pm : 2 or 3D phasemap where some voxels have been unwrapped % and some not. % vm : Variance map, indicating the variance of the phase estimate. % wm : Wrap-map, where a non-zero value indicates corresponding % phase-value in pm has been unwrapped. % mask : Mask that indicates which voxels are worth % bothering with and which are not. % thres : Array of thresholds such that unwrapping proceeds by % serial dilates from some seed point in wm until all % connected voxels with vm