Dear Haibo, The first argument passed to spm_bwlabel must be numeric, real, full and double, as the error message says. If you specify a filename, you are actually passing a *string* to the function. Instead, you have to load your 3D array before calling the spm_bwlabel: BW = spm_read_vols(spm_vol('E:\luosisi\luosisi\individual-result\B3\I1-mask.img')); [L,NUM] = spm_bwlabel(BW,18); Note that it may still complain if BW is of a data type other than double. In this case, use: [L,NUM] = spm_bwlabel(double(BW),18); Kind regards, Anderson