Home > vbmeg > demo > test_scripts > sbi > bat_read_DICOM_description.m

bat_read_DICOM_description

PURPOSE ^

SYNOPSIS ^

function [A,n1]=bat_read_DICOM_description(filename,dx,dy,dz,A,n0)

DESCRIPTION ^

 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 function [A,n1]=bat_read_DICOM_description(filename,dx,dy,dz,A,n0)
0002 %
0003 % Copyright (C) 2011, ATR All Rights Reserved.
0004 % License : New BSD License(see VBMEG_LICENSE.txt)
0005 
0006 % 脳内座標をDICOM座標へ変換
0007 % A  : 頂点座標
0008 % n0 : 法線ベクトル
0009 %事前に計算しておいたmriファイル
0010 
0011 %dx,dy,dzは計算用に小型化した際の移動分
0012 %基本的にdzは0
0013 
0014 d=read_dicom(filename);
0015 
0016 % Direction Cos Matrix 回転角行列の取得
0017 dcm = direction_cos(d);
0018 
0019 ip=getfield(d,'image_position');
0020 ps=getfield(d,'pixel_spacing');
0021 st=getfield(d,'slice_thickness');
0022 
0023 %縮小分位置修正
0024 A(:,1)=A(:,1)+dx-1;
0025 A(:,2)=A(:,2)+dy-1;
0026 A(:,3)=A(:,3)+dz-1;
0027 
0028 %画素とスライスのスペーシング修正
0029 A(:,1)=A(:,1).*ps(1);
0030 A(:,2)=A(:,2).*ps(2);
0031 A(:,3)=A(:,3).*st;
0032 n0(:,1)=n0(:,1).*ps(1);
0033 n0(:,2)=n0(:,2).*ps(2);
0034 n0(:,3)=n0(:,3).*st;
0035 
0036 %回転
0037 A=dcm*A';
0038 A=A';
0039 n1=dcm*n0';
0040 n1=n1';
0041 
0042 %画素開始位置
0043 A(:,1)=A(:,1)+ip(1);
0044 A(:,2)=A(:,2)+ip(2);
0045 A(:,3)=A(:,3)+ip(3);
0046 
0047 clear d

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