0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 V1(:,1) = V(:,2)-1;
0018 V1(:,2) = 256-V(:,3);
0019 V1(:,3) = V(:,1)-1;
0020 xx1(:,1) = xx(:,2);
0021 xx1(:,2) = -1*xx(:,3);
0022 xx1(:,3) = -1*xx(:,1);
0023 
0024 
0025 
0026 
0027 [B,ier] = readDICOMimages(dicomdir,dicomfile);
0028 
0029 V1(:,1) = V1(:,1)+1;
0030 V1(:,2) = V1(:,2)+1;
0031 
0032 if isfield(parm.brain_parm,'ignore_offset') & ...
0033       parm.brain_parm.ignore_offset
0034   V1(:,3) = size(B,3)-V1(:,3);
0035   disp('Offset is ignored');
0036 else
0037   V1(:,3) = max(size(B))-V1(:,3)-fix((256-size(B,3))/2);
0038 end
0039 
0040 
0041 if ~isempty( findstr(file.dicom, define.DICOM2_EXTENSION) )
0042   file_extension = define.DICOM2_EXTENSION;    
0043 else
0044   file_extension = define.DICOM1_EXTENSION;        
0045 end
0046 
0047 MRI_ID  = file.dicom(1:findstr(file.dicom, file_extension)-1);
0048 
0049 
0050 
0051 
0052 
0053 MRIfile = sprintf('%s%s%s.%d.mri',dir.mri,filesep,MRI_ID,size(B,3));
0054 [V,xx] = bat_read_DICOM(MRIfile,0,0,0,V1,xx1);
0055 V = V./1000;