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: threshold.m
    path of file: ./repos/CanlabCore/CanlabCore/@statistic_image
    
    the code of the file until where you have to start completion: function stats_image_obj = threshold(stats_image_obj, input_threshold, thresh_type, varargin)
% Threshold statistic_image object based on statistical threshold values.
%
% :Usage:
% ::
%
%    stats_image_obj = threshold(stats_image_obj, pvalthreshold or other thresh, thresh_type, ['k', extent_thresh OR other optional inputs])
%
% This is a method for an statistic_image object.
% Thresholding is reversible.
%
% For objects: Type methods(object_name) for a list of special commands
%              Type help object_name.method_name for help on specific
%              methods.
%
% ..
%     Author and copyright information:
%
%     Copyright (C) 2015 Tor Wager
%
%     This program is free software: you can redistribute it and/or modify
%     it under the terms of the GNU General Public License as published by
%     the Free Software Foundation, either version 3 of the License, or
%     (at your option) any later version.
%
%     This program is distributed in the hope that it will be useful,
%     but WITHOUT ANY WARRANTY; without even the implied warranty of
%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
    
function




function [n_vox_in_cluster, indic, cluster_indx_vals] = get_cluster_sizes(stats_image_obj)
%
%
% n_vox_in_cluster: Counts of voxels in each contiguous cluster indexed 1 to k, as indexed by stats_image_obj.volInfo.cluster
%                   If index values are missing, counts can be zero.
% 
% indic:            Voxels x index values logical matrix showing which voxels belong to which cluster
%
% cluster_indx_vals: Vector of integers with index values for clusters. May not be consecutive if some indices are missing (empty clusters)
 
% Count contiguous clusters
% ---------------------------------------------------------------
stats_image_obj = reparse_contiguous(stats_image_obj);            % clusters only for significant vox in .sig, or 0.
                                                                  % re-do because this may be called as a stand-alone function

cindx = stats_image_obj.volInfo.cluster;                          % contig cluster index, all in-mask, zero for not-.sig

[indic, cluster_indx_vals] = condf2indic(cindx, 'integers');      % omit 0, list of all integers for cluster IDs

indic(isnan(indic)) = 0;

indic = logical(indic);

n_vox_in_cluster = double(sum(indic));
% ---------------------------------------------------------------

end