Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


THD_3dmm_to_dicomm.m

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

Powered by Plone

This site conforms to the following standards: