Doxygen Source Code Documentation
THD_dicomm_to_3dmm.m
Go to the documentation of this file.00001 function [err,XYZmm,map] = THD_dicomm_to_3dmm (Info, XYZdic)
00002 %
00003 % [err,XYZmm,map] = THD_dicomm_to_3dmm (Info, [XYZdic])
00004 %
00005 %Purpose:
00006 %
00007 % Change from image-oriented mm coordinates to AFNI dicom (RAI) coordinates
00008 %
00009 %Input Parameters:
00010 % Info: Structure of header file, see BrikInfo
00011 % XYZdic: Nx3 matrix of dicom coordinates
00012 %
00013 %Output Parameters:
00014 % err : 0 No Problem
00015 % : 1 Problems
00016 % XYZmm: Nx3 matrix of 3dmm coordinates
00017 % map: 1x3 vector such that XYZmm = XYZdic(:,map)
00018 %
00019 %Key Terms:
00020 %
00021 %More Info :
00022 % Based on THD_dicomm_to_3dmm in thd_coords.c
00023 %
00024 %
00025 %
00026 % Author : Ziad Saad
00027 % Date : Wed Feb 18 12:01:08 EST 2004
00028 % SSCC/NIMH/ National Institutes of Health, Bethesda Maryland
00029
00030
00031 %Define the function name for easy referencing
00032 FuncName = 'THD_dicomm_to_3dmm';
00033
00034 %Debug Flag
00035 DBG = 1;
00036
00037 %initailize return variables
00038 err = 1;
00039
00040 for (i=1:1:3),
00041 switch (Info.ORIENT_SPECIFIC(i)),
00042 case 0
00043 map(i) = 1;
00044 case 1
00045 map(i) = 1;
00046 case 2
00047 map(i) = 2;
00048 case 3
00049 map(i) = 2;
00050 case 4
00051 map(i) = 3;
00052 case 5
00053 map(i) = 3;
00054 otherwise
00055 err = 1;
00056 fprintf(2,'Error %s:\nBad orientation code (%d).\n', FuncName, i);
00057 return;
00058 end
00059 end
00060
00061 XYZmm = [];
00062 if (nargin > 1),
00063 XYZmm = XYZdic;
00064 if (~isempty(XYZdic)) XYZmm = XYZdic(:,map); end
00065 end
00066
00067 err = 0;
00068 return;
00069