%% distmex - compute the patch distance using nnmex
%
%% Input
%   img       the generated image
%   exemplar  the texture exemplar we map to
%   nnf       the nearest neighbor field
%   options   the diverse parameters to use
%
%% Output
%   dist      the patch distance image
%
function [ dist ] = distmex( img, exemplar, nnf, options )
    if nargin < 4
        options.patch_size = 10;
        options.boundaries = 'same';
    elseif ~isstruct(options)
        patch_size = options;
        options = struct('patch_size', patch_size);
    end
    % no iteration! we just want the distance!
    options.iterations = 0;
    % get the distance
    [ ~, dist ] = nnmex(img, exemplar, options, nnf);
end

