function processMetrics(this)
%

%   Copyright 2018 The MathWorks, Inc.

    % Loop through each possible metric
    sourceMetricData = this.metrics;
    [metricNames, toMetricNames] = getEnabledMetricNames(this);
    deleteIdx = contains(metricNames, {'sigrange', 'sigsize'});
    metricNames(deleteIdx == 1) = [];
    rootId = this.rootID;
    for metricI = metricNames(:)'
        metricName = metricI{1};
        metricData  = sourceMetricData.(metricName);
        if ~isempty(metricData) 
                metricEnumVal = cvi.MetricRegistry.getEnum(metricName);     
                metricData = cv('ProcessData', rootId, metricEnumVal, metricData);
        end
        metricStruct.(metricName) = metricData;
    end
    if ~isempty(toMetricNames)
        tmpMtricStruct = [];
        for metricI = toMetricNames(:)'
            metricName = metricI{1};
            metricData = sourceMetricData.testobjectives.(metricName);
            if ~isempty(metricData)
                metricenumValue = cvi.MetricRegistry.getEnum(metricName);    
                metricdataId = cv('new', 'metricdata', '.metricName', metricName, '.metricenumValue',metricenumValue);
                cv('set',metricdataId ,'.data.rawdata', metricData,'.size', numel(metricData)); 
                metricData = cv('ProcessTOData', rootId, metricdataId);
                cv('delete',metricdataId ); 
            end
            tmpMtricStruct.(metricName) = metricData;
        end
        metricStruct.testobjectives = tmpMtricStruct;
    end
    setMetricData(this, metricStruct);
end
