Home > vbmeg > demo > test_scripts > vb_script_atlas2vb.m

vb_script_atlas2vb

PURPOSE ^

Template script of how to run "atlas2vb"

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Template script of how to run "atlas2vb" 

 "atlas2vb" is a program to get MNI and Talairach coordinate, and anatomical region
 label for each cortical vertex point of individual brain coordinate 
 transformation to MNI-normalized-space.

 1. Back-transform cortex coordinate 'V' in brainfile
     to MNI-space coordinate and Talairach coordinate
 2. Create an areafile based on the anatomical divisions

 2006/03/01 by M.Sato
 2006/03/01 by O. Yamashita
 2007/03/05 by O. Yamashita
 * MNI coordinate is stored in brainfile.
 * save_xyzfile is removed.
 * addpath(spm_dir) is removed

 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 % Template script of how to run "atlas2vb"
0002 %
0003 % "atlas2vb" is a program to get MNI and Talairach coordinate, and anatomical region
0004 % label for each cortical vertex point of individual brain coordinate
0005 % transformation to MNI-normalized-space.
0006 %
0007 % 1. Back-transform cortex coordinate 'V' in brainfile
0008 %     to MNI-space coordinate and Talairach coordinate
0009 % 2. Create an areafile based on the anatomical divisions
0010 %
0011 % 2006/03/01 by M.Sato
0012 % 2006/03/01 by O. Yamashita
0013 % 2007/03/05 by O. Yamashita
0014 % * MNI coordinate is stored in brainfile.
0015 % * save_xyzfile is removed.
0016 % * addpath(spm_dir) is removed
0017 %
0018 % Copyright (C) 2011, ATR All Rights Reserved.
0019 % License : New BSD License(see VBMEG_LICENSE.txt)
0020 
0021 clear all
0022 close all
0023 pack
0024 
0025 % MRIcro include 1x1x1 mm T1 MRI scan.
0026 % brodmann.img : 1x1x1 mm version of 'TD_brodmann'
0027 % aal.img      : 1x1x1 mm version of 'aal_MNI_V4'
0028 % betmask.img  : scalp mask image (2x2x2 mm) using for coordinate transform
0029 
0030 
0031 %--- Add SPM path if you do not installed SPM
0032 %--- Necessary function : spm_dctmtx (Creates basis functions for Discrete Cosine Transform.)
0033 %spm_dir    = '/home/dcfs2/oyamashi/matlab/spm2/';
0034 %addpath(spm_dir);
0035 
0036 %---Set parameters required (filenames, atlas_id and so on)
0037 
0038 % Atlas template file and ID
0039 
0040 ATLAS_ID = {'aal', 'brodmann'};
0041 atlas_id   = ATLAS_ID{2};  % ATLAS_ID{1} or ATLAS_ID{2}
0042  
0043 atlas_dir  = 'MNI_atlas_templates/';
0044 atlas_text = [atlas_id '.txt'];
0045 atlas_file = [atlas_id '.img'];
0046 mask_file  = ['betmask.img'];  % constant
0047 
0048 % Subject brain file
0049 brain_dir = './';
0050 brainfile = ['test.brain.mat'];
0051 sn_dir = './';
0052 snfile    = ['3d_sn.mat']; 
0053 
0054 %-------------------------------------------------------
0055 %  You don't need to modify lines below
0056 %-------------------------------------------------------
0057 
0058 % The names of save files are determined by 'brain_id' and 'atlas_id' automatically
0059 % If you want to change output filenames, please set 'save_areafile',
0060 % 'save_atlasfile' and 'save_xyzfile' below as you like.
0061 
0062 EXT_brain = '.brain.mat';
0063 EXT_xyz   = '.xyz.mat';
0064 EXT_atlas = '.atlas.mat';
0065 brain_id       = brainfile(1:findstr(brainfile,EXT_brain)-1);
0066 save_areafile  = [brain_dir, brain_id  '_'  atlas_id  '.area.mat'];
0067 save_atlasfile = [brain_dir, brain_id  '_atlas.act.mat'];    % Atlas label
0068 %save_xyzfile   = [brain_dir, brain_id  EXT_xyz];         % MNI coordinate
0069 
0070 %--- Set parm struct
0071 parm.atlas_dir      = atlas_dir;
0072 parm.atlas_id       = atlas_id;
0073 parm.atlas_text     = [atlas_dir, atlas_text];
0074 parm.atlas_file     = [atlas_dir, atlas_file];
0075 parm.mask_file      = [atlas_dir, mask_file];
0076 parm.brainfile      = [brain_dir, brainfile];
0077 parm.snfile         = [sn_dir, snfile];
0078 parm.save_areafile  = save_areafile;
0079 parm.save_atlasfile = save_atlasfile;
0080 %parm.save_xyzfile   = save_xyzfile;
0081 parm.Rlimit = 4; % Max radius to check minimum distance to corresponding point [mm]
0082 parm.Rmax   = 2; % Max radius to search corresponding point [mm] in the 1st-step
0083 
0084 %parm = set_atlas_parm(atlas_dir,atlas_id,brain_dir,brainfile,snfile);
0085 
0086 
0087 %--- Back-transform cortex coordinate 'V' in brainfile
0088 %--- to MNI-space coordinate and Talairach coordinate
0089 
0090 tic
0091 
0092 D=load(parm.brainfile);
0093 
0094 if ~isfield(D,'Vmni')
0095     [Vmni, Vtal, derr, IMGinfo] = vb_calc_mni_coord(parm);
0096     vb_save([parm.brain_file],'Vmni','Vtal','derr');
0097 end
0098 
0099 vb_ptime(toc)
0100 pack
0101 
0102 %--- Create an areafile based on the anatomical template
0103 
0104 tic
0105 
0106 if strcmp(atlas_id, 'aal') == 1,
0107     vb_atlas2vb_aal(parm);
0108 else
0109     vb_atlas2vb(parm);
0110 end
0111     
0112 vb_ptime(toc)
0113 
0114 vb_plot_atlas(parm.brainfile, parm.save_atlasfile,atlas_id);
0115 
0116 return

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