Home > vbmeg > demo > test_scripts > vb_curry_to_dicom.m

vb_curry_to_dicom

PURPOSE ^

Copyright (C) 2011, ATR All Rights Reserved.

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

 Curry座標系をBV座標系に変換

 Curry 
 X:Left(1)->Right(256)
 Y:Front(1)->Back(256)
 Z:Bottom(1)->Top(256)

 BV
 X:Front(0)->Back(255)
 Y:Top(0)->Bottom(255)
 Z:Left(0)->Right(255)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %
0002 % Copyright (C) 2011, ATR All Rights Reserved.
0003 % License : New BSD License(see VBMEG_LICENSE.txt)
0004 %
0005 % Curry座標系をBV座標系に変換
0006 %
0007 % Curry
0008 % X:Left(1)->Right(256)
0009 % Y:Front(1)->Back(256)
0010 % Z:Bottom(1)->Top(256)
0011 %
0012 % BV
0013 % X:Front(0)->Back(255)
0014 % Y:Top(0)->Bottom(255)
0015 % Z:Left(0)->Right(255)
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 % BV座標系をSBI座標系に変換(梶原さんのコードを引用)
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;    % 拡張子が.tbl.mat
0043 else
0044   file_extension = define.DICOM1_EXTENSION;        % 拡張子が.tbl
0045 end
0046 
0047 MRI_ID  = file.dicom(1:findstr(file.dicom, file_extension)-1);
0048 
0049 %if exist([dir.mri, MRI_ID define.DICOM2_EXTENSION]),
0050 %  file.dicom = [ MRI_ID define.DICOM2_EXTENSION ];
0051 %end;
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;

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