readDICOMfile : Rev.1.0, 2001-11-17 read DICOM data readDICOMfile(dname,fname) Input dname: mri directory fname: filename history 2001-11-15 S.Kajihara Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [samp,B,ier]=readDICOMfile(dname,fname) 0002 % readDICOMfile : Rev.1.0, 2001-11-17 0003 % read DICOM data 0004 % readDICOMfile(dname,fname) 0005 % Input dname: mri directory 0006 % fname: filename 0007 % 0008 % history 0009 % 2001-11-15 S.Kajihara 0010 % 0011 % Copyright (C) 2011, ATR All Rights Reserved. 0012 % License : New BSD License(see VBMEG_LICENSE.txt) 0013 ier=0; 0014 d=read_dicom(sprintf('%s%s',dname,fname)); % load 0015 dcmat = direction_cos(d); % Direction Cos Matrix 0016 pst=getfield(d,'image_position'); % position 0017 spc=getfield(d,'pixel_spacing'); % space 0018 thc=getfield(d,'slice_thickness'); % thickness 0019 0020 samp=struct('dcmat',dcmat, ... % Direction Cos Matrix 0021 'posit',pst, ... % image_position 0022 'spac',spc, ... % pixel_spacing 0023 'thic',thc); % slice_thickness 0024 0025 B=getfield(d,'pixel_data'); 0026 0027 clear d; 0028