function [corr_mask] = GIG_corr_with_mask(refe_mask, indi_mask, use_slice)

corr_mask = zeros(size(indi_mask,1),1);
refe_mask_vec = reshape(refe_mask(:,:,use_slice),[],1);
indi_mask_use = indi_mask(:,:,:,use_slice);

for s_sub = 1:size(indi_mask,1)
    temp_mask = squeeze(indi_mask_use(s_sub,:,:,:));
    corr_mask(s_sub) = corr(refe_mask_vec, reshape(temp_mask,[],1));
end