Home > functions > fmri > vb_make_fmri_data.m

vb_make_fmri_data

PURPOSE ^

Make fMRI activity data from SPM voxel file.

SYNOPSIS ^

function [fMRINew, AreaNew, SPM] = vb_make_fmri_data(proj_root, fmri_parm)

DESCRIPTION ^

 Make fMRI activity data from SPM voxel file. 
 
 [syntax]
 [fMRINew, AreaNew, SPM] = vb_make_fmri_data(proj_root, fmri_parm)

 [input]
 proj_root: <<string>> Project root directory.
 fmri_parm: <<struct>> Parameters for SPM voxel mapping.
 --- fields of fmri_parm
  brain_file  : <<string>> Cortical surface model file (.brain.mat).
  spm_file    : <<string>> SPM voxel file (.spm.mat). 
  fmri_id     : <<string>> fMRI ID.
  SPM_Radius  : <<float>> Search radius for SPM active points.
  SPM_zstep   : <<float>> Slice step size in z-direction.
  Gauss_radius: <<float>> Half-width of Gaussian filter.
  Gauss_max   : <<float>> Maximum distance for averaging SPM.
 ---
 
 [output]
 fMRINew: <<struct>> fMRI activity information. 
 --- fields of fMRINew
  xxP: <<vector>> fMRI activity. 
  key: <<string>> ID of this data for retrieval. 
 ---

 AreaNew: <<struct>> Activated area information based on fMRI. 
 --- fields of AreaNew
  Iextract: <<vector>> Index of area. 
  key     : <<string>> ID of the area created. 
 ---

 [history]
 Originaly written by S.Kajihara
 Ver 1.1  modified by M. Sato  2003-4-15

 2005-03-20 Modified by TY
 Ver 0.20  modified by M. Sato  2005-4-8
 Coordinate system is changed SPM right-handed coordinate.
 2005-09-06 O.Y Ver 0.30b
 An area information is also created.
 2008-05-28 rhayashi  removed Gauss_step parameter
 2008-11-10 Taku Yoshioka
  Struct 'SPM' is returned. 
 2010-06-25 Taku Yoshioka
  RAS coordinate system is assumed for SPM voxel file, but this function
  maintains backward compatibility with old version of SPM voxel
  file. See line 85-93. 
  Verbose level support. 

 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 [fMRINew, AreaNew, SPM] = vb_make_fmri_data(proj_root, fmri_parm)
0002 % Make fMRI activity data from SPM voxel file.
0003 %
0004 % [syntax]
0005 % [fMRINew, AreaNew, SPM] = vb_make_fmri_data(proj_root, fmri_parm)
0006 %
0007 % [input]
0008 % proj_root: <<string>> Project root directory.
0009 % fmri_parm: <<struct>> Parameters for SPM voxel mapping.
0010 % --- fields of fmri_parm
0011 %  brain_file  : <<string>> Cortical surface model file (.brain.mat).
0012 %  spm_file    : <<string>> SPM voxel file (.spm.mat).
0013 %  fmri_id     : <<string>> fMRI ID.
0014 %  SPM_Radius  : <<float>> Search radius for SPM active points.
0015 %  SPM_zstep   : <<float>> Slice step size in z-direction.
0016 %  Gauss_radius: <<float>> Half-width of Gaussian filter.
0017 %  Gauss_max   : <<float>> Maximum distance for averaging SPM.
0018 % ---
0019 %
0020 % [output]
0021 % fMRINew: <<struct>> fMRI activity information.
0022 % --- fields of fMRINew
0023 %  xxP: <<vector>> fMRI activity.
0024 %  key: <<string>> ID of this data for retrieval.
0025 % ---
0026 %
0027 % AreaNew: <<struct>> Activated area information based on fMRI.
0028 % --- fields of AreaNew
0029 %  Iextract: <<vector>> Index of area.
0030 %  key     : <<string>> ID of the area created.
0031 % ---
0032 %
0033 % [history]
0034 % Originaly written by S.Kajihara
0035 % Ver 1.1  modified by M. Sato  2003-4-15
0036 %
0037 % 2005-03-20 Modified by TY
0038 % Ver 0.20  modified by M. Sato  2005-4-8
0039 % Coordinate system is changed SPM right-handed coordinate.
0040 % 2005-09-06 O.Y Ver 0.30b
0041 % An area information is also created.
0042 % 2008-05-28 rhayashi  removed Gauss_step parameter
0043 % 2008-11-10 Taku Yoshioka
0044 %  Struct 'SPM' is returned.
0045 % 2010-06-25 Taku Yoshioka
0046 %  RAS coordinate system is assumed for SPM voxel file, but this function
0047 %  maintains backward compatibility with old version of SPM voxel
0048 %  file. See line 85-93.
0049 %  Verbose level support.
0050 %
0051 % Copyright (C) 2011, ATR All Rights Reserved.
0052 % License : New BSD License(see VBMEG_LICENSE.txt)
0053 
0054 %
0055 % VBMEG constants and cortical model file
0056 %
0057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0058 coord_const = vb_define_coordinate;
0059 brain_file = [proj_root filesep fmri_parm.brain_file];
0060 
0061 %
0062 % Parameters about fMRI
0063 %
0064 % A vertex point of cortical surface V(n) is chosen as an activity when
0065 % it is located inside the sphere of radius 'SPM_Radius' with the center
0066 % V(n).
0067 %
0068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0069 
0070 vb_disp(sprintf('SPM_Radius  : %g',fmri_parm.SPM_Radius));
0071 vb_disp(sprintf('SPM_zstep   : %g',fmri_parm.SPM_zstep));
0072 
0073 % Gauss filter parameter to average SPM t-value
0074 vb_disp(sprintf('Gauss_radius: %g',fmri_parm.Gauss_radius));
0075 vb_disp(sprintf('Gauss_max   : %g',fmri_parm.Gauss_max));
0076 
0077 %
0078 % Load data
0079 %
0080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0081 load([brain_file],'V'); % Vertex in SPM coordinate [m]
0082 load([fmri_parm.spm_file]); % SPM data
0083 vb_disp(['--- Load SPM voxel data: ' fmri_parm.spm_file]);
0084 
0085 spmx = SPM.XYZmm'; % SPM point coordinate [x, y, z] (mm)
0086 spmz = SPM.Z;      % t (z) -value
0087 
0088 %
0089 % Flip left-right (X-axis) in SPM coordinate for old SPM voxel file
0090 % Left-hand to Right-hand  coordinate
0091 %
0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0093 if (~isfield(SPM,'vbmeg_RAS') | ~SPM.vbmeg_RAS) ...
0094       & (~isfield(SPM,'coord_type') ...
0095       | ~strcmp(SPM.coord_type,coord_const.COORDINATE_SPM_RIGHT_MM)), 
0096   spmx(:,1) = -spmx(:,1);
0097 end;
0098 
0099 clear pack;
0100 %
0101 % Select the dipoles around the active area in fMRI
0102 %
0103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0104 tic;
0105 vb_disp('--- Select dipoles ');
0106 
0107 % Search active vertex in 3D-sphere with Rmax [mm]
0108 [xxix ,xxP3] = vb_spm_to_cortex(spmx, spmz, V*1000, fmri_parm);
0109 
0110 spm_parm.SPM_Radius   = fmri_parm.SPM_Radius;
0111 spm_parm.SPM_zstep    = fmri_parm.SPM_zstep;
0112 spm_parm.Gauss_radius = fmri_parm.Gauss_radius;
0113 spm_parm.Gauss_max    = fmri_parm.Gauss_max;
0114 
0115 % xxix : active dipole index
0116 % xxP3 : fMRI activity
0117 % Act information
0118 tmp             = zeros(size(V,1),1);
0119 tmp(xxix)       = xxP3;
0120 fMRINew.xxP     = tmp;
0121 fMRINew.key     = fmri_parm.fmri_id;
0122 fMRINew.comment = spm_parm;
0123 
0124 % Area information
0125 AreaNew.Iextract = xxix;
0126 AreaNew.key = fmri_parm.area_id;
0127 
0128 vb_disp(sprintf('%f[sec]',toc));
0129   
0130 clear spmx3 spmx spmz;
0131 
0132 return;

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005