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

bat_read_DICOM

PURPOSE ^

SYNOPSIS ^

function [A,n1]=bat_read_DICOM(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(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 %A 事前に計算しておいたwrlファイル
0007 %vrmlfileload(vrml_filename)
0008 
0009 %dx,dy,dzは計算用に小型化した際の移動分
0010 %基本的にdzは0
0011 
0012 d=read_dicom(filename);
0013 
0014 % Direction Cos Matrix
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

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