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: canlab_qc_metrics1.m
    path of file: ./repos/CanlabCore/CanlabCore/diagnostics
    
    the code of the file until where you have to start completion: function [QC, dat] = canlab_qc_metrics1(epi_names, mask_name, varargin)
% Calculate quality control metrics on a 4-D EPI Analyze or Nifti file
%
% Standard CANlab usage is to enter 
    
function




function [rms_asymmetry, hemispheric_asymmetry] = calculate_asymmetry(dat, snr)

xyz = round(voxel2mm(dat.volInfo.xyzlist', dat.volInfo.mat)');
isleft = xyz(:, 1) < 0;
isright = xyz(:, 1) > 0;
xyz(:, 1) = abs(xyz(:, 1));
[u1, indx1] = unique(xyz, 'first', 'rows');
[u2, indx2] = unique(xyz, 'last', 'rows');

if any(any(u1 - u2)), disp('Bug in asymmetry algorithm'); end