
par;
fprintf('\r%-40s\n','batch image normlizing ')    
for sb =1:PAR.nsubs % for each subject 
 
    str   = sprintf('sub #%3d/%3d: %-5s',sb,PAR.nsubs,PAR.subjects{sb} );
        fprintf('\r%-40s  %30s',str,' ')
        fprintf('%s%30s',repmat(sprintf('\b'),1,30),'...normaling')  %-#
    deffile=spm_select('FPList', PAR.structdir{sb}, ['^y_' PAR.structprefs '.*\.nii$' ] );
    P=[];
    for c=1:PAR.ncond
                  
          rbim_dir = fullfile(PAR.root,PAR.subjects{sb}, PAR.rbimdir);
            
          P=strvcat(P, spm_select('FPList', rbim_dir, sprintf('^%s_BEN_.*.nii',PAR.subjects{sb})));
%           P=strvcat(P, spm_select('FPList', PAR.condirs{sb,c}, ['^EPI_noskull.nii']));  
    
    end
    interp=4;
    opath='';
    res2mm=1;
   ASLtbx_normalize_nseg8(deffile, P, interp, res2mm, opath);
   fprintf('%s%30s',repmat(sprintf('\b'),1,30),'...done')  %-#
end