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: CBIG_ComputeConnectedComponentsFromSurface.m
    path of file: ./repos/CBIG/utilities/matlab/parcellation
    
    the code of the file until where you have to start completion: function [ci, sizes, label_id] = CBIG_ComputeConnectedComponentsFromSurface(avg_mesh, labels)

% Given average mesh and labels, compute connected components.
% 
%   [ci, sizes, label_id] = CBIG_ComputeConnectedComponentsFromSurface(avg_mesh, labels)
%   Input:
%       avg_mesh    : average surface mesh read from CBIG_ReadNCAvgMesh.m
%       OR CBIG_read_fslr_surface.m
%       labels      : parcellation surface labels
%   Output:
%       ci          : an array of cell of length k, each cell specifies the
%       indices of each connected component
%       sizes       : an array of cell of length k; each cell specifies the sizes of each connected component
%       label_id    : a vector of length k; all unique indices of input labels 

    
function [ci, sizes, label_id] = CBIG_ComputeConnectedComponentsFromSurface(avg_mesh, labels)

% Given average mesh and labels, compute connected components.
% 
%   [ci, sizes, label_id] = CBIG_ComputeConnectedComponentsFromSurface(avg_mesh, labels)
%   Input:
%       avg_mesh    : average surface mesh read from CBIG_ReadNCAvgMesh.m
%       OR CBIG_read_fslr_surface.m
%       labels      : parcellation surface labels
%   Output:
%       ci          : an array of cell of length k, each cell specifies the
%       indices of each connected component
%       sizes       : an array of cell of length k; each cell specifies the sizes of each connected component
%       label_id    : a vector of length k; all unique indices of input labels 
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md


% To iterate through all the components of the parcellation:
%
% for ii = 1:length(label_id)
%   i = label_id(ii);
%   label_vertices = find(labels == i);
%   for j = 1:length(sizes{ii})
%       component_vertices = label_vertices(ci{ii} == j);       
%   end