|
| 1 | +% (C) Copyright 2021 Remi Gau |
| 2 | + |
| 3 | +%% Create ROI and extract data from it |
| 4 | +% |
| 5 | +% FYI: this is "double dipping" as we use the same data to create the ROI |
| 6 | +% we are going to extract the value from. |
| 7 | +% |
| 8 | + |
| 9 | +run moae_run.m; |
| 10 | + |
| 11 | +subLabel = '01'; |
| 12 | + |
| 13 | +saveROI = true; |
| 14 | + |
| 15 | +sphere.radius = 3; |
| 16 | +sphere.maxNbVoxels = 200; |
| 17 | + |
| 18 | +opt = setDerivativesDir(opt); |
| 19 | +ffxDir = getFFXdir(subLabel, FWHM, opt); |
| 20 | + |
| 21 | +maskImage = spm_select('FPList', ffxDir, '^.*_mask.nii$'); |
| 22 | + |
| 23 | +% we get the con image to extract data |
| 24 | +% we can do this by using the "label-XXXX" from the mask |
| 25 | +p = bids.internal.parse_filename(spm_file(maskImage, 'filename')); |
| 26 | +conImage = spm_select('FPList', ffxDir, ['^con_' p.entities.label '.nii$']); |
| 27 | + |
| 28 | +%% Create ROI right auditory cortex |
| 29 | +sphere.location = [57 -22 11]; |
| 30 | + |
| 31 | +specification = struct( ... |
| 32 | + 'mask1', maskImage, ... |
| 33 | + 'mask2', sphere); |
| 34 | + |
| 35 | +[~, roiFile] = createRoi('expand', specification, conImage, pwd, saveROI); |
| 36 | + |
| 37 | +% rename mask image |
| 38 | +newname.entities.desc = 'right auditory cortex'; |
| 39 | +newname.entities.task = ''; |
| 40 | +newname.entities.label = ''; |
| 41 | +newname.entities.p = ''; |
| 42 | +newname.entities.k = ''; |
| 43 | +newname.entities.MC = ''; |
| 44 | +rightRoiFile = renameFile(roiFile, newname); |
| 45 | + |
| 46 | +%% same but with left hemisphere |
| 47 | +sphere.location = [-57 -22 11]; |
| 48 | + |
| 49 | +specification = struct( ... |
| 50 | + 'mask1', maskImage, ... |
| 51 | + 'mask2', sphere); |
| 52 | + |
| 53 | +[~, roiFile] = createRoi('expand', specification, conImage, pwd, saveROI); |
| 54 | +newname.desc = 'left auditory cortex'; |
| 55 | +leftRoiFile = renameFile(roiFile, newname); |
| 56 | + |
| 57 | +%% |
| 58 | +right_data = spm_summarise(conImage, rightRoiFile); |
| 59 | +left_data = spm_summarise(conImage, leftRoiFile); |
0 commit comments