Changeset 191 for trunk/src/imadoc2struct.m
- Timestamp:
- Feb 5, 2011, 11:25:38 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/imadoc2struct.m
r185 r191 112 112 end 113 113 114 %% motor 115 if strcmp(option,'*') || strcmp(option,'GeometryCalib') 116 uid_subtree=find(t,'/ImaDoc/TranslationMotor'); 117 if length(uid_subtree)==1 118 subt=branch(t,uid_subtree);%subtree under GeometryCalib 119 [s.TranslationMotor,errormsg]=read_subtree(subt,{'Nbslice','ZStart','ZEnd'},[1 1 1],[1 1 1]) 120 end 121 end 114 122 %% geometric calibration 115 123 if strcmp(option,'*') || strcmp(option,'GeometryCalib') … … 200 208 end 201 209 end 210 uid_VolumeScan=find(subt,'/GeometryCalib/VolumeScan'); 211 if ~isempty(uid_VolumeScan) 212 tsai.VolumeScan=get(subt,children(subt,uid_VolumeScan),'value'); 213 end 202 214 if strcmp(option,'GeometryCalib') 203 215 tsai.PointCoord=get_value(subt,'/GeometryCalib/SourceCalib/PointCoord',[0 0 0 0 0]); … … 207 219 end 208 220 end 221 222 %-------------------------------------------------- 223 % read a subtree 224 % INPUT: 225 % t: xltree 226 % head_element: head elelemnt of the subtree 227 % Data, structure containing 228 % .Key: element name 229 % .Type: type of element ('charg', 'float'....) 230 % .NbOccur: nbre of occurrence, NaN for un specified number 231 function [s,errormsg]=read_subtree(subt,Data,NbOccur,NumTest) 232 %-------------------------------------------------- 233 s=[];%default 234 errormsg=''; 235 head_element=get(subt,1,'name') 236 cont=get(subt,1,'contents'); 237 if ~isempty(cont) 238 for ilist=1:length(Data) 239 uid_key=find(subt,[head_element '/' Data{ilist}]) 240 if ~isequal(length(uid_key),NbOccur(ilist)) 241 errormsg=['wrong number of occurence for ' Data{ilist}] 242 return 243 end 244 for ival=1:length(uid_key) 245 val=get(subt,children(subt,uid_key(ival)),'value') 246 if ~NumTest(ilist) 247 eval(['s.' Data{ilist} '=val;']); 248 else 249 eval(['s.' Data{ilist} '=str2double(val);']) 250 end 251 end 252 end 253 end 254 209 255 210 256 %--------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.