- Timestamp:
- Jun 4, 2012, 12:03:58 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r435 r437 24 24 %TODO: search range 25 25 26 % Last Modified by GUIDE v2.5 0 8-May-2012 22:14:3926 % Last Modified by GUIDE v2.5 03-Jun-2012 22:16:42 27 27 % Begin initialization code - DO NOT EDIT 28 28 gui_Singleton = 1; … … 271 271 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 272 272 RootPath=get(handles.RootPath,'String'); 273 SubdirImages=get(handles.SubdirImages,'String'); 273 274 RootFile=get(handles.RootFile,'String'); 274 275 ref_i=str2num(get(handles.ref_i,'String')); … … 276 277 NomType=get(handles.NomType,'String'); 277 278 ImaExt=get(handles.ImaExt,'String'); 278 fileinput=fullfile_uvmat(RootPath, '',RootFile,ImaExt,NomType,ref_i,[],ref_j);279 fileinput=fullfile_uvmat(RootPath,SubdirImages,RootFile,ImaExt,NomType,ref_i,[],ref_j); 279 280 errormsg=display_file_name(handles,fileinput); 280 281 if ~isempty(errormsg) … … 399 400 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 400 401 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 401 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomTypeIma,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]); 402 403 % [RootPath,FileName,ImaExt]=fileparts(fileinput); 404 % [RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object]=find_file_series(RootPath,[FileName ImaExt]); 405 % if strcmp(NomTypeInput,'*')% movies will be opened at the first frame 406 % i1=1; 407 % i2=[]; 408 % j1=[]; 409 % j2=[]; 410 % end 402 [RootPath,SubDir,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]); 403 411 404 switch FileType 412 405 case {'image','multimage','video','mmreader'} … … 415 408 return 416 409 end 417 % RootName=fullfile(RootPath,RootFile);418 410 set(handles.RootPath,'String',RootPath) 411 set(handles.SubdirImages,'String',SubDir) 419 412 set(handles.RootFile,'String',RootFile) 413 set(handles.SubdirCiv1,'String',[SubDir '.civ']) 420 414 browse=get(handles.RootPath,'UserData'); 421 % browse.nom_type_nc=NomTypeNc;422 415 browse.incr_pair=[0 0];%default 423 416 … … 643 636 644 637 %% update the selection for civ1 and civ2 645 if ~isempty(SubDir)% subdir for civ1 and civ2 initiated by the input646 SubdirCiv1=SubDir;647 SubdirCiv2=SubDir;648 set(handles.SubdirCiv1,'String',SubDir)649 set(handles.SubdirCiv2,'String',SubDir)650 else% currently selected subdir preserved651 SubdirCiv1=get(handles.SubdirCiv1,'String');652 SubdirCiv2=get(handles.SubdirCiv2,'String');653 if isempty(SubdirCiv1)% default subdir name='CIV'654 set(handles.SubdirCiv1,'String','CIV');655 SubdirCiv1='CIV';656 end657 if isempty(SubdirCiv2)% default subdir name='CIV'658 set(handles.SubdirCiv2,'String','CIV');659 SubdirCiv2='CIV';660 end661 end638 % if ~isempty(SubDir)% subdir for civ1 and civ2 initiated by the input 639 % SubdirCiv1=SubDir; 640 % SubdirCiv2=SubDir; 641 % set(handles.SubdirCiv1,'String',SubDir) 642 % set(handles.SubdirCiv2,'String',SubDir) 643 % else% currently selected subdir preserved 644 % SubdirCiv1=get(handles.SubdirCiv1,'String'); 645 % SubdirCiv2=get(handles.SubdirCiv2,'String'); 646 % if isempty(SubdirCiv1)% default subdir name='CIV' 647 % set(handles.SubdirCiv1,'String','CIV'); 648 % SubdirCiv1='CIV'; 649 % end 650 % if isempty(SubdirCiv2)% default subdir name='CIV' 651 % set(handles.SubdirCiv2,'String','CIV'); 652 % SubdirCiv2='CIV'; 653 % end 654 % end 662 655 663 656 %% update the subdirectory menus 664 ValueCiv1=find(strcmp(SubdirCiv1,listdir));%search the index of subdir in the cell listdir665 if isempty(ValueCiv1)% if the input subdir is not found666 ValueCiv1=numel(listdir)+1;%new subdirectory requested for civ1667 end668 ValueCiv2=find(strcmp(SubdirCiv2,listdir));%search the index of subdir in the cell listdir669 if isempty(ValueCiv2)% if the input subdir is not found670 ValueCiv2=numel(listdir)+1;%new subdirectory requested for civ2671 end672 set(handles.ListSubdirCiv1,'String',[listdir;'new...'])673 set(handles.ListSubdirCiv2,'String',[listdir;'new...'])674 set(handles.ListSubdirCiv1,'Value',ValueCiv1)675 set(handles.ListSubdirCiv2,'Value',ValueCiv2)676 if isempty(listdir)677 set(handles.SubdirCiv1,'String','CIV')678 set(handles.SubdirCiv2,'String','CIV')679 end657 % ValueCiv1=find(strcmp(SubdirCiv1,listdir));%search the index of subdir in the cell listdir 658 % if isempty(ValueCiv1)% if the input subdir is not found 659 % ValueCiv1=numel(listdir)+1;%new subdirectory requested for civ1 660 % end 661 % ValueCiv2=find(strcmp(SubdirCiv2,listdir));%search the index of subdir in the cell listdir 662 % if isempty(ValueCiv2)% if the input subdir is not found 663 % ValueCiv2=numel(listdir)+1;%new subdirectory requested for civ2 664 % end 665 % set(handles.ListSubdirCiv1,'String',[listdir;'new...']) 666 % set(handles.ListSubdirCiv2,'String',[listdir;'new...']) 667 % set(handles.ListSubdirCiv1,'Value',ValueCiv1) 668 % set(handles.ListSubdirCiv2,'Value',ValueCiv2) 669 % if isempty(listdir) 670 % set(handles.SubdirCiv1,'String','CIV') 671 % set(handles.SubdirCiv2,'String','CIV') 672 % end 680 673 681 674 %% store info … … 802 795 set(handles.PairIndices,'Visible','on') 803 796 set(handles.SubdirCiv1,'Visible','on') 804 set(handles.ListSubdirCiv1,'Visible','on')797 %set(handles.ListSubdirCiv1,'Visible','on') 805 798 set(handles.TitleSubdirCiv1,'Visible','on') 806 799 if ~opening … … 814 807 set(handles.TitleSubdirCiv2,'Visible','on') 815 808 set(handles.SubdirCiv2,'Visible','on') 816 set(handles.ListSubdirCiv2,'Visible','on')809 %set(handles.ListSubdirCiv2,'Visible','on') 817 810 set(handles.ListPairCiv2,'Visible','on') 818 811 if ~opening … … 825 818 set(handles.TitleSubdirCiv2,'Visible','off') 826 819 set(handles.SubdirCiv2,'Visible','off') 827 set(handles.ListSubdirCiv2,'Visible','off')820 % set(handles.ListSubdirCiv2,'Visible','off') 828 821 set(handles.ListPairCiv2,'Visible','off') 829 822 end … … 1216 1209 return 1217 1210 end 1218 [filecell,i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2,nom_type_nc, xx,yy,compare]=...1211 [filecell,i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2,nom_type_nc,tild,tild,compare,errormsg]=... 1219 1212 set_civ_filenames(handles,ref_i,ref_j,box_test); 1220 1213 if ~isempty(errormsg) 1214 return 1215 end 1216 % if isempty(filecell)% (error message displayed in fct set_civ_filenames) 1217 % return 1218 % end 1221 1219 Rootbat=fileparts(filecell.nc.civ1{1,1});%output netcdf file (without extention) 1222 1220 set(handles.civ,'UserData',filecell);%store for futur use of status callback 1223 if isempty(filecell)% (error message displayed in fct set_civ_filenames)1224 return1225 end1226 1221 nbfield=numel(i1_civ1); 1227 1222 nbslice=numel(j1_civ1); … … 1283 1278 Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);% 1284 1279 end 1285 if strcmp(Param.Civ1.FileTypeA,'video')|| strcmp(Param.Civ1.FileTypeA,'mmreader')1280 if isfield(Param.Civ1,'FileTypeA')&&(strcmp(Param.Civ1.FileTypeA,'video')|| strcmp(Param.Civ1.FileTypeA,'mmreader')) 1286 1281 % ImageInfo=get(VideoReader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt]))); 1287 1282 ImageInfo=get(Param.Civ1.ImageA); … … 1296 1291 Param.Civ1.ImageA=filecell.ima1.civ1{ifile,j}; 1297 1292 Param.Civ1.ImageB=filecell.ima2.civ1{ifile,j}; 1298 form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats1293 % form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats 1299 1294 ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size 1300 1295 Param.Civ1.ImageBitDepth=ImageInfo.BitDepth; 1301 1296 end 1302 1303 1297 Param.Civ1.ImageWidth=ImageInfo.Width; 1304 1298 Param.Civ1.ImageHeight=ImageInfo.Height; … … 1434 1428 end 1435 1429 if Param.CheckCiv2==1 1436 if strcmp(Param.Civ2.FileTypeA,'video')|| strcmp(Param.Civ2.FileTypeA,'mmreader')1430 if isfield(Param.Civ2,'FileTypeA') &&(strcmp(Param.Civ2.FileTypeA,'video')|| strcmp(Param.Civ2.FileTypeA,'mmreader')) 1437 1431 % ImageInfo=get(VideoReader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt]))); 1438 1432 ImageInfo=get(Param.Civ2.ImageA); … … 1848 1842 Param=rmfield(Param,'xml'); 1849 1843 t=struct2xml(Param); 1850 t=set(t,1,' Name','CivDoc');% set the head label1851 save(t,[namedoc '. CivDoc.xml']); %save GUI parameters as xml file1844 t=set(t,1,'name','Civ');% set the head label 1845 save(t,[namedoc '.civ.xml']); %save GUI parameters as xml file 1852 1846 saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 1853 1847 … … 1912 1906 % .nc.civ1,.nc.civ2: netcdf files containing civ1 and civ2 data respectively (possibly different) 1913 1907 % i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2: arrays of files indices, needed for timing records 1914 function [filecell,i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2,NomType_nc,file_ref_fix1,file_ref_fix2,compare ]=...1908 function [filecell,i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2,NomType_nc,file_ref_fix1,file_ref_fix2,compare,errormsg]=... 1915 1909 set_civ_filenames(handles,ref_i,ref_j,checkbox) 1916 1910 %------------------------------------------------------------------------ 1917 1911 filecell=[];%default 1912 errormsg=''; 1918 1913 ListProgram=get(handles.ListProgram,'String'); 1919 1914 CivMode=ListProgram{get(handles.ListProgram,'Value')};%Program to use , CivX or Matlab … … 1921 1916 %% get the root name and check dir 1922 1917 RootPath=get(handles.RootPath,'String'); 1918 SubdirImages=get(handles.SubdirImages,'String'); 1923 1919 RootFile=get(handles.RootFile,'String'); 1924 filecell.filebase=fullfile(RootPath, RootFile);1920 filecell.filebase=fullfile(RootPath,SubdirImages,RootFile); 1925 1921 if isempty(filecell.filebase) 1926 msgbox_uvmat('ERROR','please open an image with the upper menu option Open/Browse...')1922 errormsg='please open an image with the upper menu option Open/Browse...'; 1927 1923 return 1928 1924 end 1929 1925 if ~exist(RootPath,'dir') 1930 msgbox_uvmat('ERROR',['path to images ' RootPath ' not found'])1926 errormsg=['path to images ' RootPath ' not found']; 1931 1927 return 1932 1928 end 1933 1929 [tild,message]=fileattrib(RootPath); 1934 1930 if ~isempty(message) && ~isequal(message.UserWrite,1) 1935 msgbox_uvmat('ERROR',['No writting access to ' RootPath])1931 errormsg=['No writting access to ' RootPath]; 1936 1932 return 1937 1933 end … … 2061 2057 file_ref_fix1(ifile,j)={file_ref}; 2062 2058 if ~exist(file_ref,'file') 2063 msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix1']) 2064 filecell=[]; 2059 errormsg=['reference file ' file_ref ' not found for fix1']; 2065 2060 return 2066 2061 end … … 2113 2108 file_ref_fix2(ifile,j)={file_ref}; 2114 2109 if ~exist(file_ref,'file') 2115 msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix2']) 2116 filecell={}; 2110 errormsg=['reference file ' file_ref ' not found for fix2']; 2117 2111 return 2118 2112 end … … 2155 2149 if ~exist(fullfile(RootPath,subdir_civ1_new),'dir') 2156 2150 [xx,msg1]=mkdir(fullfile(RootPath,subdir_civ1_new)); 2157 2158 2151 if ~strcmp(msg1,'') 2159 msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1])%error message for directory creation 2160 filecell={}; 2152 errormsg=['cannot create ' subdir_civ1_new ': ' msg1];%error message for directory creation 2161 2153 return 2162 2154 elseif isunix 2163 2155 [xx,msg2] = fileattrib(fullfile(RootPath,subdir_civ1_new),'+w','g'); %yield writing access (+w) to user group (g) 2164 2156 if ~strcmp(msg2,'') 2165 msgbox_uvmat('ERROR',['pb of permission for ' fullfile(RootPath,subdir_civ1_new) ': ' msg2])%error message for directory creation 2166 filecell={}; 2157 errormsg=['pb of permission for ' fullfile(RootPath,subdir_civ1_new) ': ' msg2];%error message for directory creation 2167 2158 return 2168 2159 end … … 2197 2188 [xx,msg1]=mkdir(fullfile(RootPath,subdir_civ1_new)); 2198 2189 if ~strcmp(msg1,'') 2199 msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1]) 2200 filecell={}; 2190 errormsg=['cannot create ' subdir_civ1_new ': ' msg1]; 2201 2191 return 2202 2192 else 2203 2193 [xx,msg2] = fileattrib(fullfile(RootPath,subdir_civ1_new),'+w','g'); %yield writing access (+w) to user group (g) 2204 2194 if ~strcmp(msg2,'') 2205 msgbox_uvmat('ERROR',['pb of permission for ' subdir_civ1_new ': ' msg2])%error message for directory creation 2206 filecell={}; 2195 errormsg=['pb of permission for ' subdir_civ1_new ': ' msg2];%error message for directory creation 2207 2196 return 2208 2197 end … … 2215 2204 for ifile=1:nbfield 2216 2205 for j=1:nbslice 2217 filename=fullfile_uvmat(RootPath, '',RootFile_ima1,ext_ima,NomType_ima1,i1_civ1(ifile),[],j1_civ1(j));2206 filename=fullfile_uvmat(RootPath,SubdirImages,RootFile_ima1,ext_ima,NomType_ima1,i1_civ1(ifile),[],j1_civ1(j)); 2218 2207 idetect(j)=exist(filename,'file')==2; 2219 2208 filecell.ima1.civ1(ifile,j)={filename}; %first image 2220 filename=fullfile_uvmat(RootPath, '',RootFile_ima2,ext_ima,NomType_ima2,i2_civ1(ifile),[],j2_civ1(j));2209 filename=fullfile_uvmat(RootPath,SubdirImages,RootFile_ima2,ext_ima,NomType_ima2,i2_civ1(ifile),[],j2_civ1(j)); 2221 2210 idetect_1(j)=exist(filename,'file')==2; 2222 2211 filecell.ima2.civ1(ifile,j)={filename};%second image … … 2224 2213 [idetectmin,indexj]=min(idetect); 2225 2214 if idetectmin==0, 2226 msgbox_uvmat('ERROR',[filecell.ima1.civ1{ifile,indexj} ' not found']) 2227 filecell={}; 2215 errormsg=[filecell.ima1.civ1{ifile,indexj} ' not found']; 2228 2216 return 2229 2217 end 2230 2218 [idetectmin,indexj]=min(idetect_1); 2231 2219 if idetectmin==0, 2232 msgbox_uvmat('ERROR',[filecell.ima2.civ1{ifile,indexj} ' not found']) 2233 filecell={}; 2220 errormsg=[filecell.ima2.civ1{ifile,indexj} ' not found']; 2234 2221 return 2235 2222 end … … 2247 2234 [idetectmin,indexj]=min(idetect); 2248 2235 if idetectmin==0, 2249 msgbox_uvmat('ERROR',[filecell.imaA1.civ1{ifile,indexj} ' not found']) 2250 filecell={}; 2251 % cd(currentdir) 2236 errormsg=[filecell.imaA1.civ1{ifile,indexj} ' not found']; 2252 2237 return 2253 2238 end 2254 2239 [idetectmin,indexj]=min(idetect_1); 2255 2240 if idetectmin==0, 2256 msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found']) 2257 filecell={}; 2258 % cd(currentdir) 2241 errormsg=[filecell.imaA2.civ1{ifile,indexj} ' not found']; 2259 2242 return 2260 2243 end … … 2269 2252 detect=exist(filename,'file')==2; 2270 2253 if detect==0 2271 msgbox_uvmat('ERROR',[filename ' not found']) 2272 filecell={}; 2273 % cd(currentdir) 2254 errormsg=[filename ' not found']; 2274 2255 return 2275 2256 end … … 2283 2264 filecell.ncA.civ1(ifile,j)={filename}; 2284 2265 if ~exist(filename,'file') 2285 msgbox_uvmat('ERROR',['input file ' filename ' not found']) 2286 set(handles.RUN, 'Enable','On') 2287 set(handles.RUN,'BackgroundColor',[1 0 0]) 2288 filecell={}; 2289 %cd(currentdir) 2266 errormsg=['input file ' filename ' not found']; 2290 2267 return 2291 2268 end … … 2330 2307 [xx,msg2] = fileattrib(fullfile(RootPath,subdir_civ2_new),'+w','g'); %yield writing access (+w) to user group (g) 2331 2308 if ~isequal(m2,'') 2332 msgbox_uvmat('ERROR',['cannot create ' fullfile(RootPath,subdir_civ2_new) ': ' m2]) 2333 filecell={}; 2309 errormsg=['cannot create ' fullfile(RootPath,subdir_civ2_new) ': ' m2]; 2334 2310 return 2335 2311 end … … 2363 2339 [xx,msg2] = fileattrib(fullfile(RootPath,subdir_civ2_new),'+w','g'); %yield writing access (+w) to user group (g) 2364 2340 if ~isequal(m2,'') 2365 msgbox_uvmat('ERROR', ['cannot create ' fullfile(RootPath,subdir_civ2_new) ': ' m2])%error message for directory creation 2366 % cd(currentdir) 2367 filecell={}; 2341 errormsg= ['cannot create ' fullfile(RootPath,subdir_civ2_new) ': ' m2];%error message for directory creation 2368 2342 return 2369 2343 end … … 2373 2347 subdir_civ2=subdir_civ2_new; 2374 2348 end 2375 %cd(currentdir);%come back to the current working directory2376 2349 2377 2350 %%%%%%%%%%%%% if checkciv2 results are obtained or used %%%%%%%%%%%%% … … 2384 2357 filecell.nc.civ1(ifile,j)={filename};% name of the civ1 file 2385 2358 if ~exist(filename,'file') 2386 msgbox_uvmat('ERROR',['input file ' filename ' not found']) 2387 filecell={}; 2359 errormsg=['input file ' filename ' not found']; 2388 2360 return 2389 2361 end … … 2392 2364 Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2'); 2393 2365 if isfield(Data,'Txt') 2394 msgbox_uvmat('ERROR',Data.Txt);2366 errormsg=Data.Txt; 2395 2367 return 2396 2368 elseif ~isempty(Data.CivStage)% case of new civ files 2397 2369 if Data.CivStage<4 %test for civ files 2398 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 2399 filecell=[]; 2370 errormsg=['no civ2 data in ' filename]; 2400 2371 return 2401 2372 end 2402 2373 elseif isempty(Data.civ2)||isequal(Data.civ2,0) 2403 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 2404 filecell=[]; 2374 errormsg=['no civ2 data in ' filename]; 2405 2375 return 2406 2376 end 2407 2377 elseif checkbox(3)==0; %check the existence of patch if it is not calculated 2408 2378 Data=nc2struct(filename,'ListGlobalAttribute','CivStage','patch'); 2409 if ~isempty(Data.CivStage) 2379 if isfield(Data,'Txt') 2380 errormsg=Data.Txt; 2381 return 2382 elseif ~isempty(Data.CivStage) 2410 2383 if Data.CivStage<3 %test for civ files 2411 msgbox_uvmat('ERROR',['no patch data in ' filename]) 2412 filecell=[]; 2384 errormsg=['no patch data in ' filename]; 2413 2385 return 2414 2386 end 2415 2387 elseif isempty(Data.patch)||isequal(Data.patch,0) 2416 msgbox_uvmat('ERROR',['no patch data in ' filename]) 2417 filecell=[]; 2388 errormsg=['no patch data in ' filename]; 2418 2389 return 2419 2390 end … … 2428 2399 filecell.ncA.civ2(ifile,j)={filename}; 2429 2400 if ~exist(filename,'file') 2430 msgbox_uvmat('ERROR',['input file ' filename ' not found']) 2431 set(handles.RUN, 'Enable','On') 2432 set(handles.RUN,'BackgroundColor',[1 0 0]) 2401 errormsg=['input file ' filename ' not found']; 2433 2402 return 2434 2403 end … … 2459 2428 [idetectmin,indexj]=min(idetect_2); 2460 2429 if idetectmin==0, 2461 msgbox_uvmat('ERROR',['input image ' filecell.ima1.civ2{ifile,indexj} ' not found']) 2462 filecell=[]; 2430 errormsg=['input image ' filecell.ima1.civ2{ifile,indexj} ' not found']; 2463 2431 return 2464 2432 end … … 2478 2446 [idetectmin,indexj]=min(idetect_3); 2479 2447 if idetectmin==0, 2480 msgbox_uvmat('ERROR',['input image ' filecell.ima2.civ2{ifile,indexj} ' not found']) 2481 filecell=[]; 2448 errormsg=['input image ' filecell.ima2.civ2{ifile,indexj} ' not found']; 2482 2449 return 2483 2450 end … … 2494 2461 filecell.nc.civ2(ifile,j)={filename}; 2495 2462 if ~exist(filename,'file') 2496 msgbox_uvmat('ERROR',['input file ' filename ' not found']) 2497 filecell=[]; 2463 errormsg=['input file ' filename ' not found']; 2498 2464 return 2499 2465 else 2500 2466 Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2'); 2501 2467 if ~isempty(Data.CivStage) && Data.CivStage<4 %test for civ files 2502 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 2503 filecell=[]; 2468 errormsg=['no civ2 data in ' filename]; 2504 2469 return 2505 2470 elseif isempty(Data.civ2)||isequal(Data.civ2,0) 2506 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 2507 filecell=[]; 2471 errormsg=['no civ2 data in ' filename]; 2508 2472 return 2509 2473 end … … 3316 3280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3317 3281 %------------------------------------------------------------------------ 3318 % --- Executes on button press in SearchRange: determine the search range num_Search x,num_Searchy3282 % --- Executes on button press in SearchRange: determine the search range num_SearchBoxSize_1,num_SearchBoxSize_2 3319 3283 function SearchRange_Callback(hObject, eventdata, handles) 3320 3284 %------------------------------------------------------------------------ … … 3338 3302 3339 3303 %------------------------------------------------------------------------ 3340 % --- determine the search range num_Search x,num_Searchyand shift3304 % --- determine the search range num_SearchBoxSize_1,num_SearchBoxSize_2 and shift 3341 3305 function get_search_range(hObject, eventdata, handles) 3342 3306 %------------------------------------------------------------------------ … … 3394 3358 end 3395 3359 dt=time(num2+1,num_b+1)-time(num1+1,num_a+1); 3396 ibx=str2double(get(handles.num_ Bx,'String'));3397 iby=str2double(get(handles.num_ By,'String'));3360 ibx=str2double(get(handles.num_CorrBoxSize_1,'String')); 3361 iby=str2double(get(handles.num_CorrBoxSize_2,'String')); 3398 3362 umin=dt*pxcm*umin; 3399 3363 umax=dt*pxcm*umax; … … 3406 3370 isy=(vmax+2-shifty)*2+param_civ1.Bx; 3407 3371 isy=2*ceil(isy/2)+1; 3408 set(handles.num_S hiftx,'String',num2str(shiftx));3409 set(handles.num_S hifty,'String',num2str(shifty));3410 set(handles.num_Search x,'String',num2str(isx));3411 set(handles.num_Search y,'String',num2str(isy));3372 set(handles.num_SearchBoxShift_1,'String',num2str(shiftx)); 3373 set(handles.num_SearchBoxShift_2,'String',num2str(shifty)); 3374 set(handles.num_SearchBoxSize_1,'String',num2str(isx)); 3375 set(handles.num_SearchBoxSize_2,'String',num2str(isy)); 3412 3376 end 3413 3377 … … 3981 3945 if isequal(get(hObject,'Value'),0) 3982 3946 set(handles.num_SubdomainSize,'Visible','on') 3983 set(handles.num_ SmoothingParam,'Visible','on')3947 set(handles.num_FieldSmooth,'Visible','on') 3984 3948 else 3985 3949 set(handles.num_SubdomainSize,'Visible','off') 3986 set(handles.num_ SmoothingParam,'Visible','off')3950 set(handles.num_FieldSmooth,'Visible','off') 3987 3951 end 3988 3952 … … 3993 3957 % if isequal(get(handles.CheckStereo,'Value'),0) 3994 3958 % set(handles.num_SubdomainSize,'Visible','on') 3995 % set(handles.num_ SmoothingParam,'Visible','on')3959 % set(handles.num_FieldSmooth,'Visible','on') 3996 3960 % else 3997 3961 % set(handles.num_SubdomainSize,'Visible','off') 3998 % set(handles.num_ SmoothingParam,'Visible','off')3962 % set(handles.num_FieldSmooth,'Visible','off') 3999 3963 % end 4000 3964 … … 4013 3977 ref_j=1;%default j index 4014 3978 end 4015 [filecell,i1,i2,j1,j2,i1_civ2,i2_civ2,j1_civ2,j2_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... 4016 set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);% get the corresponding file name and indices 3979 [filecell,i1,i2]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);% get the corresponding file name and indices 4017 3980 Data.ListVarName={'ny','nx','A'}; 4018 3981 Data.VarDimName= {'ny','nx',{'ny','nx'}}; … … 4114 4077 end 4115 4078 fprintf(fid, ['ImageSize ' num2str(Param.Civ1.ImageWidth) ' ' num2str(Param.Civ1.ImageHeight) '\n' ]); %VERIFIER CAS GENERAL ? 4116 fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ1. Bx) ' ' num2str(Param.Civ1.By) '\n' ]);4117 fprintf(fid, ['SearchBoxeSize ' num2str(Param.Civ1.Search x) ' ' num2str(Param.Civ1.Searchy) '\n' ]);4118 fprintf(fid, ['RO ' num2str(Param.Civ1. Rho) '\n' ]);4079 fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ1.CorrBoxSize(1)) ' ' num2str(Param.Civ1.CorrBoxSize(2)) '\n' ]); 4080 fprintf(fid, ['SearchBoxeSize ' num2str(Param.Civ1.SearchBoxSize(1)) ' ' num2str(Param.Civ1.SearchBoxSize(2)) '\n' ]); 4081 fprintf(fid, ['RO ' num2str(Param.Civ1.CorrSmooth) '\n' ]); 4119 4082 if isfield(Param.Civ1,'Grid') 4120 4083 fprintf(fid, ['GridSpacing ' '25' ' ' '25' '\n' ]); … … 4126 4089 fprintf(fid, ['PixCmXY ' '1' ' ' '1' '\n' ]); 4127 4090 fprintf(fid, ['XX 1' '\n' ]); 4128 fprintf(fid, ['ShiftXY ' num2str(Param.Civ1.S hiftx) ' ' num2str(Param.Civ1.Shifty) '\n' ]);4091 fprintf(fid, ['ShiftXY ' num2str(Param.Civ1.SearchBoxShift(1)) ' ' num2str(Param.Civ1.SearchBoxShift(2)) '\n' ]); 4129 4092 if isfield(Param.Civ1,'Grid') 4130 4093 fprintf(fid, ['Grid ' 'y' '\n' ]); … … 4203 4166 cmd=[Param.xml.PatchBin... 4204 4167 ' -f ' filename '.nc -m ' num2str(Param.(patchname).Nx)... 4205 ' -n ' num2str(Param.(patchname).Ny) ' -ro ' num2str(Param.(patchname). SmoothingParam)...4168 ' -n ' num2str(Param.(patchname).Ny) ' -ro ' num2str(Param.(patchname).FieldSmooth)... 4206 4169 ' -nopt ' num2str(Param.(patchname).SubdomainSize) ... 4207 4170 ' > ' filename '.' lower(patchname) '.log 2>&1']; % redirect standard output to the log file … … 4209 4172 cmd=['"' Param.xml.PatchBin... 4210 4173 '" -f "' filename '.nc" -m ' num2str(Param.(patchname).Nx)... 4211 ' -n ' num2str(Param.(patchname).Ny) ' -ro ' num2str(Param.(patchname). SmoothingParam)...4174 ' -n ' num2str(Param.(patchname).Ny) ' -ro ' num2str(Param.(patchname).FieldSmooth)... 4212 4175 ' -nopt ' num2str(Param.(patchname).SubdomainSize)... 4213 4176 ' > "' filename '.' lower(patchname) '.log" 2>&1']; % redirect standard output to the log file … … 4247 4210 fprintf(fid, ['ImageSize ' num2str(Param.Civ2.ImageWidth) ' ' num2str(Param.Civ2.ImageHeight) '\n' ]); 4248 4211 % fprintf(fid, ['ImageSize ' num2str(Param.Civ2.npx) ' ' num2str(Param.Civ2.npy) '\n' ]); %VERIFIER CAS GENERAL ? 4249 fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ2. Bx) ' ' num2str(Param.Civ2.By) '\n' ]);4250 fprintf(fid, ['SearchBoxeSize ' num2str(Param.Civ2. Bx) ' ' num2str(Param.Civ2.By) '\n']);4251 fprintf(fid, ['RO ' num2str(Param.Civ2. Rho) '\n']);4212 fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ2.CorrBoxSize(1)) ' ' num2str(Param.Civ2.CorrBoxSize(2)) '\n' ]); 4213 fprintf(fid, ['SearchBoxeSize ' num2str(Param.Civ2.CorrBoxSize(1)) ' ' num2str(Param.Civ2.CorrBoxSize(2)) '\n']); 4214 fprintf(fid, ['RO ' num2str(Param.Civ2.CorrSmooth) '\n']); 4252 4215 if isfield(Param.Civ2,'Grid') 4253 4216 fprintf(fid, ['GridSpacing ' '25' ' ' '25' '\n' ]); … … 4406 4369 ref_j=1;%default 4407 4370 end 4408 [filecell,i1,i21,j1,j2,i1_civ2,i2_civ2,j1_civ2,j2_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... 4409 set_civ_filenames(handles,ref_i,ref_j,[0 0 1 0 0 0]); 4410 4371 filecell=set_civ_filenames(handles,ref_i,ref_j,[0 0 1 0 0 0]); 4411 4372 Data.ListVarName={'ny','nx','A'}; 4412 Data.VarDimName= {'ny','nx',{'ny','nx'}}; 4413 4373 Data.VarDimName= {'ny','nx',{'ny','nx'}}; 4414 4374 param_patch1=read_GUI(handles.Patch1); 4415 4375 param_patch1.CivFile=filecell.nc.civ1{1}; … … 4421 4381 return 4422 4382 end 4423 SmoothingParam(irho)=Param.Patch1. SmoothingParam;4383 SmoothingParam(irho)=Param.Patch1.FieldSmooth; 4424 4384 Data.Civ1_U_Diff=Data.Civ1_U_Diff(Data.Civ1_FF==0); 4425 4385 Data.Civ1_V_Diff=Data.Civ1_V_Diff(Data.Civ1_FF==0); 4426 4386 DiffVel(irho)=sqrt(mean(Data.Civ1_U_Diff.*Data.Civ1_U_Diff+Data.Civ1_V_Diff.*Data.Civ1_V_Diff)) 4427 4387 NbSites(irho,:)=Data.Civ1_NbSites*numel(Data.Civ1_NbSites)/numel(Data.Civ1_U_Diff); 4428 Param.Patch1.SmoothingParam=2*Param.Patch1. SmoothingParam;4388 Param.Patch1.SmoothingParam=2*Param.Patch1.FieldSmooth; 4429 4389 end 4430 4390 figure … … 4528 4488 set(handles.title_Ny,'Visible','on') 4529 4489 set(handles.title_MaxDiff,'Visible','off') 4530 set(handles.num_ Rho,'Style','edit')4531 set(handles.num_ Rho,'String','1')4490 set(handles.num_CorrSmooth,'Style','edit') 4491 set(handles.num_CorrSmooth,'String','1') 4532 4492 set(handles.BATCH,'Enable','on') 4533 4493 set(handles.CheckThreshold,'Visible','off') … … 4543 4503 set(handles.title_Nx,'Visible','off') 4544 4504 set(handles.title_Ny,'Visible','off') 4545 set(handles.num_ Rho,'Style','popupmenu')4546 set(handles.num_ Rho,'Value',1)4547 set(handles.num_ Rho,'String',{'1';'2'})4505 set(handles.num_CorrSmooth,'Style','popupmenu') 4506 set(handles.num_CorrSmooth,'Value',1) 4507 set(handles.num_CorrSmooth,'String',{'1';'2'}) 4548 4508 set(handles.CheckThreshold,'Visible','on') 4549 4509 set(handles.CheckDeformation,'Value',0)% desactivate (work in progress) … … 4558 4518 4559 4519 function RootFile_Callback(hObject, eventdata, handles) 4520 4521 4522 4523 function SubdirImages_Callback(hObject, eventdata, handles) -
trunk/src/civ_matlab.m
r435 r437 209 209 210 210 Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Patch1_Rho','Patch1_Threshold','Patch1_SubDomain'}]; 211 Data.Patch1_Rho=Param.Patch1. SmoothingParam;211 Data.Patch1_Rho=Param.Patch1.FieldSmooth; 212 212 Data.Patch1_Threshold=Param.Patch1.MaxDiff; 213 213 Data.Patch1_SubDomain=Param.Patch1.SubdomainSize; … … 263 263 par_civ2.ImageB=par_civ1.ImageB; 264 264 end 265 ibx2=ceil(par_civ2. Bx/2);266 iby2=ceil(par_civ2. By/2);265 ibx2=ceil(par_civ2.CorrBoxSize(1)/2); 266 iby2=ceil(par_civ2.CorrBoxSize(2)/2); 267 267 isx2=ibx2+4;% search ara +-4 pixels around the guess 268 268 isy2=iby2+4; … … 308 308 mask=imread(par_civ2.Mask); 309 309 end 310 par_civ2.Search x=2*isx2+1;311 par_civ2.Search y=2*isy2+1;312 par_civ2.S hiftx=Shiftx(nbval>=1)./nbval(nbval>=1);313 par_civ2.Shifty=Shifty(nbval>=1)./nbval(nbval>=1);314 par_civ2.Grid=[GridX(nbval>=1)-par_civ2.S hiftx/2 GridY(nbval>=1)-par_civ2.Shifty/2];% grid taken at the extrapolated origin of the displacement vectors310 par_civ2.SearchBoxSize(1)=2*isx2+1; 311 par_civ2.SearchBoxSize(2)=2*isy2+1; 312 par_civ2.SearchBoxShift=[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)]; 313 % par_civ2.SearchBoxShift(2)=Shifty(nbval>=1)./nbval(nbval>=1); 314 par_civ2.Grid=[GridX(nbval>=1)-par_civ2.SearchBoxShift(:,1)/2 GridY(nbval>=1)-par_civ2.SearchBoxShift(:,2)/2];% grid taken at the extrapolated origin of the displacement vectors 315 315 if par_civ2.CheckDeformation 316 316 par_civ2.DUDX=DUDX./nbval; … … 392 392 if isfield (Param,'Patch2') 393 393 Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Patch2_Rho','Patch2_Threshold','Patch2_SubDomain'}]; 394 Data.Patch2_Rho=Param.Patch2. SmoothingParam;394 Data.Patch2_Rho=Param.Patch2.FieldSmooth; 395 395 Data.Patch2_Threshold=Param.Patch2.MaxDiff; 396 396 Data.Patch2_SubDomain=Param.Patch2.SubdomainSize; … … 454 454 455 455 %% prepare grid 456 ibx2=ceil(par_civ. Bx/2);457 iby2=ceil(par_civ. By/2);458 isx2=ceil(par_civ.Search x/2);459 isy2=ceil(par_civ.Search y/2);460 shiftx=round(par_civ.S hiftx);461 shifty=-round(par_civ.S hifty);% sign minus because image j index increases when y decreases456 ibx2=ceil(par_civ.CorrBoxSize(1)/2); 457 iby2=ceil(par_civ.CorrBoxSize(2)/2); 458 isx2=ceil(par_civ.SearchBoxSize(1)/2); 459 isy2=ceil(par_civ.SearchBoxSize(2)/2); 460 shiftx=round(par_civ.SearchBoxShift(:,1)); 461 shifty=-round(par_civ.SearchBoxShift(:,2));% sign minus because image j index increases when y decreases 462 462 if isfield(par_civ,'Grid') 463 463 if ischar(par_civ.Grid)%read the drid file if the input is a file name … … 466 466 end 467 467 else% automatic measurement grid 468 ibx2=ceil(par_civ.Bx/2);469 iby2=ceil(par_civ.By/2);470 isx2=ceil(par_civ.Searchx/2);471 isy2=ceil(par_civ.Searchy/2);468 % ibx2=ceil(par_civ.Bx/2); 469 % iby2=ceil(par_civ.By/2); 470 % isx2=ceil(par_civ.Searchx/2); 471 % isy2=ceil(par_civ.Searchy/2); 472 472 miniy=max(1+isy2+shifty,1+iby2); 473 473 minix=max(1+isx2-shiftx,1+ibx2); … … 609 609 if ~isempty(y) && ~isempty(x) 610 610 try 611 if par_civ. Rho==1611 if par_civ.CorrSmooth==1 612 612 [vector,F(ivec)] = SUBPIXGAUSS (result_conv,x,y); 613 elseif par_civ. Rho==2613 elseif par_civ.CorrSmooth==2 614 614 [vector,F(ivec)] = SUBPIX2DGAUSS (result_conv,x,y); 615 615 end -
trunk/src/fileparts_uvmat.m
r405 r437 143 143 144 144 %% extract subdirectory for pairs i1-i2 or j1-j2 (or ab, AB) 145 if ~isempty(i2) || ~isempty(j2)145 % if ~isempty(i2) || ~isempty(j2) 146 146 r=regexp(RootPath,'\<(?<newrootpath>.+)(\\|/)(?<subdir>[^\\^/]+)(\\|/)*\>','names'); 147 147 if ~isempty(r) … … 149 149 RootPath=r.newrootpath; 150 150 end 151 end152 153 % if ~isempty(regexp(NomType,'-|ab|AB'))154 % r=regexp(RootPath,'\<(?<newrootpath>.+)(\\|/)(?<subdir>[^\\^/]+)(\\|/)*\>','names');155 % if ~isempty(r)156 % SubDir=r.subdir;157 % RootPath=r.newrootpath;158 % end159 151 % end 152 160 153 161 154
Note: See TracChangeset
for help on using the changeset viewer.