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: xASL_qc_temporalSNR.m
    path of file: ./repos/ExploreASL/Functions/QualityControl
    
    the code of the file until where you have to start completion: function tSNR = xASL_qc_temporalSNR(pathIm4D,pathImTissueProb)
% Computes temporal SNR QC parameters in different compartments based on the timeseries data and tissue-probability masks
%
% FORMAT: tSNR = xASL_qc_temporalSNR(pathIm4D,pathImTissueProb)
%
% INPUT:
%   pathIm4D         - path to the 4D timeseries volume (REQUIRED)
%   pathImTissueProb - path to the 3D volume containing the tissue probability map (REQUIRED)
%                    - GM and WM paths needs to be given in a cell array of two strings, or a 2xN string
%
% OUTPUT:
%   tSNR     - struct containing the temporal SNR parameters for different compartments
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% DESCRIPTION: This function computes several temporal SNR QC parameters as proposed in SPM Univariate Plus:
%            tSNR.tSNR_GM_Ratio      : mean GM signal / std GM over time 
%            tSNR.tSNR.tSNR_WM_Ratio : mean WM signal / std WM over time
%            tSNR.tSNR.tSNR_CSF_Ratio: mean CSF signal / std CSF over time
%            tSNR.tSNR_WMref_Ratio   : mean signal/std over time in eroded deep WM
%            tSNR.tSNR_GMWM_Ratio    : mean (GM+WM) signal / sqrt(std(GM+WM)^2+std(WMref)^2)
%            tSNR.tSNR_GMWM_WMref_Ratio: mean (GM+WM) signal / std WMref over time
%            tSNR.tSNR_Physio2Thermal_Ratio: sqrt((tSNR(GM+WM)/tSNR_GMWM_WMref_Ratio))^2-1)
%            tSNR.tSNR_Slope_Corr:
%
%            Differences to the SPM U+ suggestion: 
%
%            - eroded WM is used for estimating background noise
%            - Brainmask is determined in the same way as the structural anatQC,
%            - CSF is determined from the pGM&pWM maps;
%
% REFERENCES:
%              1. Thomas Liu (2016). Noise contributions to the fMRI signal: An overview NeuroImage, 343, 141-151
%                 http://dx.doi.org/10.1016/j.neuroimage.2016.09.008
%              2. Cesar Caballero-Gaudes and Richard C. Reynolds (2016). Methods For Cleaning The BOLD fMRI Signal. NeuroImage, 154,128-149
%              3. Lawrence Wald and Jonathan R Polimeni (2016). Impacting the effect of fMRI noise through 
%                 hardware and acquisition choices ??? Implications for controlling false positive rates. NeuroImage, 154,15-22
%              4. SPM Utility + toolbox. Cyril Pernet. https://osf.io/wn3h8/
%
% EXAMPLE: tSNR = xASL_qc_temporalSNR(x.P.Path_PWI4D,{x.P.Path_PVgm x.P.Path_PVwm});
% __________________________________

    
function tSNR = xASL_qc_temporalSNR(pathIm4D,pathImTissueProb)
% Computes temporal SNR QC parameters in different compartments based on the timeseries data and tissue-probability masks
%
% FORMAT: tSNR = xASL_qc_temporalSNR(pathIm4D,pathImTissueProb)
%
% INPUT:
%   pathIm4D         - path to the 4D timeseries volume (REQUIRED)
%   pathImTissueProb - path to the 3D volume containing the tissue probability map (REQUIRED)
%                    - GM and WM paths needs to be given in a cell array of two strings, or a 2xN string
%
% OUTPUT:
%   tSNR     - struct containing the temporal SNR parameters for different compartments
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% DESCRIPTION: This function computes several temporal SNR QC parameters as proposed in SPM Univariate Plus:
%            tSNR.tSNR_GM_Ratio      : mean GM signal / std GM over time 
%            tSNR.tSNR.tSNR_WM_Ratio : mean WM signal / std WM over time
%            tSNR.tSNR.tSNR_CSF_Ratio: mean CSF signal / std CSF over time
%            tSNR.tSNR_WMref_Ratio   : mean signal/std over time in eroded deep WM
%            tSNR.tSNR_GMWM_Ratio    : mean (GM+WM) signal / sqrt(std(GM+WM)^2+std(WMref)^2)
%            tSNR.tSNR_GMWM_WMref_Ratio: mean (GM+WM) signal / std WMref over time
%            tSNR.tSNR_Physio2Thermal_Ratio: sqrt((tSNR(GM+WM)/tSNR_GMWM_WMref_Ratio))^2-1)
%            tSNR.tSNR_Slope_Corr:
%
%            Differences to the SPM U+ suggestion: 
%
%            - eroded WM is used for estimating background noise
%            - Brainmask is determined in the same way as the structural anatQC,
%            - CSF is determined from the pGM&pWM maps;
%
% REFERENCES:
%              1. Thomas Liu (2016). Noise contributions to the fMRI signal: An overview NeuroImage, 343, 141-151
%                 http://dx.doi.org/10.1016/j.neuroimage.2016.09.008
%              2. Cesar Caballero-Gaudes and Richard C. Reynolds (2016). Methods For Cleaning The BOLD fMRI Signal. NeuroImage, 154,128-149
%              3. Lawrence Wald and Jonathan R Polimeni (2016). Impacting the effect of fMRI noise through 
%                 hardware and acquisition choices ??? Implications for controlling false positive rates. NeuroImage, 154,15-22
%              4. SPM Utility + toolbox. Cyril Pernet. https://osf.io/wn3h8/
%
% EXAMPLE: tSNR = xASL_qc_temporalSNR(x.P.Path_PWI4D,{x.P.Path_PVgm x.P.Path_PVwm});
% __________________________________
% Copyright (C) 2015-2019 ExploreASL

%% Input parameter admin

% Check if the input parameters are fine
if nargin ~= 2
	error('Need exactly two inputs.');
end