Changeset 46 for trunk/src/series.m
- Timestamp:
- Mar 15, 2010, 5:42:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r41 r46 1289 1289 1290 1290 %update the first and last times of the series 1291 if testupdate & isfield(SeriesData,'Time')1291 if testupdate && isfield(SeriesData,'Time') 1292 1292 if ~isempty(SeriesData.Time{1}) 1293 1293 displ_time(handles,SeriesData.Time{1}); … … 1304 1304 %hseries=get(handles.RUN,'parent'); 1305 1305 set(0,'CurrentFigure',handles.figure1) 1306 if isequal(get(handles.GetObject,'V alue'),1)1306 if isequal(get(handles.GetObject,'Visible'),'on') && isequal(get(handles.GetObject,'Value'),1) 1307 1307 Series.GetObject=1; 1308 1308 GetObject_Callback(hObject, eventdata, handles) … … 1311 1311 end 1312 1312 SeriesData=get(handles.figure1,'UserData'); 1313 % if isfield(SeriesData,'sethandles')1314 % if iscell(SeriesData.sethandles)1315 % Series.sethandles=SeriesData.sethandles{1};1316 % else1317 % Series.sethandles=SeriesData.sethandles;%retrieve the handles of the set_object interface (to define projection objects)1318 % end1319 % end1320 1313 1321 1314 %reinitiate waitbar position … … 1506 1499 Series.Action=action;%name of the processing programme 1507 1500 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1508 drawnow 1501 1509 1502 if length(RootPath)>1 1510 1503 h_fun(num_i1_cell,num_i2_cell,num_j1_cell,num_j2_cell,Series); … … 2083 2076 if value 2084 2077 set(handles.GetObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow 2085 DataInit.ParentButton=handles.GetObject;2078 % DataInit.ParentButton=handles.GetObject; 2086 2079 hset_object=findobj(allchild(0),'Name','set_object');%find the set_object interface handle 2087 2080 if ishandle(hset_object) 2088 [SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface 2081 uistack(hset_object,'top') 2082 %[SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface 2089 2083 else 2090 2084 %get the object file … … 2094 2088 '*.xml', '.xml files '; ... 2095 2089 '*.mat', '.mat matlab files '}, ... 2096 'Pick a file',defaultname{1});2090 'Pick an xml object file (or use uvmat to create it)',defaultname{1}); 2097 2091 fileinput=[PathName FileName];%complete file name 2098 2092 testblank=findstr(fileinput,' ');%look for blanks … … 2123 2117 end 2124 2118 else 2125 set(handles.GetObject,'BackgroundColor',[0 1 0])%put activated buttons to green2119 set(handles.GetObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green 2126 2120 % if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object) 2127 2121 % close(SeriesData.hset_object) … … 2217 2211 set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function 2218 2212 2219 2213 %------------------------------------------------------------- 2214 %generates a series of file names with reference numbers between range1 and 2215 %range2 with increment incr. The reference number num_ref is the image number at the middle of the 2216 %image pair. The set of first numbers num1 of the image pairs is also 2217 %given as output 2218 %------------------------------------------------------ 2219 function [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(filebase,subdir,mode,first_i,incr_i,last_i,first_j,incr_j,last_j) 2220 [Path,Name]=fileparts(filebase); 2221 filebasesub=fullfile(Path,subdir,Name); 2222 filecell={};%default 2223 num_i1=[]; 2224 num_i2=[]; 2225 num_j1=[]; 2226 num_j2=[]; 2227 ind0_i=first_i:incr_i:last_i; 2228 nbcolumn=length(ind0_i); 2229 ind0_j=first_j:incr_j:last_j; 2230 nbline=length(ind0_j); 2231 if isequal(mode,'#_ab') 2232 dirpair=dir([filebasesub '*_*.nc']); 2233 elseif isequal(mode,'bursts')|isequal(mode,'series(Dj)') 2234 dirpair=dir([filebasesub '_*_*-*.nc']); 2235 elseif isequal(mode,'series(Di)') 2236 dirpair=dir([filebasesub '_*-*_*.nc']); 2237 else 2238 errordlg('option *|* not yet implemented') 2239 return 2240 end 2241 if isempty(dirpair) 2242 errordlg('no pair detected in the selected range') 2243 return 2244 end 2245 %ind0_i=first_i:incr_i:last_i; 2246 %nbcolumn=length(ind0_i); 2247 %dirpair=dir([filebasesub '_*_*-*.nc']); 2248 if isequal(mode,'bursts')|isequal(mode,'#_ab') 2249 icount=0; 2250 for ifile=1:length(dirpair) 2251 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); 2252 2253 % if isempty(str2num(str_1)) 2254 % dirpair(ifile).name 2255 % end 2256 num1_r=str2num(str_1); 2257 if isequal(RootFile,Name) & ~isempty(num1_r) 2258 num_i1(ifile)=num1_r; 2259 num_a(ifile)=stra2num(str_a); 2260 num_b(ifile)=stra2num(str_b); 2261 % icount=icount+1; 2262 end 2263 end 2264 length(dirpair) 2265 % num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files 2266 test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range 2267 ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices 2268 select=find(test_range &(floor(ind_i)==ind_i));%selected indices of num_i1 in the file directory 2269 ind_i=ind_i(select);%set of selected indices ind_i 2270 [ind_i,indsort]=sort(ind_i);%sorted list of ind_i 2271 select=select(indsort); 2272 num_i1=num_i1(select); 2273 num_a=num_a(select); 2274 num_b=num_b(select); 2275 dirpair=dirpair(select); 2276 [ind_remove]=find_pairs(dirpair,ind_i,nbcolumn); 2277 ind_i(ind_remove)=[]; 2278 num_a(ind_remove)=[]; 2279 num_b(ind_remove)=[]; 2280 num_j1=zeros(1,nbcolumn);%default 2281 num_j2=num_j1; 2282 num_j1(ind_i)=num_a; 2283 num_j2(ind_i)=num_b; 2284 num_i1=first_i:incr_i:last_i; 2285 num_i2=num_i1; 2286 nbmissing=nbcolumn-length(ind_i); 2287 2288 elseif isequal(mode,'series(Di)') 2289 %ind0_i=first_i:incr_i:last_i; 2290 %nbcolumn=length(ind0_i); 2291 %ind0_j=first_j:incr_j:last_j; 2292 %nbline=length(ind0_j); 2293 %dirpair=dir([filebasesub '_*-*_*.nc']); 2294 for ifile=1:length(dirpair) 2295 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); 2296 num_i1_r(ifile)=str2num(str_1); 2297 num_i2_r(ifile)=str2num(str_2); 2298 num_j(ifile)=str2num(str_a); 2299 end 2300 num_i=floor((num_i1_r+num_i2_r)/2); %list of reference indices of the detected files 2301 test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range 2302 ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices 2303 ind_j=((num_j-first_j)/incr_j)+1; 2304 ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices 2305 select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory 2306 ind_ij=ind_ij(select);%set of selected indices ind_ij 2307 [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij 2308 select=select(indsort); 2309 num_i1_r=num_i1_r(select); 2310 num_i2_r=num_i2_r(select); 2311 % num_j=num_j(select); 2312 dirpair=dirpair(select); 2313 [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; 2314 ind_ij(ind_remove)=[]; 2315 num_i1_r(ind_remove)=[]; 2316 num_i2_r(ind_remove)=[]; 2317 num_i1=zeros(1,nbline*nbcolumn);%default 2318 num_i2=num_i1; 2319 num_i1(ind_ij)=num_i1_r; 2320 num_j2(ind_ij)=num_i2_r; 2321 num_i1=reshape(num_i1,nbline,nbcolumn); 2322 num_i2=reshape(num_i2,nbline,nbcolumn); 2323 num_j1=meshgrid(ind0_i,ind0_j); 2324 num_j2=num_j1; 2325 nbmissing=nbline*nbcolumn-length(ind_ij); 2326 elseif isequal(mode,'series(Dj)') 2327 % ind0_i=first_i:incr_i:last_i; 2328 % nbcolumn=length(ind0_i); 2329 % ind0_j=first_j:incr_j:last_j; 2330 % nbline=length(ind0_j); 2331 % dirpair=dir([filebasesub '_*_*-*.nc']); 2332 for ifile=1:length(dirpair) 2333 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); 2334 num_i(ifile)=str2num(str_1); 2335 num_a(ifile)=str2num(str_a); 2336 num_b(ifile)=str2num(str_b); 2337 end 2338 num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files 2339 test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range 2340 ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices 2341 ind_j=((num_j-first_j)/incr_j)+1; 2342 ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices 2343 select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory 2344 ind_ij=ind_ij(select);%set of selected indices ind_ij 2345 [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij 2346 select=select(indsort); 2347 num_i=num_i(select); 2348 num_a=num_a(select); 2349 num_b=num_b(select); 2350 dirpair=dirpair(select); 2351 [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; 2352 ind_ij(ind_remove)=[]; 2353 num_a(ind_remove)=[]; 2354 num_b(ind_remove)=[]; 2355 num_j1=zeros(1,nbline*nbcolumn);%default 2356 num_j2=num_j1; 2357 num_j1(ind_ij)=num_a; 2358 num_j2(ind_ij)=num_b; 2359 num_j1=reshape(num_j1,nbline,nbcolumn); 2360 num_j2=reshape(num_j2,nbline,nbcolumn); 2361 num_i1=meshgrid(ind0_i,ind0_j); 2362 num_i2=num_i1; 2363 nbmissing=nbline*nbcolumn-length(ind_ij); 2364 % for i=1:length(indsel);%A SUPPRIMER ULTERIEUREMENT 2365 % if indsel(i)==0 2366 % filecell{i}=''; 2367 % else 2368 % Name=dirpair(indsel(i)).name; 2369 % filecell{i}=fullfile(Path,subdir,Name); 2370 % end 2371 % end 2372 %else 2373 % errordlg('option *|* not yet implemented') 2374 % return 2375 end 2220 2376 2221 2377 function path_transform_Callback(hObject, eventdata, handles)
Note: See TracChangeset
for help on using the changeset viewer.