0001 function [A,n1]=bat_read_DICOM(filename,dx,dy,dz,A,n0)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 d=read_dicom(filename);
0013
0014
0015 dcm = direction_cos(d);
0016
0017 ip=getfield(d,'image_position');
0018 ps=getfield(d,'pixel_spacing');
0019 st=getfield(d,'slice_thickness');
0020
0021
0022 A(:,1)=A(:,1)+dx-1;
0023 A(:,2)=A(:,2)+dy-1;
0024 A(:,3)=A(:,3)+dz-1;
0025
0026
0027 A(:,1)=A(:,1).*ps(1);
0028 A(:,2)=A(:,2).*ps(2);
0029 A(:,3)=A(:,3).*st;
0030 n0(:,1)=n0(:,1).*ps(1);
0031 n0(:,2)=n0(:,2).*ps(2);
0032 n0(:,3)=n0(:,3).*st;
0033
0034
0035 A=dcm*A';
0036 A=A';
0037 n1=dcm*n0';
0038 n1=n1';
0039
0040
0041 A(:,1)=A(:,1)+ip(1);
0042 A(:,2)=A(:,2)+ip(2);
0043 A(:,3)=A(:,3)+ip(3);
0044
0045 clear d