Home > vbmeg > demo > test_scripts > vb_make_subj_brain_mask.m

vb_make_subj_brain_mask

PURPOSE ^

vb_make_subj_brain_mask

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 vb_make_subj_brain_mask
 Transform anatomical label in standard space to an individual brain 
 --- Input file
 brain_mask    : standard brain mask image file 
 analyzefile   : Subject analyzefile
 snfile        : Created by SPM normalization (Personal-> MNI-template). 
                 The normalize transformation is contained.
 --- Output file
 subj_mask : subject brain mask file

 avw.img  : 3D-image (SPM-right)
 avw.hdr.dime.dim(2:4)    : image dimension
 avw.hdr.dime.pixdim(2:4) : voxel size [mm]

 XYZspm    : SPM_right_[m] coordinate for some regions [cell structure]
 XYZspm{1} : Central region to separate left/right hemisphere
 XYZspm{2} : Skull surface
 XYZspm{n}.xyz   : SPM-right-[m] coordinate for corresponding region
 XYZspm{n}.F     : surface patch index
 XYZspm{n}.label : region label name

 Label value
  1 = CSF
  2 = Gray
  3 = White
  4 = Cerebellum
  5 = Brainstem

 Indx = find( avw.img(:) > 0); % index for brain region
 Indx = find( avw.img(:)==1 ); % index for CSF
 Indx = find( avw.img(:)==2 ); % index for Gray
 Indx = find( avw.img(:)==3 ); % index for White
 Indx = find( avw.img(:)==4 ); % index for Cerebellum
 Indx = find( avw.img(:)==5 ); % index for BrainStem

 2007/06/13 Masa-aki Sato

 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 % vb_make_subj_brain_mask
0002 % Transform anatomical label in standard space to an individual brain
0003 % --- Input file
0004 % brain_mask    : standard brain mask image file
0005 % analyzefile   : Subject analyzefile
0006 % snfile        : Created by SPM normalization (Personal-> MNI-template).
0007 %                 The normalize transformation is contained.
0008 % --- Output file
0009 % subj_mask : subject brain mask file
0010 %
0011 % avw.img  : 3D-image (SPM-right)
0012 % avw.hdr.dime.dim(2:4)    : image dimension
0013 % avw.hdr.dime.pixdim(2:4) : voxel size [mm]
0014 %
0015 % XYZspm    : SPM_right_[m] coordinate for some regions [cell structure]
0016 % XYZspm{1} : Central region to separate left/right hemisphere
0017 % XYZspm{2} : Skull surface
0018 % XYZspm{n}.xyz   : SPM-right-[m] coordinate for corresponding region
0019 % XYZspm{n}.F     : surface patch index
0020 % XYZspm{n}.label : region label name
0021 %
0022 % Label value
0023 %  1 = CSF
0024 %  2 = Gray
0025 %  3 = White
0026 %  4 = Cerebellum
0027 %  5 = Brainstem
0028 %
0029 % Indx = find( avw.img(:) > 0); % index for brain region
0030 % Indx = find( avw.img(:)==1 ); % index for CSF
0031 % Indx = find( avw.img(:)==2 ); % index for Gray
0032 % Indx = find( avw.img(:)==3 ); % index for White
0033 % Indx = find( avw.img(:)==4 ); % index for Cerebellum
0034 % Indx = find( avw.img(:)==5 ); % index for BrainStem
0035 %
0036 % 2007/06/13 Masa-aki Sato
0037 %
0038 % Copyright (C) 2011, ATR All Rights Reserved.
0039 % License : New BSD License(see VBMEG_LICENSE.txt)
0040 
0041 clear all
0042 
0043 % Standard brain directory
0044 proj_root  = [getenv('MFILE') '/MEGdata/VBtool/vbmeg/'];
0045 atlas_dir  = [proj_root 'tool_box/atlas2vb_dir/MNI_atlas_templates/'];
0046 
0047 % Subject directory
0048 subj_dir = [getenv('MATHOME') '/Retino_TY/'];
0049 
0050 % Standard brain mask file
0051 brain_mask = [atlas_dir 'brain_mask.mat'];
0052 
0053 % Subject image file
0054 analyzefile = [subj_dir '3d.hdr' ];
0055 snfile      = [subj_dir '3d_sn.mat'];
0056 subj_mask   = [subj_dir 'brain_mask.mat'];
0057 
0058 %
0059 % --- Transform anatomical label in standard space to an individual brain
0060 %
0061 [avw ,XYZspm] = vb_map_mask_image(analyzefile,brain_mask,snfile);
0062 
0063 vb_fsave([subj_mask], 'avw', 'XYZspm');
0064 
0065 %
0066 % --- Check skull
0067 %
0068 [B, Vdim, Vsize] = vb_load_analyze_to_right(analyzefile);
0069 
0070 % Skull surface
0071 V = XYZspm{2}.xyz;
0072 F = XYZspm{2}.F;
0073 V = vb_spm_right_to_analyze_right(V,Vdim,Vsize);
0074 
0075 xymode=1;
0076 Msize =1;
0077 % スライス画像表示の Z-座標リスト
0078 zindx = fix([80:15:200]/Vsize(3));
0079 
0080 vb_plot_slice_surf(B, V, F ,zindx,'z',[3,3],'y-',5,xymode,Msize);
0081 
0082 %
0083 % --- Check cortex & brain
0084 %
0085 vb_plot_brain_mask(avw, analyzefile)
0086 
0087 return

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