Ignore:
Timestamp:
Jun 17, 2012, 10:50:20 PM (12 years ago)
Author:
sommeria
Message:

various bugs corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/imadoc2struct.m

    r215 r456  
    2828
    2929%% 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);
     31if strcmp(FileExt,'.civ')
     32    [errormsg,time,TimeUnit,mode,npx,npy,XmlData{iview}.GeometryCalib]=read_imatext(ImaDoc);
     33    return
     34end
    3135try
    3236    t=xmltree(ImaDoc);
    33 catch
    34     errormsg={[ImaDoc ' is not a valid xml file']; lasterr};
     37catch ME
     38    errormsg={['error reading ' ImaDoc ': ']; ME.message};
    3539    display(errormsg);
    3640    return
    3741end
    3842uid_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 
     43if isempty(uid_root), return; end;%not an ImaDoc .xml file
    4144
    4245%% Heading
     
    283286   end
    284287end
     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
     295function [error,time,TimeUnit,mode,npx,npy,GeometryCalib]=read_imatext(fileinput)
     296%------------------------------------------------------------------------
     297error=0;%default
     298time=[]; %default
     299TimeUnit='s';
     300mode='pairs';
     301npx=[]; %default
     302npy=[]; %default
     303pxcmx=1;%default
     304pxcmy=1;%default
     305if exist(fileinput,'file')~=2, error=2, return;end;%input file does not exist
     306dotciv=textread(fileinput);
     307sizdot=size(dotciv);
     308if ~isequal(sizdot(1)-8,dotciv(1,1));
     309    error=1; %inconsistent number of bursts
     310end
     311nbfield=sizdot(1)-8;
     312npx=(dotciv(2,1));
     313npy=(dotciv(2,2));
     314pxcmx=(dotciv(6,1));% pixels/cm in the .civ file
     315pxcmy=(dotciv(6,2));
     316% nburst=dotciv(3,1); % nbre of bursts
     317abs_time1=dotciv([9:nbfield+8],2);
     318dtime=dotciv(5,1)*(dotciv([9:nbfield+8],[3:end-1])+1);
     319timeshift=[abs_time1 dtime];
     320time=cumsum(timeshift,2);
     321
     322GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];
     323GeometryCalib.Tx=0;
     324GeometryCalib.Ty=0;
     325GeometryCalib.Tz=1;
     326GeometryCalib.dpx=1;
     327GeometryCalib.dpy=1;
     328GeometryCalib.sx=1;
     329GeometryCalib.Cx=0;
     330GeometryCalib.Cy=0;
     331GeometryCalib.f=1;
     332GeometryCalib.kappa1=0;
     333GeometryCalib.CoordUnit='cm';
Note: See TracChangeset for help on using the changeset viewer.