You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: CBIG_DilateMask.m
    path of file: ./repos/CBIG/utilities/matlab/vol
    
    the code of the file until where you have to start completion: function CBIG_DilateMask(input_file, output_file, dist, exit_flag)

% Dilate a binary mask.
%
%     CBIG_DilateMask(input_file, output_file, dist, exit_flag)
%     Input:
%         input_file    : input binary mask
%         output_file   : output file name
%         dist          : threshold for Euclidean distance after bwdist
%         exit_flag     : 1-exit; 0-not exit
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md


if(nargin < 4)

    
function CBIG_DilateMask(input_file, output_file, dist, exit_flag)

% Dilate a binary mask.
%
%     CBIG_DilateMask(input_file, output_file, dist, exit_flag)
%     Input:
%         input_file    : input binary mask
%         output_file   : output file name
%         dist          : threshold for Euclidean distance after bwdist
%         exit_flag     : 1-exit; 0-not exit
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md


if(nargin < 4)
   exit_flag = 0; 
end

if(ischar(dist))
   dist = str2num(dist); 
end