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: spm_bias_estimate.m
    path of file: ./repos/fieldtrip/external/spm8
    
    the code of the file until where you have to start completion: function T = spm_bias_estimate(V,flags)
% Estimate image nonuniformity.
%
% FORMAT T = spm_bias_estimate(V,flags)
%   V     - filename or vol struct of image
%   flags - a structure containing the following fields
%     nbins  - number
    
function [T,IC0] = get_priors(VF,nbas,reg,o)
% Set up a priori covariance matrix
vx    = sqrt(sum(VF(1).mat(1:3,1:3).^2));
kx    = (((1:nbas(1))'-1)*pi/vx(1)/VF(1).dim(1)*10).^2;
ky    = (((1:nbas(2))'-1)*pi/vx(2)/VF(1).dim(2)*10).^2;
kz    = (((1:nbas(3))'-1)*pi/vx(3)/VF(1).dim(3)*10).^2;

switch o,
case 0, % Cost function based on sum of squares
IC0 =    kron(kz.^0,kron(ky.^0,kx.^0))*reg;

case 1, % Cost function based on sum of squared 1st derivatives
IC0 = (  kron(kz.^1,kron(ky.^0,kx.^0)) +...
         kron(kz.^0,kron(ky.^1,kx.^0)) +...
         kron(kz.^0,kron(ky.^0,kx.^1)) )*reg;

case 2, % Cost function based on sum of squared 2nd derivatives
IC0 = (1*kron(kz.^2,kron(ky.^0,kx.^0)) +...
       1*kron(kz.^0,kron(ky.^2,kx.^0)) +...
       1*kron(kz.^0,kron(ky.^0,kx.^2)) +...
       2*kron(kz.^1,kron(ky.^1,kx.^0)) +...
       2*kron(kz.^1,kron(ky.^0,kx.^1)) +...
       2*kron(kz.^0,kron(ky.^1,kx.^1)) )*reg;

case 3, % Cost function based on sum of squared 3rd derivatives
IC0 = (1*kron(kz.^3,kron(ky.^0,kx.^0)) +...
       1*kron(kz.^0,kron(ky.^3,kx.^0)) +...
       1*kron(kz.^0,kron(ky.^0,kx.^3)) +...
       3*kron(kz.^2,kron(ky.^1,kx.^0)) +...
       3*kron(kz.^2,kron(ky.^0,kx.^1)) +...
       3*kron(kz.^1,kron(ky.^2,kx.^0)) +...
       3*kron(kz.^0,kron(ky.^2,kx.^1)) +...
       3*kron(kz.^1,kron(ky.^0,kx.^2)) +...
       3*kron(kz.^0,kron(ky.^1,kx.^2)) +...
       6*kron(kz.^1,kron(ky.^1,kx.^1)) )*reg;

case 4, % Cost function based on sum of squares of 4th derivatives
IC0 =  (1*kron(kz.^4,kron(ky.^0,kx.^0)) +...
        1*kron(kz.^0,kron(ky.^4,kx.^0)) +...
        1*kron(kz.^0,kron(ky.^0,kx.^4)) +...
        4*kron(kz.^3,kron(ky.^1,kx.^0)) +...
        4*kron(kz.^3,kron(ky.^0,kx.^1)) +...
        4*kron(kz.^1,kron(ky.^3,kx.^0)) +...
        4*kron(kz.^0,kron(ky.^3,kx.^1)) +...
        4*kron(kz.^1,kron(ky.^0,kx.^3)) +...
        4*kron(kz.^0,kron(ky.^1,kx.^3)) +...
        6*kron(kz.^2,kron(ky.^2,kx.^0)) +...
        6*kron(kz.^2,kron(ky.^0,kx.^2)) +...
        6*kron(kz.^0,kron(ky.^2,kx.^2)) +...
       12*kron(kz.^2,kron(ky.^1,kx.^1)) +...
       12*kron(kz.^1,kron(ky.^2,kx.^1)) +...
       12*kron(kz.^1,kron(ky.^1,kx.^2)) )*reg;
otherwise,
error('Unknown regularisation form');
end