2.Brains Crack/SPM8 Batch/2ndAnalysis

Top > 2.Brains Crack > SPM8 Batch > 2ndAnalysis

2nd Analysis|集団解析

サンプルコード

   clear all
   
   % Initialise SPM
   spm('Defaults','fMRI');
   spm_jobman('initcfg');
   
   %この例では 2人分の被験者の解析
   name_sbj{1} = '20110304SY'
   name_sbj{2} = '20110311YK'
   
   for n_sbj = 1:2	   
   	% Directory
   	spm_dir_tmp = '/Users/shika/Documents/StudyWorks/Research/SubjectiveValue/fMRIanalysis/';
	sbj_dir = name_sbj{n_sbj};
		
       % Contrast files: 全被験者のcon_0001.imgをscans_tmp1に格納
	scans_tmp1{n_sbj} = [spm_dir, 'con_0001.img'];
   end
   
   % Making Directory
   dir_tmp = ...
   		'***/fMRIanalysis/2ndAnalysis/DM1_1/';
   mkdir(dir_tmp);
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%% fMRI Specification, Estimation, Contrast %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
   %%% fMRI Specification ---------------------------------------------------------------
   matlabbatch{1}.spm.stats.factorial_design.dir = {dir_tmp};
   matlabbatch{1}.spm.stats.factorial_design.des.t1.scans = scans_tmp1;
   matlabbatch{1}.spm.stats.factorial_design.cov = struct('c', {}, 'cname', {}, 'iCFI', {}, 'iCC', {});
   matlabbatch{1}.spm.stats.factorial_design.masking.tm.tm_none = 1;
   matlabbatch{1}.spm.stats.factorial_design.masking.im = 1;
   matlabbatch{1}.spm.stats.factorial_design.masking.em = {''};
   matlabbatch{1}.spm.stats.factorial_design.globalc.g_omit = 1;
   matlabbatch{1}.spm.stats.factorial_design.globalm.gmsca.gmsca_no = 1;
   matlabbatch{1}.spm.stats.factorial_design.globalm.glonorm = 1;
   %%% fMRI Estimation ------------------------------------------------------------------
   matlabbatch{2}.spm.stats.fmri_est.spmmat = cellstr(fullfile(dir_tmp,'SPM.mat'));	
   %%% Contrast -------------------------------------------------------------------------
   matlabbatch{3}.spm.stats.con.spmmat = cellstr(fullfile(dir_tmp,'SPM.mat'));
   matlabbatch{3}.spm.stats.con.consess{1}.tcon.name   = 'Task2 - base, All Sbj, DM5';
   matlabbatch{3}.spm.stats.con.consess{1}.tcon.convec = [1];
   	
   spm_jobman('run', matlabbatch);
   
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%% Result Report %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   clear matlabbatch;
       
   matlabbatch{1}.spm.stats.results.spmmat = cellstr(fullfile(dir_tmp,'SPM.mat'));
   matlabbatch{1}.spm.stats.results.conspec.titlestr = 'Task1-2 (masked Task2 positive unc.<0.001)';
   matlabbatch{1}.spm.stats.results.conspec.contrasts = [1]; % number of con_*.img
   matlabbatch{1}.spm.stats.results.conspec.threshdesc = 'none'; % 'none' or 'FWE'l
   matlabbatch{1}.spm.stats.results.conspec.thresh = 0.001; % p-value of threshold
   matlabbatch{1}.spm.stats.results.conspec.extent = 0; % Extent voxel size    
   % Masking For image file mask
   matlabbatch{1}.spm.stats.results.conspec.mask.contrasts = {...
   	'*/fMRIanalysis/maskedImage/occipital.nii'};%
   matlabbatch{1}.spm.stats.results.conspec.mask.thresh = {};
   matlabbatch{1}.spm.stats.results.conspec.mask.mtype = 0; %Inclusive, 0; Exculusive, 1

   matlabbatch{1}.spm.stats.results.units = 1; % Data type: Volumetric, 1; Scalp-Time, 2; ...
   matlabbatch{1}.spm.stats.results.print = true; % true or false
   
   %% Run job file
   spm_jobman('run', matlabbatch);

最終更新日: 2014-11-21 (金) 16:14:09 (1705d)

 

TOP