Home > vbmeg > functions > fmri > vb_fmri_project_PSmap_cortex.m

vb_fmri_project_PSmap_cortex

PURPOSE ^

PROJECT VOXEL PERCENT SIGNAL MAP ON THE BRAIN SURFACE MODEL

SYNOPSIS ^

function vb_fmri_project_PSmap_cortex(brain_file,act_file,area_file,PSthres,Rthres,SPMimginfo,loadVmni)

DESCRIPTION ^

 PROJECT VOXEL PERCENT SIGNAL MAP ON THE BRAIN SURFACE MODEL

 [Notice]
 con_*.img must be coregistered to T1-structural image used for creating
 a brain file

 [Syntax]
  vb_fmri_project_PSmap_cortex(brain_file,act_file,area_file,PSthres,SPMimginfo)

 [Example]
 > brain_file = 'hoge.brain.mat';
 > act_file = 'hoge.act.mat';
 > area_file = 'hoge.area.mat';
 > PSthres    = 1.0; 
 > Rthres   = 3;
 > SPMimginfo = struct('dirname', '/home/hoge/hoge/spm/',...
 > imgfilename,{'con_0001.img','con_0002.img'},imglabel,{'Right index',... 
 > 'Right hand gripping'},'basefilename','beta0010.img','2','1.17');
 > vbdot_fmri_project_PSmap_cortex(brain_file,act_file,areafile,PSthres,Rthres,SPMimginfo)

 [Input]
   brain_file : cortical surface model 
   act_file   : act file 
   area_file  : area file
   PSthres    : PS-value threshold (%)
   Rthres     : radius threshold (mm)
   SPMimginfo(ii) : arrays of struct containing information of T-image  
       .dirname : directory name for image file 
       .imgfilename :  file name of image to be projected  
       .imglabel    :  label of image to be projected. These label
                            are used as actkey and areakey
       .baseimgfilename :  file name for the baseline image
       .ncon         :  the number of positive contrast for each CON image
       .peak         :  regressor peak value
 
 [Optional]
  loadVmni : if specfied as 1, loading coordinate of brain file as MNI coordinate  

 [Output]
   Acts are added to "act_file" and Areas are added to "area_file"

 Reference : see http://cibsr.stanford.edu/documents/FMRIPercentSignalChange.pdf 
    

 2016/07/12 O.Yamashita
 * add loadVmni to input arguments to switch coordinate of brain file
 2016/07/06 O.Yamashita
 * solve the region expansion problem
 2016/07/01 O.Yamashita
 * first version based on vbdot_fmri_project_Tmap_corext.m

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vb_fmri_project_PSmap_cortex(brain_file,act_file,area_file,PSthres,Rthres,SPMimginfo,loadVmni)
0002 % PROJECT VOXEL PERCENT SIGNAL MAP ON THE BRAIN SURFACE MODEL
0003 %
0004 % [Notice]
0005 % con_*.img must be coregistered to T1-structural image used for creating
0006 % a brain file
0007 %
0008 % [Syntax]
0009 %  vb_fmri_project_PSmap_cortex(brain_file,act_file,area_file,PSthres,SPMimginfo)
0010 %
0011 % [Example]
0012 % > brain_file = 'hoge.brain.mat';
0013 % > act_file = 'hoge.act.mat';
0014 % > area_file = 'hoge.area.mat';
0015 % > PSthres    = 1.0;
0016 % > Rthres   = 3;
0017 % > SPMimginfo = struct('dirname', '/home/hoge/hoge/spm/',...
0018 % > imgfilename,{'con_0001.img','con_0002.img'},imglabel,{'Right index',...
0019 % > 'Right hand gripping'},'basefilename','beta0010.img','2','1.17');
0020 % > vbdot_fmri_project_PSmap_cortex(brain_file,act_file,areafile,PSthres,Rthres,SPMimginfo)
0021 %
0022 % [Input]
0023 %   brain_file : cortical surface model
0024 %   act_file   : act file
0025 %   area_file  : area file
0026 %   PSthres    : PS-value threshold (%)
0027 %   Rthres     : radius threshold (mm)
0028 %   SPMimginfo(ii) : arrays of struct containing information of T-image
0029 %       .dirname : directory name for image file
0030 %       .imgfilename :  file name of image to be projected
0031 %       .imglabel    :  label of image to be projected. These label
0032 %                            are used as actkey and areakey
0033 %       .baseimgfilename :  file name for the baseline image
0034 %       .ncon         :  the number of positive contrast for each CON image
0035 %       .peak         :  regressor peak value
0036 %
0037 % [Optional]
0038 %  loadVmni : if specfied as 1, loading coordinate of brain file as MNI coordinate
0039 %
0040 % [Output]
0041 %   Acts are added to "act_file" and Areas are added to "area_file"
0042 %
0043 % Reference : see http://cibsr.stanford.edu/documents/FMRIPercentSignalChange.pdf
0044 %
0045 %
0046 % 2016/07/12 O.Yamashita
0047 % * add loadVmni to input arguments to switch coordinate of brain file
0048 % 2016/07/06 O.Yamashita
0049 % * solve the region expansion problem
0050 % 2016/07/01 O.Yamashita
0051 % * first version based on vbdot_fmri_project_Tmap_corext.m
0052 %
0053 % Copyright (C) 2011, ATR All Rights Reserved.
0054 % License : New BSD License(see VBMEG_LICENSE.txt)
0055 
0056 fprintf('============== NOTICE ==========================\n')
0057 fprintf('Please confirm con_*.img have been coregistered \n')
0058 fprintf('to the T1-structural image used for creating \n');
0059 fprintf('a brain file. \n');
0060 fprintf('================================================\n')
0061 
0062 if nargin < 7
0063     loadVmni = 0;
0064 end
0065 
0066 spmdir = SPMimginfo(1).dirname;
0067 
0068 fprintf('Image directory name : %s,...\n', spmdir);
0069 for jj = 1 : length(SPMimginfo),
0070     fprintf('%s will be registered as %s ...\n', SPMimginfo(jj).imgfilename, SPMimginfo(jj).imglabel);
0071 end
0072 
0073 % scale factor for con image
0074 
0075 for jj = 1 : length(SPMimginfo),
0076     loadimgfile = [spmdir SPMimginfo(jj).imgfilename];
0077     key = SPMimginfo(jj).imglabel;
0078     
0079     baseimgfile = [spmdir SPMimginfo(jj).baseimgfilename];
0080     [B] = vb_load_analyze_to_right(baseimgfile);
0081     bmean = mean(B(~isnan(B(:))));
0082     scale = 1./SPMimginfo(jj).ncon/bmean*SPMimginfo(jj).peak*100;
0083 
0084     % surface mesh
0085     if loadVmni
0086         V = vb_load_cortex(brain_file, 'MNI');
0087     else
0088         V = vb_load_cortex(brain_file, 'subj');
0089     end
0090     V = V * 1000;  % mm
0091       
0092     
0093     % vox image and coordinates
0094     VG=spm_vol(loadimgfile);
0095     [map,XYZ] = spm_read_vols(VG);
0096     map = map * scale;
0097 
0098     %
0099     % thresholding affects resulting surface image !!!
0100     %
0101 %     map(abs(map) < PSthres) = NaN;
0102 %     ix=find(~isnan(map));
0103 %     XYZ = XYZ(:,ix);
0104 %     map = map(ix)';
0105     ix = find(~isnan(map));  % brain mask
0106     XYZ = XYZ(:,ix);  
0107     map = map(ix);
0108     map(abs(map) < PSthres) = 0; %
0109     
0110     r2thres = Rthres^2;
0111     
0112     
0113     % vox --> surf
0114     Tval = vb_voximg2surimg(XYZ',map,V, r2thres, 1);
0115 
0116         
0117     
0118    % add act
0119     fprintf('\nAdd PS-map to %s with act-key %s \n', act_file, key)
0120     act.xxP = Tval;
0121     act.key = key;
0122     act.spmdir  = spmdir;
0123     act.imgname = SPMimginfo(jj).imgfilename;
0124     vb_add_act(act_file, act, [], OFF);
0125 
0126 %       % add area
0127 %     fprintf('Add PS-map to %s with area-key %s \n', area_file, key)
0128 %     area.Iextract = find(Tval~=0);
0129 %     area.key = key;
0130 %     area.spmdir  = spmdir;
0131 %     area.imgname = SPMimginfo(jj).imgfilename;
0132 %     vb_add_area(area_file, area);
0133     
0134     
0135 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005