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: GetRocCurve.m
    path of file: ./repos/ExploreASL/WorkInProgress/StatsAnalysis/StatTestCompare
    
    the code of the file until where you have to start completion: function [ StatCalc AUC  ] = GetRocCurve( x, GoldPos, FigureOut, FilterFile )
%GetRocCurve

    FilterFile          = xASL_io_ReadNifti( FilterFile );
    FilterFile          = FilterFile.dat(:,:,:);


    
function [ StatCalc AUC  ] = GetRocCurve( x, GoldPos, FigureOut, FilterFile )
%GetRocCurve

    FilterFile          = xASL_io_ReadNifti( FilterFile );
    FilterFile          = FilterFile.dat(:,:,:);

    meanGMmask          = fullfile( x.D.PopDir, 'DARTEL_T1_template.nii');
    meanGMmask          = nifti ( meanGMmask );
    meanGMmask          = single( meanGMmask.dat(:,:,:) );
    meanGMmask          = meanGMmask./max(meanGMmask(:));
    meanGMmask          = meanGMmask>0.5;

    tMin            = 0;   % minimal t-value (statistical threshold)
    tMax            = max(FilterFile(:));  % maximal t-value (statistical threshold)
    ROCRes          = 100;   % resolution, or nSteps
    StepSize        = (tMax - tMin) ./ ROCRes;

    StatCalc(:,1)   = [tMin:StepSize:tMax]';

    GoldPos         = GoldPos .* meanGMmask(:,:,:,1);

    for iStat       = 1:size(StatCalc(:,1))
        H           = FilterFile>StatCalc(iStat,1);
        [StatCalc(iStat,2) StatCalc(iStat,3)]   = CalcROC( GoldPos, H);
    end