0001
0002
0003
0004
0005
0006
0007 plot_types = {'group_stats', ...
0008 'indiv_stats', ...
0009 'group_contrast_contour' ...
0010 };
0011
0012 plot_idx = 1;
0013
0014 things_to_plot = plot_types{plot_idx}
0015
0016 ADD_MASK_CONTOUR = 1;
0017 DISPLAY_ON_INDIV_BRAIN = 1;
0018
0019 PRINT_INDIV = 0;
0020 PRINT_TO_FILE = 0;
0021
0022 clear global SO
0023 global SO
0024
0025 rootpath = '/data1/ts1/';
0026
0027 spm_path = '/usr/local/matlab/matlab5/toolbox/spm/spm99/';
0028
0029
0030 sinfo = get_ts1_sinfo;
0031 subject_ids = cellstr(char(sinfo(:).id))
0032 nsub = length(subject_ids);
0033 proc_sub = 1:nsub;
0034
0035 df_indiv = 426;
0036
0037 df_group = nsub-1;
0038
0039 threshold_p = 0.01
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 max_cutoff_indiv = 10;
0052
0053
0054
0055
0056
0057 transform_types = {'sagittal','coronal','axial'};
0058 transform_idx = [1];
0059
0060 slice_ranges = [-65 65; -60 -75; -45 75];
0061
0062 slice_skip = 5;
0063
0064
0065
0066
0067
0068
0069 load hot2
0070 load hot3
0071
0072 newhot1 = brighten(hot,0.5);
0073 newhot2 = brighten(hot2,0.5);
0074 newhot3 = brighten(hot3,0.5);
0075
0076 switch things_to_plot
0077 case 'group_stats'
0078 nimg = 0;
0079
0080 threshold = abs(tinv(threshold_p, df_group))
0081 color_range = [threshold 8];
0082
0083 nimg = nimg+1;
0084 SO.img(nimg).vol = spm_vol(sprintf('%s/group/mean.img', rootpath));
0085 SO.img(nimg).type = 'truecolor';
0086 SO.img(nimg).prop = 1;
0087 SO.img(nimg).cmap = gray;
0088
0089 SO.cbar = [2 3];
0090
0091 SO.transform = transform_types{transform_idx};
0092 SO.slices = ...
0093 slice_ranges(transform_idx,1):sign(diff(slice_ranges(transform_idx,:)))*slice_skip:slice_ranges(transform_idx,2);
0094
0095 nanat = nimg;
0096
0097 SO.labels.format = '%+d';
0098 SO.figure = spm_figure('GetWin', 'Graphics');
0099 set(SO.figure,'DefaultLineLineWidth',2.0)
0100
0101
0102 curdir = sprintf('%s/group/music-rest', rootpath);
0103
0104 nimg = nanat+1;
0105 SO.img(nimg).vol = spm_vol(sprintf('%s/%s', curdir, 'spmT_0002.img'));
0106 SO.img(nimg).type = 'split';
0107 SO.img(nimg).range = color_range;
0108 SO.img(nimg).prop = 1;
0109 SO.img(nimg).cmap = newhot1;
0110
0111 nimg = nimg+1;
0112 SO.img(nimg).vol = spm_vol(sprintf('%s/group/music-rest/%s', rootpath, 'spmT_0003.img'));
0113 SO.img(nimg).type = 'split';
0114 SO.img(nimg).range = color_range;
0115 SO.img(nimg).prop = 1;
0116 SO.img(nimg).cmap = newhot3;
0117
0118 if ADD_MASK_CONTOUR
0119 nimg = nimg+1;
0120 SO.img(nimg).vol = spm_vol(sprintf('%s/mask.img', curdir));
0121 SO.img(nimg).type = 'contour';
0122 SO.img(nimg).cmap = hot3;
0123 SO.img(nimg).contours = [0.5 0.5];
0124 SO.img(nimg).linespec = 'g';
0125 end
0126
0127 slice_overlay
0128
0129 if PRINT_TO_FILE
0130 set(gcf,'PaperPositionMode', 'auto')
0131 print('-dpsc','-painters','-noui', sprintf('%s/group/music_vs_rest.ps',rootpath))
0132 end
0133
0134 case 'indiv_stats'
0135 for isub = proc_sub
0136 curdir = fullfile(rootpath, subject_ids{isub},'normalized');
0137
0138 threshold = abs(tinv(threshold_p, df_indiv))
0139
0140 nimg = 0;
0141 SO.cbar = [];
0142
0143
0144
0145 nimg = nimg+1;
0146 if DISPLAY_ON_INDIV_BRAIN
0147 hires_dir = fullfile(rootpath, subject_ids{isub},'hires');
0148 eval(['ls ' hires_dir '/n*.img;']); hires_img = ans(1:end-1);
0149 SO.img(nimg).vol = spm_vol(hires_img);
0150
0151 else
0152 SO.img(nimg).vol = spm_vol(fullfile(spm_path,'canonical/avg152T1.img'));
0153 end
0154 SO.img(nimg).type = 'truecolor';
0155 SO.img(nimg).prop = 1;
0156 SO.img(nimg).cmap = gray;
0157 SO.cbar(nimg) = 0;
0158
0159 nimg = nimg+1;
0160 fname = sprintf('%s/spmT_0009.img', curdir)
0161 SO.img(nimg).vol = spm_vol(fname);
0162 SO.img(nimg).type = 'split';
0163 SO.img(nimg).cmap = hot;
0164 SO.img(nimg).range = [threshold max_cutoff_indiv];
0165 SO.cbar(nimg) = 1;
0166
0167 SO.cbar = find(SO.cbar);
0168
0169 SO.transform = transform_types{transform_idx};
0170 SO.slices = ...
0171 slice_ranges(transform_idx,1):sign(diff(slice_ranges(transform_idx,:)))*slice_skip:slice_ranges(transform_idx,2);
0172
0173 SO.figure = spm_figure('GetWin', 'Graphics');
0174
0175 slice_overlay
0176
0177 if PRINT_INDIV
0178 set(gcf,'PaperPositionMode', 'auto')
0179 print('-dpsc','-painters','-noui', sprintf('%s/%s_attend.ps',rootpath,subject_ids{isub}))
0180 end
0181
0182 end
0183
0184 case 'group_contrast_contour'
0185 nimg = 0;
0186 threshold = abs(tinv(threshold_p, df_group))
0187 color_range = [threshold 8];
0188
0189 nimg = nimg+1;
0190 SO.img(nimg).vol = spm_vol(sprintf('%s/group/mean.img', rootpath));
0191 SO.img(nimg).type = 'truecolor';
0192 SO.img(nimg).prop = 1;
0193 SO.img(nimg).cmap = gray;
0194
0195 SO.transform = transform_types{transform_idx};
0196 SO.slices = ...
0197 slice_ranges(transform_idx,1):sign(diff(slice_ranges(transform_idx,:)))*slice_skip:slice_ranges(transform_idx,2);
0198
0199 nanat = nimg;
0200
0201 SO.labels.format = '%+d';
0202 SO.figure = spm_figure('GetWin', 'Graphics');
0203 set(SO.figure,'DefaultLineLineWidth',2.0)
0204
0205
0206 nimg = nanat+1;
0207 SO.img(nimg).vol = spm_vol(sprintf('%s/group/t1-listen/%s', rootpath, 'spmT_0002.img'));
0208 SO.img(nimg).type = 'contour';
0209 SO.img(nimg).contours = [threshold threshold];
0210 SO.img(nimg).prop = 0.4;
0211 SO.img(nimg).cmap = newhot1;
0212 SO.img(nimg).linespec = 'r';
0213
0214 nimg = nimg+1;
0215 SO.img(nimg).vol = spm_vol(sprintf('%s/group/t2-listen/%s', rootpath, 'spmT_0002.img'));
0216 SO.img(nimg).type = 'contour';
0217 SO.img(nimg).contours = [threshold threshold];
0218 SO.img(nimg).prop = 0.4;
0219 SO.img(nimg).cmap = newhot3;
0220 SO.img(nimg).linespec = 'c';
0221
0222 if ADD_MASK_CONTOUR
0223 nimg = nimg+1;
0224 SO.img(nimg).vol = spm_vol(sprintf('%s/group/t1-listen/mask.img', rootpath));
0225 SO.img(nimg).type = 'contour';
0226 SO.img(nimg).cmap = hot3;
0227 SO.img(nimg).contours = [0.5 0.5];
0228 SO.img(nimg).linespec = 'g';
0229 end
0230
0231 slice_overlay
0232
0233 if PRINT_TO_FILE
0234 set(gcf,'PaperPositionMode', 'auto')
0235 print('-dpsc','-painters','-noui', sprintf('%s/group/t1_vs_t2_contour.ps',rootpath))
0236 end
0237 end