Changeset 493 for trunk/src/civ.m
- Timestamp:
- Jul 16, 2012, 10:44:12 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r492 r493 341 341 342 342 %% case of netcdf file as input, get the civ processing stage and look for a coresponding image 343 imageinput=fileinput;%default 343 344 if strcmp(ExtInput,'.nc') 344 345 NomTypeNc=NomTypeInput; … … 351 352 set(handles.RootFile_1,'Visible','Off'); 352 353 end 354 imageinput=''; 353 355 Data=nc2struct(fileinput,'ListGlobalAttribute','Conventions','absolut_time_T0','CivStage','Civ2_ImageA','Civ1_ImageA','Civ2_ImageB','Civ1_ImageB','fix','patch','civ2','fix2'); 354 356 if isfield(Data,'Txt') … … 359 361 if strcmp(Data.Conventions,'uvmat/civdata')% case of new civ data, 360 362 set(handles.Program,'Value',2) %select civ/Matlab by default 361 ListProgram_Callback([],[], handles)363 Program_Callback([],[], handles) 362 364 if ~isempty(Data.CivStage)%test for civ files 363 365 ind_opening=Data.CivStage; … … 404 406 end 405 407 end 408 if ~exist(imageinput,'file') 406 409 imageinput=fullfile_uvmat(RootPath,regexprep(SubDir,'.civ(_?)(\d*)$',''),RootFile,'.png',NomTypeIma,i1,[],j1); 410 end 407 411 end 408 412 … … 419 423 '*.*', 'All Files (*.*)'}; 420 424 [FileName, PathName] = uigetfile( menu, 'Pick an input image file',fileparts(fileparts(fileinput))); 421 fileinput=[PathName FileName];%complete file name422 if ~exist( fileinput,'file')425 imageinput=[PathName FileName];%complete file name 426 if ~exist(imageinput,'file') 423 427 return %abandon of the browser is cancelled 424 428 end … … 428 432 429 433 %% scan the image file series 430 [FilePath,FileName,ImaExt]=fileparts( fileinput);434 [FilePath,FileName,ImaExt]=fileparts(imageinput); 431 435 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 432 436 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 433 [RootPath,SubdirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject ,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]);437 [RootPath,SubdirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject]=find_file_series(FilePath,[FileName ImaExt]); 434 438 switch FileType 435 439 case {'image','multimage','video','mmreader'} … … 442 446 set(handles.RootFile,'String',RootFile) 443 447 if strcmp(ExtInput,'.nc') 444 SubDirCiv=regexprep(SubDir,[ SubdirImages '^'],'');%suppress the root SuddirImages;448 SubDirCiv=regexprep(SubDir,['^' SubdirImages],'');%suppress the root SuddirImages; 445 449 else 446 450 SubDirCiv= '.civ'; … … 450 454 browse=get(handles.RootPath,'UserData'); 451 455 browse.incr_pair=[0 0];%default 452 453 %% fill reference indices from the input file indices454 num_ref_i=i1;%efaulmt ref index455 if ~isempty(i2)456 num_ref_i=floor((num_ref_i+i2)/2);457 end458 num_ref_j=j1;459 if ~isempty(j2)460 num_ref_j=floor((num_ref_j+j2)/2);461 end462 456 463 457 %% scan the images if a civ file has been opened … … 467 461 MaxIndex_j=max(j1_series(j1_series>0)); 468 462 463 %% fill reference indices from the input file indices 464 num_ref_i=str2num(get(handles.ref_i,'String')); 465 num_ref_j=str2num(get(handles.ref_j,'String')); 466 % for movies don't modify except if the current ref is outside index bounds 467 if strcmp(ExtInput,'.nc')|| ~(strcmp(FileType,'mmreader')||strcmp(FileType,'VideoReader') && num_ref_i<=MaxIndex_i && num_ref_j<=MaxIndex_j) 468 num_ref_i=i1;%default ref index 469 if ~isempty(i2) 470 num_ref_i=floor((num_ref_i+i2)/2); 471 end 472 num_ref_j=j1; 473 if ~isempty(j2) 474 num_ref_j=floor((num_ref_j+j2)/2); 475 end 476 end 477 469 478 %% look for an image documentation file 470 479 XmlFileName=find_imadoc(RootPath,SubDir,RootFile,ImaExt); 471 % SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'472 % filexml=fullfile(RootPath,[SubDirBase '.xml']);% new convention: xml above the image dir473 % if ~exist(filexml,'file')474 % filexml=fullfile(RootPath,SubDir,[RootFile '.xml']);%old convention: xml within the image directroy475 % if ~exist(filexml,'file')476 % filexml=fullfile(RootPath,SubDir,[RootFile '.civ']);%very old convention: .civ file477 % if ~exist(filexml,'file')478 % filexml='';479 % end480 % end481 % end482 480 if isempty(XmlFileName) 483 481 if (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) … … 501 499 [XmlData,warntext]=imadoc2struct(XmlFileName); 502 500 nom_type_read=[]; 503 % if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file504 % [~,tild,tild,tild,tild,tild,tild,tild,nom_type_read]=fileparts_uvmat(XmlData.Heading.ImageName);505 % fullname=fullfile(fileparts(RootName),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file,506 % if ~exist(fullname,'file')507 % msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist'])508 % end509 % end510 501 if isfield(XmlData,'Time') && ~isempty(XmlData.Time) 511 502 time=XmlData.Time; … … 1079 1070 end% default configuration 1080 1071 if ~isfield(s,'RunParam') 1081 s.RunParam.Civ1Bin='bin/civ1';1082 s.RunParam.Civ2Bin='bin/civ2';1083 s.RunParam.FixBin='bin/fix_flag';1084 s.RunParam.PatchBin='bin/patch_up';1085 s.RunParam.CivmBin='bin/civ_matlab';1072 Param.xml.Civ1Bin=fullfile('bin','civ1'); 1073 Param.xml.Civ2Bin=fullfile('bin','civ2'); 1074 Param.xml.FixBin=fullfile('bin','fix_flag'); 1075 Param.xml.PatchBin=fullfile('bin','patch_up'); 1076 Param.xml.CivmBin=fullfile('bin','civ_matlab'); 1086 1077 end 1087 1078 if strcmp(Param.RunMode,'cluster') %computation dispatched on a cluster … … 1096 1087 end 1097 1088 else 1098 % standardconfiguration1099 Param.xml.Civ1Bin= 'bin/civ1';1100 Param.xml.Civ2Bin= 'bin/civ2';1101 Param.xml.FixBin= 'bin/fix_flag';1102 Param.xml.PatchBin= 'bin/patch_up';1103 s.RunParam.CivmBin='bin/civ_matlab';1089 %default configuration 1090 Param.xml.Civ1Bin=fullfile('bin','civ1'); 1091 Param.xml.Civ2Bin=fullfile('bin','civ2'); 1092 Param.xml.FixBin=fullfile('bin','fix_flag'); 1093 Param.xml.PatchBin=fullfile('bin','patch_up'); 1094 Param.xml.CivmBin=fullfile('bin','civ_matlab'); 1104 1095 Param.xml.BatchMode='oar';% TODO : allow choice for sge 1105 1096 end … … 1107 1098 if isfield(s,'RunParam') 1108 1099 Param.xml=s.RunParam; 1109 else % standarddefault configuration1110 s.RunParam.Civ1Bin='bin/civ1';1111 s.RunParam.Civ2Bin='bin/civ2';1112 s.RunParam.FixBin='bin/fix_flag';1113 s.RunParam.PatchBin='bin/patch_up';1114 s.RunParam.CivmBin='bin/civ_matlab';1100 else %default configuration 1101 Param.xml.Civ1Bin=fullfile('bin','civ1'); 1102 Param.xml.Civ2Bin=fullfile('bin','civ2'); 1103 Param.xml.FixBin=fullfile('bin','fix_flag'); 1104 Param.xml.PatchBin=fullfile('bin','patch_up'); 1105 Param.xml.CivmBin=fullfile('bin','civ_matlab'); 1115 1106 end 1116 1107 end 1117 1108 1118 1109 %% check if the binaries exist : to move in civ_opening 1119 % ListProgram=get(handles.Program,'String');1120 % Param.CivMode=ListProgram{get(handles.Program,'Value')};1121 1110 binary_list={}; 1122 1111 switch Param.Program … … 1950 1939 for j=1:nbslice 1951 1940 filename=fullfile_uvmat(RootPath,subdir_civ1_new,RootFile_A,'.nc',NomType_nc,i1_civ1(ifile),i2_civ1(ifile),j1_civ1(j),j2_civ1(j)); 1952 % filename=name_generator(filebase_A,i1_civ1(ifile),j1_civ1(j),'.nc',NomType_nc,1,i2_civ1(ifile),j2_civ1(j),subdir_civ1_new);%1953 1941 detect=exist(filename,'file')==2; 1954 1942 if detect% if a netcdf file already exists … … 2828 2816 2829 2817 %% reads .nc subdirectoy and image numbers from the interface 2830 subdir_civ1=get(handles.SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf data 2831 subdir_civ2=get(handles.SubdirCiv2,'String');%subdirectory subdir_civ2 for the netcdf data 2818 SubDirImages=get(handles.SubdirImages,'String'); 2819 subdir_civ1=[SubDirImages get(handles.SubdirCiv1,'String')];%subdirectory subdir_civ1 for the netcdf data 2820 subdir_civ2=[SubDirImages get(handles.SubdirCiv2,'String')];%subdirectory subdir_civ2 for the netcdf data 2832 2821 ref_i=str2double(get(handles.ref_i,'String')); 2833 2822 if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')
Note: See TracChangeset
for help on using the changeset viewer.