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: get_mask_vol.m
    path of file: ./repos/CanlabCore/CanlabCore/Image_computation_tools
    
    the code of the file until where you have to start completion: function mask = get_mask_vol(Pf,Pm)
% Returns 3-D volume of binary mask values,
% in the space of the functional image Pf.
%
% :Usage:
% ::
%
%     function mask = get_mask_vol(Pf,Pm)
%
% :Inputs:

    
function mask = get_mask_vol(Pf,Pm)
% Returns 3-D volume of binary mask values,
% in the space of the functional image Pf.
%
% :Usage:
% ::
%
%     function mask = get_mask_vol(Pf,Pm)
%
% :Inputs:
%
%   **Pf:**
%        filename of functional image
%
%   **Pm:**
%        filename of mask image (should be 1's and 0's)
%
% ..
%    Tor Wager
% ..

    Vm = spm_vol(Pm);
    Vf = spm_vol(Pf);
    if diag(Vm.mat(1:3,1:3)) ~= diag(Vf.mat(1:3,1:3))   % unequal voxel sizes
        disp('Reslicing mask image to dims of functional img')
        P = reslice_imgs(Pf,Pm,0);
        [d f e] = fileparts(Pm);
        Pm = fullfile(d,['r' f e]);
        Vm = spm_vol(Pm);
    end