0001
0002
0003
0004
0005
0006
0007
0008 srcpath = '/afs/cmb.ucdavis.edu/share/petrlab/mrimasks/';
0009 destpath = srcpath;
0010 srcimg_fname = fullfile(srcpath,'xbrodmann.img');
0011
0012
0013 V = spm_vol(srcimg_fname);
0014 Y = spm_read_vols(V);
0015
0016
0017 unique_vals = unique(Y(:));
0018
0019 brodmann_areas = unique_vals(unique_vals > 0);
0020
0021 num_areas = length(brodmann_areas);
0022 for iarea = 1:num_areas
0023 curr_ba = brodmann_areas(iarea);
0024
0025 fprintf('Working on Brodmann Area %d\n', curr_ba);
0026
0027 Yout = zeros(size(Y));
0028
0029 Yout(Y==curr_ba) = 1;
0030
0031 Vout = V;
0032 Vout.fname = fullfile(destpath,sprintf('BA%d_mask.img', curr_ba));
0033 Vout.descrip = sprintf('BA%d mask based on Mricro Brodmann map', curr_ba);
0034
0035 fprintf('\tWriting file: %s\n', Vout.fname);
0036 Vout = spm_write_vol(Vout,Yout);
0037
0038 end
0039