Home > bioelectromagnetism > avw_paint.m

avw_paint

PURPOSE ^

script to test vertex to voxel coordinate mapping

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 script to test vertex to voxel coordinate mapping

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 
0003 % script to test vertex to voxel coordinate mapping
0004 
0005 
0006 origin = avw_center(avw);
0007 
0008 xo = origin.abs.mm(1);
0009 yo = origin.abs.mm(2);
0010 zo = origin.abs.mm(3);
0011 
0012 % Find direction cosines for line from origin to nasion
0013 x =   0 + xo;
0014 y = 100 + yo;
0015 z =   0 + zo;
0016 r = sqrt( (x-xo).^2 + (y-yo).^2 + (z-zo).^2 );
0017 l = (x-xo)/r; % cos alpha
0018 m = (y-yo)/r; % cos beta
0019 n = (z-zo)/r; % cos gamma
0020 
0021 % find discrete points from origin to the vertex + 25%
0022 POINTS = 250;
0023 PERCENT = 0.25;
0024 RMIN = 0;
0025 rmax = r + (r * PERCENT);
0026 radial_distances = linspace(RMIN,rmax,POINTS);
0027 
0028 L = repmat(l,1,POINTS);
0029 M = repmat(m,1,POINTS);
0030 N = repmat(n,1,POINTS);
0031 
0032 XI = (L .* radial_distances) + xo;
0033 YI = (M .* radial_distances) + yo;
0034 ZI = (N .* radial_distances) + zo;
0035 
0036 % interpolate volume values at these points ( XI,YI are swapped here
0037 % because the Analyze volume is a left handed coordinate system )
0038 VI = interp3(vol,YI,XI,ZI,'*nearest');
0039 
0040 % Find the intensity values in this array that approximate
0041 % the scalp

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003