Skip to content

AFNI/NIfTI Server

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

Doxygen Source Code Documentation


HEAD_Rules.m

Go to the documentation of this file.
00001 function [err, ErrMessage, Rules] = HEAD_Rules (FieldNames)
00002 %
00003 %   [err, ErrMessage, Rules] = HEAD_Rules (FieldNames)
00004 %
00005 %Purpose:
00006 %   Retrieve the rules for the different fields in AFNI
00007 %   
00008 %   
00009 %Input Parameters:
00010 %   FieldNames is a ~ delirited list of N field names
00011 %   
00012 %   
00013 %Output Parameters:
00014 %   err : 0 No Problem
00015 %       : 1 Mucho Problems
00016 %   Rules is a vector of N structures with the following fields
00017 %     .Name is the field's name
00018 %     .isNum if it is supposed to be a string or a number (0 (string)/1 (int)/2(float), -1 for fields not in the database)
00019 %     .Length length of number vector or string (leave empty if not applicable)
00020 %     .minLength minimum length of vector or string (leave empty if not applicable)
00021 %   
00022 %      
00023 %Key Terms:
00024 %   
00025 %More Info :
00026 %   AFNI's README.attributes
00027 %   
00028 %   
00029 %
00030 %     Author : Ziad Saad
00031 %     Date : Mon Apr 9 15:58:24 PDT 2001
00032 %     LBC/NIMH/ National Institutes of Health, Bethesda Maryland
00033 
00034 
00035 %Define the function name for easy referencing
00036         FuncName = 'HEAD_Rules';
00037 %Debug Flag
00038         DBG = 1;
00039 
00040 %initailize return variables
00041         err = 1;
00042         ErrMessage = [];
00043         Rules = [];
00044 
00045 
00046 if (nargin == 0),
00047         FieldNames = '';
00048 end
00049 
00050 if (isempty(FieldNames)),
00051         %Need to retrieve rules for all fields 
00052         %This is a ~ delimited list of all the fields present in this function
00053                 tmp1 = 'BRICK_FLOAT_FACS~BRICK_LABS~BRICK_KEYWORDS~BRICK_STATAUX~BRICK_STATS~BRICK_TYPES~BYTEORDER_STRING~';
00054                 tmp2 = 'DATASET_DIMENSIONS~DATASET_KEYWORDS~DATASET_NAME~DATASET_RANK~DELTA~HISTORY_NOTE~IDCODE_ANAT_PARENT~';
00055                 tmp3 = 'IDCODE_DATE~IDCODE_STRING~IDCODE_WARP_PARENT~LABEL_1~LABEL_2~MARKS_FLAGS~MARKS_HELP~MARKS_LAB~MARKS_XYZ~';                      
00056                 tmp4 = 'NOTES_COUNT~ORIENT_SPECIFIC~ORIGIN~SCENE_DATA~STAT_AUX~TAGALIGN_MATVEC~TAGSET_FLOATS~TAGSET_LABELS~TAGSET_NUM~';
00057                 tmp5 = 'TAXIS_FLOATS~TAXIS_NUMS~TAXIS_OFFSETS~TO3D_ZPAD~TYPESTRING~VOLREG_BASE_IDCODE~VOLREG_BASE_NAME~VOLREG_CENTER_BASE~';
00058                 tmp6 = 'VOLREG_CENTER_OLD~VOLREG_GRIDPARENT_IDCODE~VOLREG_GRIDPARENT_NAME~VOLREG_INPUT_IDCODE~VOLREG_INPUT_NAME~';
00059                 tmp7 = 'VOLREG_ROTCOM_NUM~VOLREG_ROTPARENT_IDCODE~VOLREG_ROTPARENT_NAME~WARP_DATA~WARP_TYPE~';
00060                 AllFields = zdeblank(sprintf('%s%s%s%s%s%s%s', tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7));
00061                 FieldNames = AllFields;
00062 else
00063         FieldNames = zdeblank (FieldNames);
00064 end
00065 
00066 %remove last ~ delimiter
00067         Ntmp = length(FieldNames);
00068         if (FieldNames(Ntmp) == '~'), FieldNames = FieldNames(1:Ntmp-1); end
00069 
00070 Nfields = WordCount(FieldNames, '~');
00071 %initialize structure fields
00072         Rules(Nfields).Name = '';
00073         Rules(Nfields).isNum = [];
00074         Rules(Nfields).Length = [];
00075         Rules(Nfields).minLength = [];
00076 
00077 for (ir=1:1:Nfields),
00078         [err,CurName] = GetWord(FieldNames, ir, '~');
00079         isNum = [];
00080         Length = [];
00081         minLength = [];
00082         if (~isempty(CurName)),
00083                 switch CurName,
00084                         case 'BRICK_FLOAT_FACS',
00085                                 isNum = 2;
00086                         case 'BRICK_LABS',
00087                                 isNum = 0;
00088                         case 'BRICK_KEYWORDS',
00089                                 isNum = 0;
00090                         case 'BRICK_STATAUX',
00091                                 isNum = 2;
00092                         case 'BRICK_STATS',
00093                                 isNum = 2;
00094                         case 'BRICK_TYPES',
00095                                 isNum = 1;
00096                         case 'BYTEORDER_STRING',
00097                                 isNum = 0;
00098                         case 'DATASET_DIMENSIONS',
00099                                 isNum = 1;
00100                                 minLength = 3;
00101                         case 'DATASET_KEYWORDS',
00102                                 isNum = 0;
00103                         case 'DATASET_NAME',
00104                                 isNum = 0;
00105                         case 'DATASET_RANK',
00106                                 isNum = 1;
00107                                 minLength = 2;
00108                         case 'DELTA',
00109                                 isNum = 2;
00110                                 Length = 3;
00111                         case 'HISTORY_NOTE',
00112                                 isNum = 0;
00113                         case 'IDCODE_ANAT_PARENT',
00114                                 isNum = 0;
00115                         case 'IDCODE_DATE',
00116                                 isNum = 0;
00117                         case 'IDCODE_STRING',
00118                                 isNum = 0;
00119                         case 'IDCODE_WARP_PARENT',
00120                                 isNum = 0;
00121                         case 'LABEL_1',
00122                                 isNum = 0;
00123                         case 'LABEL_2',
00124                                 isNum = 0;
00125                         case 'MARKS_FLAGS',
00126                                 isNum = 1;
00127                                 minLength = 2;
00128                         case 'MARKS_HELP',
00129                                 isNum = 0;
00130                                 Length = 2559;
00131                         case 'MARKS_LAB',
00132                                 isNum = 0;
00133                                 Length = 199;
00134                         case 'MARKS_XYZ',
00135                                 isNum = 2;
00136                                 Length = 30;
00137                         case 'NOTES_COUNT',
00138                                 isNum = 1;
00139                                 Length = 1;
00140                         case 'ORIENT_SPECIFIC',
00141                                 isNum = 1;
00142                                 Length = 3;
00143                         case 'ORIGIN',
00144                                 isNum = 2;
00145                                 Length = 3;
00146                         case 'SCENE_DATA',
00147                                 isNum = 1;
00148                                 minLength = 3;
00149                         case 'STAT_AUX',
00150                                 isNum = 2;
00151                         case 'TAGALIGN_MATVEC',
00152                                 isNum = 2;
00153                                 Length = 12;
00154                         case 'TAGSET_FLOATS',
00155                                 isNum = 2;
00156                         case 'TAGSET_LABELS',
00157                                 isNum = 0;
00158                         case 'TAGSET_NUM',
00159                                 isNum = 1;
00160                                 Length = 2;
00161                         case 'TAXIS_FLOATS',
00162                                 isNum = 2;
00163                                 minLength = 5;
00164                         case 'TAXIS_NUMS',
00165                                 isNum = 1;
00166                                 minLength = 3;
00167                         case 'TAXIS_OFFSETS',
00168                                 isNum = 2;
00169                         case 'TO3D_ZPAD',
00170                                 isNum = 1;
00171                                 Length = 3;
00172                         case 'TYPESTRING',
00173                                 isNum = 0;
00174                         case 'VOLREG_BASE_IDCODE',
00175                                 isNum = 0;
00176                                 Length = 26;
00177                         case 'VOLREG_BASE_NAME',
00178                                 isNum = 0;
00179                         case 'VOLREG_CENTER_BASE',
00180                                 isNum = 2;
00181                                 Length = 3;
00182                         case 'VOLREG_CENTER_OLD',
00183                                 isNum = 2;
00184                                 Length = 3;
00185                         case 'VOLREG_GRIDPARENT_IDCODE',
00186                                 isNum = 0;
00187                         case 'VOLREG_GRIDPARENT_NAME',
00188                                 isNum = 0;
00189                         case 'VOLREG_INPUT_IDCODE',
00190                                 isNum = 0;
00191                                 Length = 26;
00192                         case 'VOLREG_INPUT_NAME',
00193                                 isNum = 0;
00194                         case 'VOLREG_ROTCOM_NUM',
00195                                 isNum = 1;
00196                                 Length = 1;
00197                         case 'VOLREG_ROTPARENT_IDCODE',
00198                                 isNum = 0;
00199                                 Length = 26;
00200                         case 'VOLREG_ROTPARENT_NAME',
00201                                 isNum = 0;
00202                         case 'WARP_DATA',
00203                                 isNum = 2;
00204                         case 'WARP_TYPE',
00205                                 isNum = 1;
00206                                 minLength = 2;
00207                         otherwise,
00208                                 isNum = -1;
00209                 end
00210                 Rules(ir).Name = CurName;
00211                 Rules(ir).isNum = isNum;
00212                 Rules(ir).Length = Length;
00213                 Rules(ir).minLength = minLength;
00214         else
00215                 err = 1; ErrMessage = sprintf('Error %s: Empty String in Field Name List', FuncName); errordlg(ErrMessage); return;     
00216         end %isempty(CurName)
00217 end %for cnt
00218 
00219 
00220 
00221          
00222  
00223 
00224 
00225  
00226 
00227 
00228 err = 0;
00229 ErrMessage = '';
00230 
00231 return;
00232 
 

Powered by Plone

This site conforms to the following standards: