Get image intensity histogram [hst, x] = vb_get_cortex_histogram(fname,fana) --- Input fname = brain mask file fana = analyze file --- Output hst : histogram of image intensity in brain region x : intensity list corresponding to hst 2007/06/15 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [hst, x] = vb_get_cortex_histogram(fname,fana,Nbin) 0002 % Get image intensity histogram 0003 % [hst, x] = vb_get_cortex_histogram(fname,fana) 0004 % --- Input 0005 % fname = brain mask file 0006 % fana = analyze file 0007 % --- Output 0008 % hst : histogram of image intensity in brain region 0009 % x : intensity list corresponding to hst 0010 % 0011 % 2007/06/15 Masa-aki Sato 0012 % 0013 % Copyright (C) 2011, ATR All Rights Reserved. 0014 % License : New BSD License(see VBMEG_LICENSE.txt) 0015 0016 %% Label value 0017 % 1 = brain (CSF) 0018 % 2 = Gray 0019 % 3 = White 0020 % 4 = Cerebellum 0021 % 5 = Brainstem 0022 0023 if ~exist('Nbin','var'), Nbin = 50; end; 0024 0025 load(fname, 'avw', 'XYZspm'); 0026 0027 B = avw.img; 0028 0029 % Index for background region other than gray & white 0030 ix = find( B(:)~=2 & B(:)~=3); 0031 0032 % Load subject MRI image 0033 [B, Vdim, Vsize] = vb_load_analyze_to_right(fana); 0034 0035 % Remove background 0036 B(ix) = 0; 0037 0038 % voxel larger than threshold 0039 ix = find( B(:) > 0 ); 0040 0041 B = B(ix); 0042 0043 [hst, x] = hist(B, Nbin);