Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r437 r438 306 306 NomTypeNc='';%default 307 307 308 %% case of netcdf file as input, look for a coresponding image308 %% case of xml file as input, read the civ parameters 309 309 ind_opening=0;%default 310 310 if strcmp(ExtInput,'.xml') … … 313 313 return 314 314 end 315 316 %% case of netcdf file as input, get the civ processing stage and look for a coresponding image 315 317 if strcmp(ExtInput,'.nc') 316 318 NomTypeNc=NomTypeInput; 317 if isempty(regexp(NomTypeInput,'[ab|AB|-]')) 319 if isempty(regexp(NomTypeInput,'[ab|AB|-]')) 318 320 set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomencalture does not involve index pairs 319 [RootPath,SubDir]=fileparts(RootPath);320 set(handles.RootFile_1,'Visible','On');321 % [RootPath,SubDir]=fileparts(RootPath); 322 set(handles.RootFile_1,'Visible','On'); 321 323 else 322 323 324 set(handles.ListCompareMode,'Value',1) 325 set(handles.RootFile_1,'Visible','Off'); 324 326 end 325 327 Data=nc2struct(fileinput,'ListGlobalAttribute','Conventions','absolut_time_T0','CivStage','Civ2_ImageA','Civ1_ImageA','Civ2_ImageB','Civ1_ImageB','fix','patch','civ2','fix2'); … … 328 330 return 329 331 end 332 % settings for new civ data, 330 333 if strcmp(Data.Conventions,'uvmat/civdata')% case of new civ data, 331 334 set(handles.ListProgram,'Value',2) %select civ/Matlab by default … … 343 346 set(handles.RootFile_1,'String',[ImaName ImaExt]) 344 347 end 345 348 % settings for civx data, 346 349 elseif ~isempty(Data.absolut_time_T0')% case of civx data, 347 350 set(handles.ListProgram,'Value',1) %select Cix by default … … 356 359 ind_opening=2; 357 360 end 358 % look for the corresponding input images359 check_letter=~isempty(regexp(NomTypeInput,'[ab|AB]$'));%detect pair label by letter360 NomTypeIma=NomTypeInput;361 if check_letter362 NomTypeIma=NomTypeInput(1:end-1);363 else364 r=regexp(NomTypeIma,'.-(?<num2>\d+)$','names');365 if ~isempty(r)366 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');367 end368 r=regexp(NomTypeIma,'.-(?<num2>\d+)','names');369 if ~isempty(r)370 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');371 end372 end373 imageinput=fullfile_uvmat(RootPath,'',RootFile,'.png',NomTypeIma,i1,[],j1);374 361 else 375 362 errormsg='the input netcdf file is not civ data'; 376 363 return 377 364 end 365 % look for the corresponding input images 366 check_letter=~isempty(regexp(NomTypeInput,'[ab|AB]$','once'));%detect pair label by letter 367 NomTypeIma=NomTypeInput; 368 if check_letter 369 NomTypeIma=NomTypeInput(1:end-1); 370 else 371 r=regexp(NomTypeIma,'.-(?<num2>\d+)$','names'); 372 if ~isempty(r) 373 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],''); 374 end 375 r=regexp(NomTypeIma,'.-(?<num2>\d+)','names'); 376 if ~isempty(r) 377 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],''); 378 end 379 end 380 imageinput=fullfile_uvmat(RootPath,regexprep(SubDir,'.civ(_?)(\d*)$',''),RootFile,'.png',NomTypeIma,i1,[],j1); 378 381 end 379 382 … … 400 403 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 401 404 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 402 [RootPath,Sub Dir,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]);405 [RootPath,SubdirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]); 403 406 404 407 switch FileType … … 409 412 end 410 413 set(handles.RootPath,'String',RootPath) 411 set(handles.SubdirImages,'String',Sub Dir)414 set(handles.SubdirImages,'String',SubdirImages) 412 415 set(handles.RootFile,'String',RootFile) 413 set(handles.SubdirCiv1,'String',[SubDir '.civ']) 416 if strcmp(ExtInput,'.nc') 417 SubDirCiv=SubDir; 418 else 419 SubDirCiv=[SubDir '.civ']; 420 end 421 set(handles.SubdirCiv1,'String',SubDirCiv) 422 set(handles.SubdirCiv2,'String',SubDirCiv) 414 423 browse=get(handles.RootPath,'UserData'); 415 424 browse.incr_pair=[0 0];%default … … 573 582 end 574 583 if ind_opening~=0 || isempty(first_i) || isempty(last_i)|| first_i<MinIndex_i || last_i>MaxIndex_i 575 set(handles.first_i,'String',num2str(num_ref_i));576 set(handles.last_i,'String',num2str(num_ref_i));%584 set(handles.first_i,'String',num2str(num_ref_i)); 585 set(handles.last_i,'String',num2str(num_ref_i));% 577 586 end 578 587 … … 599 608 end 600 609 set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1) 601 update_CivOptions(handles, 1)610 update_CivOptions(handles,ind_opening) 602 611 603 612 %% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% … … 634 643 end 635 644 end 636 637 %% update the selection for civ1 and civ2638 % if ~isempty(SubDir)% subdir for civ1 and civ2 initiated by the input639 % SubdirCiv1=SubDir;640 % SubdirCiv2=SubDir;641 % set(handles.SubdirCiv1,'String',SubDir)642 % set(handles.SubdirCiv2,'String',SubDir)643 % else% currently selected subdir preserved644 % 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 % end650 % if isempty(SubdirCiv2)% default subdir name='CIV'651 % set(handles.SubdirCiv2,'String','CIV');652 % SubdirCiv2='CIV';653 % end654 % end655 656 %% update the subdirectory menus657 % ValueCiv1=find(strcmp(SubdirCiv1,listdir));%search the index of subdir in the cell listdir658 % if isempty(ValueCiv1)% if the input subdir is not found659 % ValueCiv1=numel(listdir)+1;%new subdirectory requested for civ1660 % end661 % ValueCiv2=find(strcmp(SubdirCiv2,listdir));%search the index of subdir in the cell listdir662 % if isempty(ValueCiv2)% if the input subdir is not found663 % ValueCiv2=numel(listdir)+1;%new subdirectory requested for civ2664 % end665 % 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 % end673 645 674 646 %% store info … … 795 767 set(handles.PairIndices,'Visible','on') 796 768 set(handles.SubdirCiv1,'Visible','on') 797 %set(handles.ListSubdirCiv1,'Visible','on')798 769 set(handles.TitleSubdirCiv1,'Visible','on') 799 770 if ~opening … … 818 789 set(handles.TitleSubdirCiv2,'Visible','off') 819 790 set(handles.SubdirCiv2,'Visible','off') 820 % set(handles.ListSubdirCiv2,'Visible','off')821 791 set(handles.ListPairCiv2,'Visible','off') 822 792 end … … 3123 3093 else %case civ2 alone 3124 3094 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 3125 if ~exist(fullfile(RootPath,subdir_civ2 ,ext_dir),'dir')3126 errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist'])3095 if ~exist(fullfile(RootPath,subdir_civ2),'dir') 3096 msgbox_uvmat('ERROR',['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) 3127 3097 set(handles.ListPairCiv2,'Value',1); 3128 3098 set(handles.ListPairCiv2,'String',{''});
Note: See TracChangeset
for help on using the changeset viewer.