Home > vbmeg > functions > fmri > vb_fmri_unsn_project_Tmap_cortex.m

vb_fmri_unsn_project_Tmap_cortex

PURPOSE ^

UNNORMALIZATION AND PROJECT VOXEL TMAP ON THE BRAIN SURFACE MODEL

SYNOPSIS ^

function vb_fmri_unsn_project_Tmap_cortex(brain_file,act_file,area_file,sn_file,Tthres,Rthres,SPMimginfo)

DESCRIPTION ^

 UNNORMALIZATION AND PROJECT VOXEL TMAP ON THE BRAIN SURFACE MODEL

 [Notice]
 spmT_*.img must be normalized to the standard brain using T1-structural image used for creating
 a brain file.


 [Input]
   brain_file : cortical surface model 
   act_file   : act file 
   area_file  : area file
   sn_file    : sn file or deformation field
   Tthres     : T-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.
 
 [Output]
   Acts are added to "act_file" and Areas are added to "area_file"

 2016/07/26 O.Yamashita
 * 'spm_ver' moves to 'SPMimginfo'. 
 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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function vb_fmri_unsn_project_Tmap_cortex(brain_file,act_file,area_file,sn_file,Tthres,Rthres,SPMimginfo)
0002 % UNNORMALIZATION AND PROJECT VOXEL TMAP ON THE BRAIN SURFACE MODEL
0003 %
0004 % [Notice]
0005 % spmT_*.img must be normalized to the standard brain using T1-structural image used for creating
0006 % a brain file.
0007 %
0008 %
0009 % [Input]
0010 %   brain_file : cortical surface model
0011 %   act_file   : act file
0012 %   area_file  : area file
0013 %   sn_file    : sn file or deformation field
0014 %   Tthres     : T-value threshold
0015 %   Rthres     : radius threshold (mm)
0016 %   SPMimginfo(ii) : arrays of struct containing information of T-image
0017 %       .dirname : directory name for image file
0018 %       .imgfilename :  file name of image to be projected
0019 %       .imglabel    :  label of image to be projected. These label
0020 %                            are used as actkey and areakey.
0021 %
0022 % [Output]
0023 %   Acts are added to "act_file" and Areas are added to "area_file"
0024 %
0025 % 2016/07/26 O.Yamashita
0026 % * 'spm_ver' moves to 'SPMimginfo'.
0027 % 2016/07/06 O.Yamashita
0028 % * solve the region expansion problem
0029 % 2016/07/01 O.Yamashita
0030 % * first version based on vbdot_fmri_project_Tmap_corext.m
0031 %
0032 % Copyright (C) 2011, ATR All Rights Reserved.
0033 % License : New BSD License(see VBMEG_LICENSE.txt)
0034 
0035 
0036 spmdir = SPMimginfo(1).dirname;
0037 spm_ver = SPMimginfo(1).spm_ver;
0038 
0039 fprintf('Image directory name : %s,...\n', spmdir);
0040 for jj = 1 : length(SPMimginfo),
0041     fprintf('%s will be registered as %s ...\n', SPMimginfo(jj).imgfilename, SPMimginfo(jj).imglabel);
0042 end
0043 
0044 
0045 for jj = 1 : length(SPMimginfo),
0046     loadimgfile = [spmdir SPMimginfo(jj).imgfilename];
0047     key = SPMimginfo(jj).imglabel;
0048 
0049     % surface mesh
0050     V = vb_load_cortex(brain_file, 'subj');
0051     V = V * 1000;  % mm
0052       
0053     
0054     % vox image and coordinates on standard brain
0055     VG=spm_vol(loadimgfile);
0056     [map,XYZ] = spm_read_vols(VG);
0057 
0058     
0059     
0060     %
0061     % thresholding affects resulting surface image !!!
0062     %
0063 %     map(map < Tthres) = 0;
0064 %     XYZ = XYZ(:,map~=0);
0065 %     map = map(map ~= 0)';
0066    
0067     ix = find(map~=0);  % brain mask
0068     XYZ = XYZ(:,ix);  
0069     map = map(ix);
0070     map(map < Tthres) = 0; %
0071 
0072     r2thres = Rthres^2;
0073     
0074     % standard brain --> individual brain
0075     XYZmm = backword_transform_normalized_to_subject_native(sn_file, spm_ver, XYZ');
0076     
0077     
0078     % vox --> surf
0079     Tval = vb_voximg2surimg(XYZmm,map,V, r2thres, 1);
0080 
0081     
0082    % add act
0083     fprintf('\nAdd T-map to %s with act-key %s \n', act_file, key)
0084     act.xxP = Tval;
0085     act.key = key;
0086     act.spmdir  = spmdir;
0087     act.imgname = SPMimginfo(jj).imgfilename;
0088     load(act_file, 'MRI_ID');
0089     vb_add_act(act_file, act, MRI_ID, OFF);
0090 
0091     % add area
0092     fprintf('Add T-map to %s with area-key %s \n', area_file, key)
0093     area.Iextract = find(Tval~=0);
0094     area.key = key;
0095     area.spmdir  = spmdir;
0096     area.imgname = SPMimginfo(jj).imgfilename;
0097     load(area_file, 'MRI_ID');
0098     vb_add_area(area_file, area, 'MRI_ID', OFF);
0099     
0100     
0101 end
0102 
0103 function XYZmm = backword_transform_normalized_to_subject_native(snfile, spm_ver, XYZmm_mni)
0104 % XYZmm_mni : Nvox*3
0105 
0106 switch (lower(spm_ver))
0107  case 'spm2', 
0108   sn = load(snfile);
0109   XYZmm=vb_unsn(XYZmm_mni,sn);
0110   
0111  case {'spm5','spm8'}, 
0112   XYZmm = spm_get_orig_coord_spm5(XYZmm_mni,snfile);
0113 end;
0114

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