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_TanimotoCoeff.m
    path of file: ./repos/ExploreASL/Functions/QualityControl
    
    the code of the file until where you have to start completion: function TC = xASL_qc_TanimotoCoeff(Image1, Image2, imMask, type, bClip, bSmooth)
%xASL_qc_TanimotoCoeff Calculates the Tanimoto similarity coefficient for a binary/fuzzy set/continuous images.
% FORMAT: TC = xASL_qc_TanimotoCoeff(Image1, Image2[, imMask, type])
%
% INPUT:
%   Image1 - First input image, can also be a path
%   Image2 - Second input image, can also be a path
%   imMask - Mask over which the similarity is calculated (DEFAULT all)
%   type   - 1 binary input image
%            2 fuzzy set input (values in [0,1])
%            3 continuous TC with any real values
%            DEFAULT 1/2/3 - based on the data
%   bClip  - specifies whether we clip the images below 0 and
%            above a specified threshold (OPTIONAL, DEFAULT = no clipping)
%            Any non-zero bClip value will clip below 0. When bClip is
%            provided as percentile (e.g. bClip==0.975), so between 0 and
%            1, it will be used to clip peak values. And the images will be
%            scaled as well.

    
function TC = xASL_qc_TanimotoCoeff(Image1, Image2, imMask, type, bClip, bSmooth)
%xASL_qc_TanimotoCoeff Calculates the Tanimoto similarity coefficient for a binary/fuzzy set/continuous images.
% FORMAT: TC = xASL_qc_TanimotoCoeff(Image1, Image2[, imMask, type])
%
% INPUT:
%   Image1 - First input image, can also be a path
%   Image2 - Second input image, can also be a path
%   imMask - Mask over which the similarity is calculated (DEFAULT all)
%   type   - 1 binary input image
%            2 fuzzy set input (values in [0,1])
%            3 continuous TC with any real values
%            DEFAULT 1/2/3 - based on the data
%   bClip  - specifies whether we clip the images below 0 and
%            above a specified threshold (OPTIONAL, DEFAULT = no clipping)
%            Any non-zero bClip value will clip below 0. When bClip is
%            provided as percentile (e.g. bClip==0.975), so between 0 and
%            1, it will be used to clip peak values. And the images will be
%            scaled as well.
%            So for e.g. bClip==1, there will be clipped below 0 but not at
%            the peak values.
%   bSmooth - specifies how to smooth images with an isotropic kernel.
%             A single FWHM kernel value needs to be specified for each image in voxels, e.g. [4 4] would smooth both images with [4 4 4]
%             but [3 0] would only smooth the first image with a [3 3 3] kernel. (OPTIONAL, DEFAULT = [0 0],
%             which is no smoothing
%             Note that these are FWHM in voxels, not in mm!
%
% OUTPUT:
%   TC - Tanimoto similarity coefficient
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% DESCRIPTION: Compares images Image1 and Image2 within the mask imMask. TYPE specifies the input data type.
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% RATIONALE:   Note that the Tanimoto Coefficient is a measure of image
%              overlap/intersection, similar to the Dice coefficient. With
%              the option type 3, this is a fuzzy coefficient, which
%              doesn't require to convert the two images to a binary mask.
%              The TC can be interpreted as a stringent Kappa, ranging from
%              0 (completely dissimilar) to 100% (identical images).
%              Assuming that perfect registration should not lead to
%              identical images but still retain physiological differences,
%              TC>70% can be regarded as excellent image agreement. The TC
%              will be overestimated when smoothing, but this may lead to more stable artifact detection.
%
% GENERAL EXAMPLE: TC = xASL_qc_TanimotoCoeff([0,1],[0,0],[1,1],1);
% ExploreQC EXAMPLE: TC = xASL_qc_TanimotoCoeff(CBFpath, TemplatePath, x.S.masks.WBmask, 3, 0.975, [4 0]);
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% REFERENCES:
%    Tanimoto, Taffee T. (17 Nov 1958). "An Elementary Mathematical theory of Classification and Prediction".
%        Internal IBM Technical Report. 1957
%
%    W. R. Crum, O. Camara and D. L. G. Hill, "Generalized Overlap Measures for Evaluation and Validation in
%        Medical Image Analysis," in IEEE Transactions on Medical Imaging, vol. 25, no. 11, pp. 1451-1461, Nov. 2006.
%    David C. Anastasiu, George Karypis, "Efficient identification of Tanimoto nearest neighbors",
%        International Journal of Data Science and Analytics, 2017.
% __________________________________
% Copyright 2015-2020 ExploreASL


    %% Administration
    if nargin<6 || isempty(bSmooth)
        bSmooth = [0 0];
    end