1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/REC-html40/loose.dtd"> |
---|
3 | <html> |
---|
4 | <head> |
---|
5 | <title>Description of imadoc2struct</title> |
---|
6 | <meta name="keywords" content="imadoc2struct"> |
---|
7 | <meta name="description" content="'imadoc2struct': reads the xml file for image documentation"> |
---|
8 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
9 | <meta name="generator" content="m2html © 2003 Guillaume Flandin"> |
---|
10 | <meta name="robots" content="index, follow"> |
---|
11 | <link type="text/css" rel="stylesheet" href="../m2html.css"> |
---|
12 | </head> |
---|
13 | <body> |
---|
14 | <a name="_top"></a> |
---|
15 | <div><a href="../index.html">Home</a> > <a href="index.html">.</a> > imadoc2struct.m</div> |
---|
16 | |
---|
17 | <!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td> |
---|
18 | <td align="right"><a href="index.html">Index for . <img alt=">" border="0" src="../right.png"></a></td></tr></table>--> |
---|
19 | |
---|
20 | <h1>imadoc2struct |
---|
21 | </h1> |
---|
22 | |
---|
23 | <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
24 | <div class="box"><strong>'imadoc2struct': reads the xml file for image documentation</strong></div> |
---|
25 | |
---|
26 | <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
27 | <div class="box"><strong>function [s,errormsg]=imadoc2struct(ImaDoc) </strong></div> |
---|
28 | |
---|
29 | <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
30 | <div class="fragment"><pre class="comment">'imadoc2struct': reads the xml file for image documentation |
---|
31 | |
---|
32 | function [s,errormsg]=imadoc2struct(ImaDoc) |
---|
33 | -------------------------------------------------------- |
---|
34 | OUTPUT: |
---|
35 | s: structutre representing ImaDoc |
---|
36 | errormsg: error message |
---|
37 | |
---|
38 | INPUT: |
---|
39 | ImaDoc: full name of the xml input file with head key ImaDoc</pre></div> |
---|
40 | |
---|
41 | <!-- crossreference --> |
---|
42 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
43 | This function calls: |
---|
44 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
45 | </ul> |
---|
46 | This function is called by: |
---|
47 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
48 | <li><a href="RUN_STLIN.html" class="code" title="function RUN_STLIN(file_A,file_B,vel_type,file_st,nx_patch,ny_patch,thresh_patch,fileAxml,fileBxml)">RUN_STLIN</a> 'RUN_STLIN': combine velocity fields for stereo PIV</li><li><a href="civ.html" class="code" title="function varargout = civ(varargin)">civ</a> 'civ': function associated with the interface 'civ.fig' for PIV, spline interpolation and stereo PIV (patch)</li><li><a href="civ_3D.html" class="code" title="function varargout = civ_3D(varargin)">civ_3D</a> 'civ_3D': function associated with the interface 'civ_3D.fig' for PIV in volume</li><li><a href="series.html" class="code" title="function varargout = series(varargin)">series</a> 'series': master function associated to the GUI series.m for analysis field series</li><li><a href="set_grid.html" class="code" title="function varargout = set_grid(varargin)">set_grid</a> 'set_grid':produce grid for PIV with one or two images (stereo case)</li><li><a href="uvmat.html" class="code" title="function varargout = uvmat(varargin)">uvmat</a> 'uvmat': function associated with the GUI 'uvmat.fig' for images and data field visualization</li></ul> |
---|
49 | <!-- crossreference --> |
---|
50 | |
---|
51 | <h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
52 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
53 | <li><a href="#_sub1" class="code">function abs_time=get_time(BurstTiming)</a></li><li><a href="#_sub2" class="code">function tsai=get_GeometryCalib(s)</a></li></ul> |
---|
54 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
55 | <div class="fragment"><pre>0001 <span class="comment">%'imadoc2struct': reads the xml file for image documentation</span> |
---|
56 | 0002 <span class="comment">%</span> |
---|
57 | 0003 <span class="comment">%function [s,errormsg]=imadoc2struct(ImaDoc)</span> |
---|
58 | 0004 <span class="comment">%--------------------------------------------------------</span> |
---|
59 | 0005 <span class="comment">% OUTPUT:</span> |
---|
60 | 0006 <span class="comment">% s: structutre representing ImaDoc</span> |
---|
61 | 0007 <span class="comment">% errormsg: error message</span> |
---|
62 | 0008 <span class="comment">%</span> |
---|
63 | 0009 <span class="comment">% INPUT:</span> |
---|
64 | 0010 <span class="comment">% ImaDoc: full name of the xml input file with head key ImaDoc</span> |
---|
65 | 0011 |
---|
66 | 0012 <a name="_sub0" href="#_subfunctions" class="code">function [s,errormsg]=imadoc2struct(ImaDoc) </a> |
---|
67 | 0013 s=[]; |
---|
68 | 0014 errormsg=[];<span class="comment">%default</span> |
---|
69 | 0015 <span class="keyword">try</span> |
---|
70 | 0016 t=xmltree(ImaDoc); |
---|
71 | 0017 <span class="keyword">catch</span> |
---|
72 | 0018 errormsg={[ImaDoc <span class="string">' is not a valid xml file'</span>]; lasterr}; |
---|
73 | 0019 display(errormsg); |
---|
74 | 0020 <span class="keyword">return</span> |
---|
75 | 0021 <span class="keyword">end</span> |
---|
76 | 0022 RootKey=get(t,1,<span class="string">'name'</span>); |
---|
77 | 0023 <span class="keyword">if</span> ~isequal(RootKey,<span class="string">'ImaDoc'</span>) |
---|
78 | 0024 errormsg=[ImaDoc <span class="string">' is not an image documentation file'</span>]; |
---|
79 | 0025 <span class="keyword">return</span> |
---|
80 | 0026 <span class="keyword">end</span> |
---|
81 | 0027 s=convert(t); |
---|
82 | 0028 s.Time=[];<span class="comment">%default</span> |
---|
83 | 0029 <span class="keyword">if</span> isfield(s,<span class="string">'Camera'</span>) |
---|
84 | 0030 <span class="keyword">if</span> isfield(s.Camera,<span class="string">'BurstTiming'</span>) |
---|
85 | 0031 s.Time=<a href="#_sub1" class="code" title="subfunction abs_time=get_time(BurstTiming)">get_time</a>(s.Camera.BurstTiming); |
---|
86 | 0032 s.Camera=rmfield(s.Camera,<span class="string">'BurstTiming'</span>); |
---|
87 | 0033 <span class="keyword">end</span> |
---|
88 | 0034 <span class="keyword">end</span> |
---|
89 | 0035 <span class="keyword">if</span> isfield(s,<span class="string">'GeometryCalib'</span>) |
---|
90 | 0036 s.GeometryCalib=<a href="#_sub2" class="code" title="subfunction tsai=get_GeometryCalib(s)">get_GeometryCalib</a>(s.GeometryCalib); |
---|
91 | 0037 <span class="keyword">end</span> |
---|
92 | 0038 |
---|
93 | 0039 <span class="comment">%----------------------------------------</span> |
---|
94 | 0040 <a name="_sub1" href="#_subfunctions" class="code">function abs_time=get_time(BurstTiming)</a> |
---|
95 | 0041 abs_time=[]; |
---|
96 | 0042 <span class="keyword">for</span> k=1:length(BurstTiming) |
---|
97 | 0043 |
---|
98 | 0044 Frequency=1;<span class="comment">%default</span> |
---|
99 | 0045 <span class="keyword">if</span> isfield(BurstTiming,<span class="string">'FrameFrequency'</span>)&&~isempty(BurstTiming.FrameFrequency) |
---|
100 | 0046 Frequency=str2double(BurstTiming.FrameFrequency); |
---|
101 | 0047 <span class="keyword">end</span> |
---|
102 | 0048 |
---|
103 | 0049 Dtj=[];<span class="comment">%default</span> |
---|
104 | 0050 <span class="keyword">if</span> isfield(BurstTiming,<span class="string">'Dtj'</span>) |
---|
105 | 0051 Dtj=str2num(BurstTiming.Dtj); |
---|
106 | 0052 <span class="keyword">end</span> |
---|
107 | 0053 |
---|
108 | 0054 NbDtj=1;<span class="comment">%default</span> |
---|
109 | 0055 <span class="keyword">if</span> isfield(BurstTiming,<span class="string">'NbDtj'</span>)&&~isempty(BurstTiming.NbDtj) |
---|
110 | 0056 NbDtj=str2double(BurstTiming.NbDtj); |
---|
111 | 0057 <span class="keyword">end</span> |
---|
112 | 0058 Dti=[]; <span class="comment">%default</span> |
---|
113 | 0059 <span class="keyword">if</span> isfield(BurstTiming,<span class="string">'Dti'</span>) |
---|
114 | 0060 Dti=str2num(BurstTiming.Dti); |
---|
115 | 0061 <span class="keyword">end</span> |
---|
116 | 0062 |
---|
117 | 0063 NbDti=1;<span class="comment">%default</span> |
---|
118 | 0064 <span class="keyword">if</span> isfield(BurstTiming,<span class="string">'NbDti'</span>)&&~isempty(BurstTiming.NbDti) |
---|
119 | 0065 NbDti=str2double(BurstTiming.NbDti); |
---|
120 | 0066 <span class="keyword">end</span> |
---|
121 | 0067 <span class="keyword">if</span> ~isempty(Dtj) |
---|
122 | 0068 Dtj=reshape(Dtj'*ones(1,NbDtj),1,length(Dtj)*NbDtj); |
---|
123 | 0069 <span class="keyword">end</span> |
---|
124 | 0070 Dtj=[0 Dtj]; |
---|
125 | 0071 dtunit=Dtj/Frequency; |
---|
126 | 0072 Time=[];<span class="comment">%default</span> |
---|
127 | 0073 <span class="keyword">if</span> isfield(BurstTiming,<span class="string">'Time'</span>) && ~isempty(BurstTiming.Time) |
---|
128 | 0074 <span class="comment">%nbfield=length(BurstTiming.Time)</span> |
---|
129 | 0075 <span class="keyword">if</span> ischar(BurstTiming.Time) |
---|
130 | 0076 Time(1,1)=str2num(BurstTiming.Time); |
---|
131 | 0077 nbfield=1; |
---|
132 | 0078 <span class="keyword">else</span> |
---|
133 | 0079 nbfield=length(BurstTiming.Time); |
---|
134 | 0080 <span class="keyword">for</span> itime=1:nbfield |
---|
135 | 0081 Time(itime,1)=str2num(BurstTiming.Time{itime}); |
---|
136 | 0082 <span class="keyword">end</span> |
---|
137 | 0083 <span class="keyword">end</span> |
---|
138 | 0084 abstime_read=Time*ones(1,length(Dtj))+ones(nbfield,1)*cumsum(dtunit); |
---|
139 | 0085 abs_time=[abs_time;abstime_read]; |
---|
140 | 0086 <span class="keyword">if</span> ~isempty(Dti) && size(abs_time,1)==1 |
---|
141 | 0087 abs_time=ones(NbDti+1,1)*abs_time+(Dti/Frequency)*(0:NbDti)'*ones(size(abs_time)); |
---|
142 | 0088 <span class="keyword">end</span> |
---|
143 | 0089 <span class="keyword">end</span> |
---|
144 | 0090 <span class="keyword">end</span> |
---|
145 | 0091 |
---|
146 | 0092 <span class="comment">%----------------------------------------------------------------</span> |
---|
147 | 0093 <a name="_sub2" href="#_subfunctions" class="code">function tsai=get_GeometryCalib(s)</a> |
---|
148 | 0094 <span class="comment">%default values:</span> |
---|
149 | 0095 tsai.f=1; |
---|
150 | 0096 tsai.dpx=1; |
---|
151 | 0097 tsai.dpy=1; |
---|
152 | 0098 tsai.sx=1; |
---|
153 | 0099 tsai.Cx=0; |
---|
154 | 0100 tsai.Cy=0; |
---|
155 | 0101 tsai.Tx=0; |
---|
156 | 0102 tsai.Ty=0; |
---|
157 | 0103 tsai.Tz=1; |
---|
158 | 0104 tsai.R=[1 0 0; 0 1 0; 0 0 0]; |
---|
159 | 0105 tsai.kappa1=0; |
---|
160 | 0106 <span class="keyword">if</span> isfield(s,<span class="string">'focal'</span>) |
---|
161 | 0107 tsai.f=str2double(s.focal); |
---|
162 | 0108 <span class="keyword">end</span> |
---|
163 | 0109 <span class="keyword">if</span> isfield(s,<span class="string">'dpx_dpy'</span>) |
---|
164 | 0110 dpx_dpy=str2num(s.dpx_dpy); |
---|
165 | 0111 tsai.dpx=dpx_dpy(1); |
---|
166 | 0112 tsai.dpy=dpx_dpy(2); |
---|
167 | 0113 <span class="keyword">end</span> |
---|
168 | 0114 <span class="keyword">if</span> isfield(s,<span class="string">'sx'</span>) |
---|
169 | 0115 tsai.sx=str2double(s.sx); |
---|
170 | 0116 <span class="keyword">end</span> |
---|
171 | 0117 <span class="keyword">if</span> isfield(s,<span class="string">'Cx_Cy'</span>) |
---|
172 | 0118 Cx_Cy=str2num(s.Cx_Cy); |
---|
173 | 0119 tsai.Cx=Cx_Cy(1); |
---|
174 | 0120 tsai.Cy=Cx_Cy(2); |
---|
175 | 0121 <span class="keyword">end</span> |
---|
176 | 0122 <span class="keyword">if</span> isfield(s,<span class="string">'Tx_Ty_Tz'</span>) |
---|
177 | 0123 Tx_Ty_Tz=str2num(s.Tx_Ty_Tz); |
---|
178 | 0124 tsai.Tx=Tx_Ty_Tz(1); |
---|
179 | 0125 tsai.Ty=Tx_Ty_Tz(2); |
---|
180 | 0126 tsai.Tz=Tx_Ty_Tz(3); |
---|
181 | 0127 <span class="keyword">end</span> |
---|
182 | 0128 <span class="keyword">if</span> isfield(s,<span class="string">'R'</span>) |
---|
183 | 0129 tsai.R=[str2num(s.R{1});str2num(s.R{2});str2num(s.R{3})]; |
---|
184 | 0130 <span class="keyword">end</span> |
---|
185 | 0131 <span class="keyword">if</span> isfield(s,<span class="string">'kappa1'</span>) |
---|
186 | 0132 tsai.kappa1=str2double(s.kappa1); |
---|
187 | 0133 <span class="keyword">end</span> |
---|
188 | 0134 <span class="keyword">if</span> isfield(s,<span class="string">'SliceOrigin'</span>) |
---|
189 | 0135 <span class="keyword">if</span> ischar(s.SliceOrigin) |
---|
190 | 0136 tsai.SliceOrigin=str2num(s.SliceOrigin); |
---|
191 | 0137 <span class="keyword">end</span> |
---|
192 | 0138 <span class="keyword">end</span> |
---|
193 | 0139 <span class="keyword">if</span> isfield(s,<span class="string">'SliceDZ'</span>) |
---|
194 | 0140 <span class="comment">% SliceOrigin=0;</span> |
---|
195 | 0141 <span class="comment">% SliceOZ=1;%default</span> |
---|
196 | 0142 NbSlice=1;<span class="comment">%default</span> |
---|
197 | 0143 <span class="keyword">if</span> ischar(s.NbSlice) |
---|
198 | 0144 NbSlice=str2double(s.NbSlice); |
---|
199 | 0145 <span class="keyword">end</span> |
---|
200 | 0146 <span class="keyword">if</span> ischar(s.SliceOrigin) |
---|
201 | 0147 SliceOrigin=str2num(s.SliceOrigin); |
---|
202 | 0148 <span class="keyword">if</span> length(SliceOrigin)==3 |
---|
203 | 0149 tsai.SliceCoord(1,:)=SliceOrigin;<span class="comment">%to generalize for angles</span> |
---|
204 | 0150 <span class="keyword">end</span> |
---|
205 | 0151 <span class="keyword">end</span> |
---|
206 | 0152 <span class="keyword">if</span> ischar(s.SliceDZ) |
---|
207 | 0153 SliceOZ=str2double(s.SliceDZ); |
---|
208 | 0154 tsai.SliceCoord=tsai.SliceZ+SliceOZ*(0:NbSlice-1); |
---|
209 | 0155 <span class="keyword">end</span> |
---|
210 | 0156 <span class="keyword">if</span> iscell(s.SliceDZ) |
---|
211 | 0157 <span class="keyword">for</span> j=1:length(s.SliceDZ) |
---|
212 | 0158 tsai.SliceCoord(j,:)=tsai.SliceZ(j-1,:)+str2num(s.SliceDZ{j}); |
---|
213 | 0159 <span class="keyword">end</span> |
---|
214 | 0160 <span class="keyword">end</span> |
---|
215 | 0161 <span class="keyword">end</span> |
---|
216 | 0162 <span class="keyword">if</span> isfield(s,<span class="string">'PlanePos'</span>)<span class="comment">%Obsolete</span> |
---|
217 | 0163 <span class="keyword">if</span> ischar(s.PlanePos) |
---|
218 | 0164 tsai.SliceCoord(1,:)=str2num(s.PlanePos); |
---|
219 | 0165 <span class="keyword">else</span> |
---|
220 | 0166 <span class="keyword">for</span> j=1:length(s.PlanePos) |
---|
221 | 0167 PlanePos=str2num(s.PlanePos{j}); |
---|
222 | 0168 tsai.SliceCoord(j,:)=PlanePos; |
---|
223 | 0169 <span class="keyword">end</span> |
---|
224 | 0170 <span class="keyword">end</span> |
---|
225 | 0171 <span class="keyword">end</span> |
---|
226 | 0172 |
---|
227 | 0173 <span class="comment">%look for laser plane definitions</span> |
---|
228 | 0174 |
---|
229 | 0175 |
---|
230 | 0176 |
---|
231 | 0177</pre></div> |
---|
232 | <hr><address>Generated on Fri 13-Nov-2009 11:17:03 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address> |
---|
233 | </body> |
---|
234 | </html> |
---|