📄 dti.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head> <title>Description of DTI</title> <meta name="keywords" content="DTI"> <meta name="description" content="%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="m2html © 2003 Guillaume Flandin"> <meta name="robots" content="index, follow"> <link type="text/css" rel="stylesheet" href="../m2html.css"></head><body><a name="_top"></a><div><a href="../index.html">Home</a> > <a href="index.html">mri_toolbox</a> > DTI.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td><td align="right"><a href="index.html">Index for mri_toolbox <img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>DTI</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>This is a script file. </strong></div><h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%TENSORCALC2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Written by Enzyme. Feb, 2004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Matlab implementation of the instructions given by Dr. Maj Hedehus
in: http://www-radiology.stanford.edu/majh/
This program calculates the tensor for an MRI slice and creates maps for
Fractional Anisotropy (FAmap), traceADC (tADC), principal eigenvector
(lambda1) and its orthogonals (lambda2 and lambda3), and an FA-weighted
colormap for the principal eigenvector (cm).
It also creates the tensor elements (xx,yy,zz,xy,yz,xz).
HOW TO USE:
1. Load the image slices to variables bo (note it is bo, letter 'o'),
b1, b2, b3, b4, b5 and b6. Use the function dicomread to do this i.e:
>>bo=dicomread('image.dcm');
2. Run this script
>>DTI
3. The maps and images are created with the names as described above. To
view a particular map or image type
>>imagesc(FAmap);colormap(gray);axis image;
Please note this program requires the image processing toolbox with dicomread
function. If you do not have it, you can load raw data images with the 'load'
function, availabe in any matlab.
VERY IMPORTANT!!!! This program assumes you only have one b-value and it is
set to b=1000.
Also: feel free to make any modifications to this code.
ENJOY!</pre></div><!-- crossreference --><h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>This function calls:<ul style="list-style-image:url(../matlabicon.gif)"></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"></ul><!-- crossreference --><h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre>0001 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0002 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%TENSORCALC2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0003 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0004 <span class="comment">%Written by Enzyme. Feb, 2004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0005 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0006 <span class="comment">%Matlab implementation of the instructions given by Dr. Maj Hedehus</span>0007 <span class="comment">%in: http://www-radiology.stanford.edu/majh/</span>0008 <span class="comment">%This program calculates the tensor for an MRI slice and creates maps for</span>0009 <span class="comment">%Fractional Anisotropy (FAmap), traceADC (tADC), principal eigenvector</span>0010 <span class="comment">%(lambda1) and its orthogonals (lambda2 and lambda3), and an FA-weighted</span>0011 <span class="comment">%colormap for the principal eigenvector (cm).</span>0012 <span class="comment">%It also creates the tensor elements (xx,yy,zz,xy,yz,xz).</span>0013 <span class="comment">%</span>0014 <span class="comment">%</span>0015 <span class="comment">%HOW TO USE:</span>0016 <span class="comment">%</span>0017 <span class="comment">%1. Load the image slices to variables bo (note it is bo, letter 'o'),</span>0018 <span class="comment">% b1, b2, b3, b4, b5 and b6. Use the function dicomread to do this i.e:</span>0019 <span class="comment">% >>bo=dicomread('image.dcm');</span>0020 <span class="comment">%2. Run this script</span>0021 <span class="comment">% >>DTI</span>0022 <span class="comment">%3. The maps and images are created with the names as described above. To</span>0023 <span class="comment">% view a particular map or image type</span>0024 <span class="comment">% >>imagesc(FAmap);colormap(gray);axis image;</span>0025 <span class="comment">%</span>0026 <span class="comment">%</span>0027 <span class="comment">%</span>0028 <span class="comment">%Please note this program requires the image processing toolbox with dicomread</span>0029 <span class="comment">%function. If you do not have it, you can load raw data images with the 'load'</span>0030 <span class="comment">%function, availabe in any matlab.</span>0031 <span class="comment">%</span>0032 <span class="comment">%</span>0033 <span class="comment">%VERY IMPORTANT!!!! This program assumes you only have one b-value and it is</span>0034 <span class="comment">% set to b=1000.</span>0035 <span class="comment">%Also: feel free to make any modifications to this code.</span>0036 <span class="comment">%</span>0037 <span class="comment">%ENJOY!</span>0038 0039 0040 0041 0042 0043 0044 ADC101=log(im2double(b1)./im2double(bo))./(-1000); <span class="comment">%Calculate ADC maps for each direction</span>0045 ADC_101=log(im2double(b2)./im2double(bo))./(-1000);0046 ADC011=log(im2double(b3)./im2double(bo))./(-1000);0047 ADC01_1=log(im2double(b4)./im2double(bo))./(-1000);0048 ADC110=log(im2double(b5)./im2double(bo))./(-1000);0049 ADC_110=log(im2double(b6)./im2double(bo))./(-1000);0050 0051 transform=[1 1 0 2 0 0;1 0 1 0 2 0;0 1 1 0 0 2;1 1 0 -2 0 0;1 0 1 0 -2 0;0 1 1 0 0 -2] <span class="comment">%the transformation matrix to obtain tensor elements</span>0052 0053 xx=zeros(256); <span class="comment">%Create empty tensor elements</span>0054 yy=zeros(256);0055 zz=zeros(256);0056 xy=zeros(256);0057 xz=zeros(256);0058 yz=zeros(256);0059 lambda1=zeros(256); <span class="comment">%create empty images</span>0060 lambda2=zeros(256);0061 lambda3=zeros(256);0062 0063 r=zeros(256);0064 g=zeros(256);0065 b=zeros(256);0066 FAmap=zeros(256);0067 tADC=zeros(256);0068 0069 <span class="keyword">for</span> i=1:256 <span class="comment">%Fill in tensor elements pixel by pixel.</span>0070 <span class="keyword">for</span> j=1:2560071 <span class="keyword">if</span> (bo(i,j)>60) <span class="comment">%noise threshold. Change this to zero if you want the whole image to be calculated (takes longer)</span>0072 ADCm=[ADC110(i,j);ADC101(i,j);ADC011(i,j);ADC_110(i,j);ADC_101(i,j);ADC01_1(i,j)]; <span class="comment">%see Hedehus, http://www-radiology.stanford.edu/majh/</span>0073 ADCe=inv(transform)*ADCm;0074 xx(i,j)=ADCe(1,1);0075 yy(i,j)=ADCe(2,1);0076 zz(i,j)=ADCe(3,1);0077 xy(i,j)=ADCe(4,1);0078 xz(i,j)=ADCe(5,1);0079 yz(i,j)=ADCe(6,1);0080 ten=[xx(i,j) xy(i,j) xz(i,j);xy(i,j) yy(i,j) yz(i,j);xz(i,j) yz(i,j) zz(i,j)]; <span class="comment">%the tensor itself</span>0081 [V,D]=eig(ten);0082 D=eig(ten); <span class="comment">%get eigenvalues</span>0083 D=abs(D);0084 D=sort(D); <span class="comment">%sort the eigenvalues (upwards)</span>0085 e1=D(3,1);e1=e1*2;0086 e2=D(2,1);e2=e2*2;0087 e3=D(1,1);e3=e3*2;0088 lambda1(i,j)=e1;0089 lambda2(i,j)=e2;0090 lambda3(i,j)=e3;0091 V=abs(V); <span class="comment">%get the x,y,z components of e3</span>0092 r(i,j)=V(1,3);0093 g(i,j)=V(2,3);0094 b(i,j)=V(3,3);0095 trace=(e1+e2+e3)/3;0096 <span class="comment">%FA=(sqrt(3/2)*sqrt((1/3)*((e1-e2)^2+(e2-e3)^2+(e3-e1)^2)))/(sqrt(e1^2+e2^2+e3^3)); %Another formula for FA</span>0097 FA=(sqrt(3*((e1-trace)^2+(e2-trace)^2+(e3-trace)^2)))/(sqrt(2*(e1^2+e2^2+e3^2))); <span class="comment">%Le Bihan 2001</span>0098 tADC(i,j)=trace;0099 FAmap(i,j)=FA;0100 <span class="keyword">end</span>;0101 <span class="keyword">end</span>;0102 <span class="keyword">end</span>;0103 0104 0105 0106 0107 rgb=cat(3,r,g,b);0108 FAmap3=cat(3,FAmap,FAmap,FAmap); <span class="comment">%needed to combine with the colormap, need 3D.</span>0109 cm=rgb.*FAmap3; <span class="comment">%FA weighting for colormap</span>0110 figure, image (cm);axis image0111 0112 0113 0114 0115 0116 0117 0118</pre></div><hr><address>Generated on Fri 21-May-2004 12:38:21 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -