Changeset 456 for trunk/src/imadoc2struct.m
- Timestamp:
- Jun 17, 2012, 10:50:20 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/imadoc2struct.m
r215 r456 28 28 29 29 %% opening the xml file 30 if exist(ImaDoc,'file')~=2, errormsg=[ ImaDoc ' does not exist']; return;end;%input file does not exist 30 [tild,tild,FileExt]=fileparts(ImaDoc); 31 if strcmp(FileExt,'.civ') 32 [errormsg,time,TimeUnit,mode,npx,npy,XmlData{iview}.GeometryCalib]=read_imatext(ImaDoc); 33 return 34 end 31 35 try 32 36 t=xmltree(ImaDoc); 33 catch 34 errormsg={[ ImaDoc ' is not a valid xml file']; lasterr};37 catch ME 38 errormsg={['error reading ' ImaDoc ': ']; ME.message}; 35 39 display(errormsg); 36 40 return 37 41 end 38 42 uid_root=find(t,'/ImaDoc'); 39 if isempty(uid_root), errormsg=[ImaDoc ' is not an image documentation file ImaDoc']; return; end;%not an ImaDoc .xml file 40 43 if isempty(uid_root), return; end;%not an ImaDoc .xml file 41 44 42 45 %% Heading … … 283 286 end 284 287 end 288 289 %------------------------------------------------------------------------ 290 %'read_imatext': reads the .civ file for image documentation (obsolete) 291 % fileinput: name of the documentation file 292 % time: matrix of times for the set of images 293 %pxcmx: scale along x in pixels/cm 294 %pxcmy: scale along y in pixels/cm 295 function [error,time,TimeUnit,mode,npx,npy,GeometryCalib]=read_imatext(fileinput) 296 %------------------------------------------------------------------------ 297 error=0;%default 298 time=[]; %default 299 TimeUnit='s'; 300 mode='pairs'; 301 npx=[]; %default 302 npy=[]; %default 303 pxcmx=1;%default 304 pxcmy=1;%default 305 if exist(fileinput,'file')~=2, error=2, return;end;%input file does not exist 306 dotciv=textread(fileinput); 307 sizdot=size(dotciv); 308 if ~isequal(sizdot(1)-8,dotciv(1,1)); 309 error=1; %inconsistent number of bursts 310 end 311 nbfield=sizdot(1)-8; 312 npx=(dotciv(2,1)); 313 npy=(dotciv(2,2)); 314 pxcmx=(dotciv(6,1));% pixels/cm in the .civ file 315 pxcmy=(dotciv(6,2)); 316 % nburst=dotciv(3,1); % nbre of bursts 317 abs_time1=dotciv([9:nbfield+8],2); 318 dtime=dotciv(5,1)*(dotciv([9:nbfield+8],[3:end-1])+1); 319 timeshift=[abs_time1 dtime]; 320 time=cumsum(timeshift,2); 321 322 GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0]; 323 GeometryCalib.Tx=0; 324 GeometryCalib.Ty=0; 325 GeometryCalib.Tz=1; 326 GeometryCalib.dpx=1; 327 GeometryCalib.dpy=1; 328 GeometryCalib.sx=1; 329 GeometryCalib.Cx=0; 330 GeometryCalib.Cy=0; 331 GeometryCalib.f=1; 332 GeometryCalib.kappa1=0; 333 GeometryCalib.CoordUnit='cm';
Note: See TracChangeset
for help on using the changeset viewer.