Home > functions > job > vb_job_update_stdcoord.m

vb_job_update_stdcoord

PURPOSE ^

Update standard brain coordinates of cortical model file.

SYNOPSIS ^

function vb_job_update_stdcoord(brain_parm,dxyz)

DESCRIPTION ^

 Update standard brain coordinates of cortical model file. 

 --- Syntax
 vb_job_update_stdcoord(brain_parm,dxyz)

 --- Input
 brain_parm.brain_file
 brain_parm.spm_normalization_file
 brain_parm.analyze_file
 dxyz     : Shift value (X,Y,Z [mm]) in std. coord

 --- Output
 'Vmni' and 'Vtal' are updated and original values will be deleted. 
 Other vaairbles are remained and have no effect on estimation.

 --- History
 2009-01-05 Taku Yoshioka

 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_job_update_stdcoord(brain_parm,dxyz)
0002 % Update standard brain coordinates of cortical model file.
0003 %
0004 % --- Syntax
0005 % vb_job_update_stdcoord(brain_parm,dxyz)
0006 %
0007 % --- Input
0008 % brain_parm.brain_file
0009 % brain_parm.spm_normalization_file
0010 % brain_parm.analyze_file
0011 % dxyz     : Shift value (X,Y,Z [mm]) in std. coord
0012 %
0013 % --- Output
0014 % 'Vmni' and 'Vtal' are updated and original values will be deleted.
0015 % Other vaairbles are remained and have no effect on estimation.
0016 %
0017 % --- History
0018 % 2009-01-05 Taku Yoshioka
0019 %
0020 % Copyright (C) 2011, ATR All Rights Reserved.
0021 % License : New BSD License(see VBMEG_LICENSE.txt)
0022 
0023 global  vbmeg_inst
0024 
0025 brain_file = brain_parm.brain_file;
0026 
0027 %
0028 % Calculate MNI coordinate and Talairach coordinate and
0029 % two area files derived from two anatomical divisons (added by OY 07/03/05)
0030 %
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 if isfield(brain_parm, 'spm_normalization_file') ...
0033       & ~isempty(brain_parm.spm_normalization_file)
0034   
0035   atlas_dir = 'MNI_atlas_templates/';
0036   EXT_brain = '.brain.mat';
0037   brain_id       = brain_file(1:findstr(brain_file,EXT_brain)-1);
0038     
0039   %% MNI coordinate
0040   tic 
0041     fprintf('-- Computing MNI and Talairach coordinate \n');
0042     
0043     mniparm.mask_file  = ['betmask.img'];      % fixed
0044 %     mniparm.brainfile  = brain_parm.brain_file;
0045     mniparm.brainfile  = brain_file;
0046     mniparm.snfile     = brain_parm.spm_normalization_file;
0047     mniparm.dxyz       = dxyz;
0048     
0049     [Vmni, Vtal, derr, IMGinfo, pXYZmni0] = vb_calc_mni_coord(mniparm);
0050     
0051     vb_save([brain_file],'Vmni','Vtal','derr');
0052     fprintf('Done...%f[sec]\n\n',toc);
0053         
0054     % Load analyze data
0055     [B, Vdim, Vsize] = vb_load_analyze_to_right(brain_parm.analyze_file);
0056 
0057     % Transform vertex coordinate to analyze right-handed coordinate
0058     pXYZmni = vb_spm_right_to_analyze_right(pXYZmni0./1000,Vdim,Vsize);
0059 
0060     Msize   = 1;        % marker size
0061     Mtype   = 'y-';        % marker type
0062     dz      = 5;        % search radius for intersection triangle
0063     vcut    = ['x','y','z','z'];    % slice cut direction
0064     indx    = [80 120 130 170 ];    % slice number to cut
0065     xymode  = 0;
0066 
0067     label   = {'Sagittal cut'; 'Coronal cut'; 'Axial cut'; 'Axial cut'};
0068 
0069     Nfig = length(vcut);
0070     NX   = 2;
0071     NY   = 2;
0072 
0073     figure('Name','Brain mask superimposed on MR images');
0074 
0075     for n= 1:Nfig
0076       subplot(NY,NX,n)
0077       vdim = vcut(n);
0078       [strX,strY] = vb_plot_3d_image(B, indx(n), vcut(n), xymode);
0079       xlabel(strX);
0080       ylabel(strY);
0081     
0082       hold on
0083       vb_plot_vertex(pXYZmni,vcut(n),indx(n),dz,Msize,Mtype,xymode);
0084       title(label{n})
0085     end
0086     
0087     % Display histogram of x-values of MNI coordinate
0088     [tmp,F] = vb_load_cortex(brain_file);
0089     ixL = unique(F.F3L(:));
0090     ixR = unique(F.F3R(:));
0091     
0092     figure('Name','Histogram of MNI coordinate (x-axis)');
0093     x = -0.1:0.001:0.1;
0094     subplot(2,1,1);
0095     title('LH')
0096     hist(Vmni(ixL,1),x);
0097     hold on;
0098     plot([0 0],[0 800],'r');
0099     subplot(2,1,2);
0100     title('RH');
0101     hist(Vmni(ixR,1),x);
0102     hold on;
0103     plot([0 0],[0 800],'r');
0104     
0105     %% AAL atlas
0106     tic 
0107     fprintf(['-- Creating an area file consisting of AAL anatomical' ...
0108              'division \n']);
0109     atlas_id = 'aal';
0110     
0111     mniparm.atlas_text = [atlas_dir atlas_id '.txt'];
0112     mniparm.atlas_file = [atlas_dir atlas_id '.img'];
0113     mniparm.atlas_id   = atlas_id;
0114     mniparm.atlas_dir  = atlas_dir;
0115 
0116 
0117     mniparm.save_areafile  = [brain_id  '_'  atlas_id  '.area.mat'];
0118     mniparm.save_atlasfile = [brain_id  '_atlas.act.mat'];    % Atlas label
0119 
0120     vb_atlas2vb_aal(mniparm)
0121     
0122     fprintf('Done...%f[sec]\n\n',toc);   
0123 
0124     
0125     %% Brodmann atlas
0126     tic 
0127     fprintf('-- Creating an area file consisting of Brodmann anatomical division \n');
0128     
0129     atlas_id = 'brodmann';
0130     
0131     mniparm.atlas_text = [atlas_dir atlas_id '.txt'];
0132     mniparm.atlas_file = [atlas_dir atlas_id '.img'];
0133     mniparm.atlas_id   = atlas_id;
0134 
0135     mniparm.save_areafile  = [brain_id  '_'  atlas_id  '.area.mat'];
0136 
0137     vb_atlas2vb(mniparm)
0138 
0139     fprintf('Done...%f[sec]\n\n',toc);
0140 else 
0141     fprintf('MNI and Talairach coordinate are not computed.\n');
0142     fprintf(['You can obtain MNI and Talairach coordinate by ' ...
0143              'running vb_atlas2vb.m later \n']);
0144 end

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