- Timestamp:
- Jun 22, 2012, 3:45:06 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r468 r469 24 24 %TODO: search range 25 25 26 % Last Modified by GUIDE v2.5 21-Jun-2012 2 0:22:3926 % Last Modified by GUIDE v2.5 21-Jun-2012 23:37:47 27 27 % Begin initialization code - DO NOT EDIT 28 28 gui_Singleton = 1; … … 302 302 set(handles.RUN, 'Enable','On') 303 303 set(handles.RUN,'BackgroundColor',[1 0 0])%set RUN button to red color 304 set(handles.BATCH,'Enable','On')305 set(handles.BATCH,'BackgroundColor',[1 0 0])%set BATCH button to red color304 % set(handles.BATCH,'Enable','On') 305 % set(handles.BATCH,'BackgroundColor',[1 0 0])%set BATCH button to red color 306 306 if isfield(handles,'status') 307 307 set(handles.status,'Value',0); %suppress the 'status' display … … 339 339 % settings for new civ data, 340 340 if strcmp(Data.Conventions,'uvmat/civdata')% case of new civ data, 341 set(handles. ListProgram,'Value',2) %select civ/Matlab by default341 set(handles.Program,'Value',2) %select civ/Matlab by default 342 342 ListProgram_Callback([],[], handles) 343 343 if ~isempty(Data.CivStage)%test for civ files … … 355 355 % settings for civx data, 356 356 elseif ~isempty(Data.absolut_time_T0')% case of civx data, 357 set(handles. ListProgram,'Value',1) %select Cix by default357 set(handles.Program,'Value',1) %select Cix by default 358 358 ListProgram_Callback([],[], handles) 359 359 if ~isempty(Data.fix2) … … 388 388 end 389 389 390 % no corresponding image found, select manually with the browser390 %% no corresponding image found, select manually with the browser 391 391 ImaExt=ExtInput; 392 392 if ~isempty(NomTypeNc) … … 400 400 '*.*', 'All Files (*.*)'}; 401 401 [FileName, PathName] = uigetfile( menu, 'Pick an input image file',fileparts(fileparts(fileinput))); 402 imageinput=[PathName FileName];%complete file name 403 402 fileinput=[PathName FileName];%complete file name 403 if ~exist(fileinput,'file') 404 return %abandon of the browser is cancelled 405 end 404 406 end 405 fileinput=imageinput;407 %fileinput=imageinput; 406 408 end 407 409 … … 410 412 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 411 413 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 412 [RootPath,SubdirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]); 413 414 [RootPath,SubdirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]); 414 415 switch FileType 415 416 case {'image','multimage','video','mmreader'} … … 448 449 449 450 %% look for an image documentation file 450 ext_imadoc='';%default 451 SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 452 filexml=fullfile(RootPath,[SubDirBase '.xml']);% new convention: xml above the image dir 453 if ~exist(filexml,'file') 454 filexml=fullfile(RootPath,SubDir,[RootFile '.xml']);%old convention: xml within the image directroy 455 end 456 RootName=fullfile(RootPath,RootFile); 457 if exist(filexml,'file') 458 ext_imadoc='.xml'; 459 elseif exist(fullfile(RootPath,SubDir,[RootFile '.civ']),'file') 460 ext_imadoc='.civ'; 461 fileciv=fullfile(RootPath,SubDir,[RootFile '.civ']); 462 elseif exist([RootName '.avi'],'file') 463 ext_imadoc='.avi'; 464 elseif exist([RootName '.AVI'],'file') 465 ext_imadoc='.AVI'; 451 XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt); 452 % SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 453 % filexml=fullfile(RootPath,[SubDirBase '.xml']);% new convention: xml above the image dir 454 % if ~exist(filexml,'file') 455 % filexml=fullfile(RootPath,SubDir,[RootFile '.xml']);%old convention: xml within the image directroy 456 % if ~exist(filexml,'file') 457 % filexml=fullfile(RootPath,SubDir,[RootFile '.civ']);%very old convention: .civ file 458 % if ~exist(filexml,'file') 459 % filexml=''; 460 % end 461 % end 462 % end 463 if isempty(XmlFileName) 464 if (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 465 ext_imadoc=ImaExt;% the timing from the video movie is used 466 else 467 ext_imadoc=''; 468 end 469 else 470 [tild,tild,ext_imadoc]=fileparts(XmlFileName); 466 471 end 467 472 set(handles.ImaDoc,'String',ext_imadoc)% display the extension name for the image documentation file used … … 472 477 CoordUnit='';%default 473 478 pxcm_search=1; 474 if ~isempty( ext_imadoc)479 if ~isempty(XmlFileName) 475 480 set(handles.ImaDoc,'BackgroundColor',[1 1 0]) % set edit box to yellow cloro to indicate that the file reading is beginning 476 481 drawnow 477 switch ext_imadoc 478 case '.xml' 479 [XmlData,warntext]=imadoc2struct(filexml); 480 ext_ima_read=[]; 481 nom_type_read=[]; 482 if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file 483 %[PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); 484 [~,tild,tild,tild,tild,tild,tild,tild,nom_type_read]=fileparts_uvmat(XmlData.Heading.ImageName); 485 fullname=fullfile(fileparts(RootName),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, 486 if ~exist(fullname,'file') 487 msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist']) 488 end 489 end 490 if isfield(XmlData,'Time') && ~isempty(XmlData.Time) 491 time=XmlData.Time; 492 %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml 493 if isequal(MaxIndex_i,1) && ~isequal(MaxIndex_j,1)% .Time is a line vector 494 if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D','once')) 495 time=time'; 496 MaxIndex_i=MaxIndex_j; 497 MaxIndex_j=1; 498 end 499 end 500 end 501 if isfield(XmlData,'TimeUnit') 502 TimeUnit=XmlData.TimeUnit; 503 end 504 505 if isfield(XmlData,'GeometryCalib') 506 tsai=XmlData.GeometryCalib; 507 if isfield(tsai,'fx_fy') 508 pxcm_search=max(tsai.fx_fy(1),tsai.fx_fy(2));%pixels:cm estimated for the search range 509 end 510 if isfield(tsai,'CoordUnit') 511 CoordUnit=tsai.CoordUnit; 512 end 513 end 514 case '.civ'% OBSOLETE: case of .civ image documentation file 515 [error,time,TimeUnit,mode,npx,npy]=read_imatext(fileciv); 516 if error==2, msgbox_uvmat('WARNING',['no file ' fileciv]); 517 elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); 518 end 519 nom_type_ima='001a'; 520 end 521 if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 522 nom_type_ima='*'; 523 %ImaExt=ext_imadoc; 524 set(handles.ListPairMode,'Value',1); 525 set(handles.ListPairMode,'String',{'series(Di)'}) 526 dt=0.04;%default 527 hhh=which('videoreader'); 528 if strcmp(FileType,'mmreader')%use old video function of matlab 529 imainfo=aviinfo(fileinput);%read infos on the avi movie TO REPLACE mmreader 530 dt=1/imainfo.FramesPerSecond;%time interval between successive frames 531 MaxIndex_i=imainfo.NumFrames;%number of frames 532 else %use video function videoreader of matlab 533 imainfo=get(videoreader(fileinput));%read infos on the avi movie 534 dt=1/imainfo.FrameRate;%time interval between successive frames 535 MaxIndex_i=imainfo.NumberOfFrames;%number of frames 536 end 537 time=(dt*(0:MaxIndex_i-1))';%list of image times 538 TimeUnit='s'; 539 set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter 540 end 541 end 482 [XmlData,warntext]=imadoc2struct(XmlFileName); 483 nom_type_read=[]; 484 if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file 485 [~,tild,tild,tild,tild,tild,tild,tild,nom_type_read]=fileparts_uvmat(XmlData.Heading.ImageName); 486 fullname=fullfile(fileparts(RootName),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, 487 if ~exist(fullname,'file') 488 msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist']) 489 end 490 end 491 if isfield(XmlData,'Time') && ~isempty(XmlData.Time) 492 time=XmlData.Time; 493 %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml 494 if isequal(MaxIndex_i,1) && ~isequal(MaxIndex_j,1)% .Time is a line vector 495 if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D','once')) 496 time=time'; 497 MaxIndex_i=MaxIndex_j; 498 MaxIndex_j=1; 499 end 500 end 501 end 502 if isfield(XmlData,'TimeUnit') 503 TimeUnit=XmlData.TimeUnit; 504 end 505 if isfield(XmlData,'GeometryCalib') 506 tsai=XmlData.GeometryCalib; 507 if isfield(tsai,'fx_fy') 508 pxcm_search=max(tsai.fx_fy(1),tsai.fx_fy(2));%pixels:cm estimated for the search range 509 end 510 if isfield(tsai,'CoordUnit') 511 CoordUnit=tsai.CoordUnit; 512 end 513 end 514 end 515 if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 516 set(handles.ListPairMode,'Value',1); 517 set(handles.ListPairMode,'String',{'series(Di)'}) 518 dt=1/get(MovieObject,'FrameRate');%time interval between successive frames 519 MaxIndex_i=get(MovieObject,'NumberOfFrames'); 520 time=(dt*(0:MaxIndex_i-1))';%list of image times 521 TimeUnit='s'; 522 set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter 523 end 524 542 525 %% timing display 543 526 %show the reference image edit box if relevant (not needed for movies or in the absence of time information … … 547 530 time=[zeros(size(time,1),1) time]; %insert a vertical line of zeros (to deal with zero file indices) 548 531 time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros 549 set(handles.ImaDoc,'UserData',time); %store the matrix of times550 set(handles.dt_unit,'String',['dt in m' TimeUnit]);551 set(handles.TimeUnit,'String',TimeUnit);552 532 else 553 533 set(handles.ImaDoc,'String',''); %xml file not used for timing … … 801 781 set(handles.RUN, 'Enable','Off') 802 782 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 803 batch=get(handles.RunMode,'Value');783 %batch=get(handles.RunMode,'Value'); 804 784 % batch=0; 805 errormsg=launch_jobs(hObject, eventdata, handles ,batch);785 errormsg=launch_jobs(hObject, eventdata, handles); 806 786 set(handles.RUN, 'Enable','On') 807 787 set(handles.RUN,'BackgroundColor',[1 0 0]) … … 1021 1001 %------------------------------------------------------------------------ 1022 1002 % --- Main lauch command, called by RUN and BATCH 1023 function errormsg=launch_jobs(hObject, eventdata, handles , batch)1003 function errormsg=launch_jobs(hObject, eventdata, handles) 1024 1004 %------------------------------------------------------------------------ 1025 1005 errormsg='';%default … … 1087 1067 return 1088 1068 end 1089 test_interp=0; %eviter les variables test_ (LG)1090 if batch==3%computation dispatched on a cluster1069 % test_interp=0; %eviter les variables test_ (LG) 1070 if strcmp(Param.RunMode,'cluster') %computation dispatched on a cluster 1091 1071 if isfield(s,'BatchParam') 1092 1072 Param.xml=s.BatchParam; … … 1112 1092 1113 1093 %% check batch mode supported 1114 if batch==3 %computation dispatched on a cluster1094 if strcmp(Param.RunMode,'cluster') %computation dispatched on a cluster 1115 1095 switch batch_mode 1116 1096 case 'sge' … … 1127 1107 1128 1108 %% check if the binaries exist 1129 ListProgram=get(handles.ListProgram,'String');1130 Param.CivMode=ListProgram{get(handles.ListProgram,'Value')};1109 % ListProgram=get(handles.Program,'String'); 1110 % Param.CivMode=ListProgram{get(handles.Program,'Value')}; 1131 1111 binary_list={}; 1132 switch Param. CivMode1112 switch Param.Program 1133 1113 case 'CivX' 1134 1114 binary_list={'Civ1Bin','Civ2Bin','PatchBin','FixBin'}; 1135 1115 case 'CivAll'% desactivated option 1136 1116 binary_list={'Civ'}; 1137 case ' Matlab'1117 case 'civ_matlab.sh'% compiled version of civ_matlab 1138 1118 if batch 1139 1119 binary_list={'CivmBin'}; … … 1194 1174 1195 1175 1196 %% PARTIE A VERIFIER 1197 %output netcdf file (without extention) Joel what does this mean ? 1176 %% get information on input images or movies 1198 1177 nbfield=numel(i1_civ1); 1199 1178 nbslice=numel(j1_civ1); 1200 if ~strcmp(Param.CivMode,'CivX')1179 % if strcmp(Param.Program,'civ_matlab') 1201 1180 if Param.CheckCiv1 1202 [Param.Civ1.FileTypeA, FileInfo,Param.Civ1.ImageA]=get_file_type(filecell.ima1.civ1{1});1203 [Param.Civ1.FileTypeB, FileInfo,Param.Civ1.ImageB]=get_file_type(filecell.ima2.civ1{1});1181 [Param.Civ1.FileTypeA,ImageInfoA_civ1,Param.Civ1.ImageA]=get_file_type(filecell.ima1.civ1{1}); 1182 [Param.Civ1.FileTypeB,ImageInfoB_civ1,Param.Civ1.ImageB]=get_file_type(filecell.ima2.civ1{1}); 1204 1183 end 1205 1184 if Param.CheckCiv2 1206 [Param.Civ2.FileTypeA,FileInfo ,Param.Civ2.ImageA]=get_file_type(filecell.ima1.civ2{1});1207 [Param.Civ2.FileTypeB,FileInfo ,Param.Civ2.ImageB]=get_file_type(filecell.ima2.civ2{1});1208 end 1209 end1185 [Param.Civ2.FileTypeA,FileInfoA_civ2,Param.Civ2.ImageA]=get_file_type(filecell.ima1.civ2{1}); 1186 [Param.Civ2.FileTypeB,FileInfoB_civ2,Param.Civ2.ImageB]=get_file_type(filecell.ima2.civ2{1}); 1187 end 1188 % end 1210 1189 1211 1190 %% MAIN LOOP … … 1217 1196 for ifile=1:nbfield 1218 1197 for j=1:nbslice 1219 1220 1198 1221 1199 % define output file name … … 1236 1214 end 1237 1215 Param.Civ1.Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2); 1238 if strcmp(Param. CivMode,'CivX')1216 if strcmp(Param.Program,'CivX') 1239 1217 Param.Civ1.term_a=num2stra(j1_civ1(j),nom_type_nc);%UTILITE? 1240 1218 Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);% 1241 1219 end 1242 if isfield(Param.Civ1,'FileTypeA')&&(strcmp(Param.Civ1.FileTypeA,'video')|| strcmp(Param.Civ1.FileTypeA,'mmreader')) 1243 % ImageInfo=get(VideoReader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt]))); 1244 ImageInfo=get(Param.Civ1.ImageA); 1245 % elseif strcmp(Param.Civ1.FileTypeA,'mmreader') 1246 % ImageInfo=get(mmreader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt]))); 1247 Param.Civ1.ImageBitDepth=ImageInfo.BitsPerPixel/3; 1248 if batch 1249 Param.Civ1.ImageA=filecell.ima1.civ1{ifile,j};%file name must be used for batch instead of video object 1250 Param.Civ1.ImageB=filecell.ima2.civ1{ifile,j}; 1251 end 1252 else 1253 Param.Civ1.ImageA=filecell.ima1.civ1{ifile,j}; 1254 Param.Civ1.ImageB=filecell.ima2.civ1{ifile,j}; 1255 % form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats 1256 ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size 1257 Param.Civ1.ImageBitDepth=ImageInfo.BitDepth; 1258 end 1259 Param.Civ1.ImageWidth=ImageInfo.Width; 1260 Param.Civ1.ImageHeight=ImageInfo.Height; 1220 Param.Civ1.ImageA=filecell.ima1.civ1{ifile,j}; 1221 Param.Civ1.ImageB=filecell.ima2.civ1{ifile,j}; 1222 Param.Civ1.ImageBitDepth=FileInfoA_civ1.BitDepth; 1223 Param.Civ1.ImageWidth=FileInfoA_civ1.Width; 1224 Param.Civ1.ImageHeight=FileInfoA_civ1.Height; 1261 1225 Param.Civ1.FrameIndexA=i1_civ1(ifile); 1262 1226 Param.Civ1.FrameIndexB=i2_civ1(ifile); … … 1278 1242 i1_grid=mod(i1_civ1(ifile)-1,nbslice_grid)+1; 1279 1243 Param.Civ1.Grid=[filecell.filebase '_' fullfile_uvmat('','',Param.Civ1.Grid,'.grid','_1',i1_grid)]; 1280 % Param.Civ1.Grid=[filecell.filebase '_' name_generator(Param.Civ1.Grid,i1_grid,1,'.grid','_i')];1281 1244 if ~exist(Param.Civ1.GridName,'file') 1282 1245 errormsg='grid file absent for civ1'; … … 1293 1256 1294 1257 if Param.CheckCiv2==1 1295 if isfield(Param.Civ2,'FileTypeA') &&(strcmp(Param.Civ2.FileTypeA,'video')|| strcmp(Param.Civ2.FileTypeA,'mmreader')) 1296 % ImageInfo=get(VideoReader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt]))); 1297 ImageInfo=get(Param.Civ2.ImageA); 1298 % elseif strcmp(Param.Civ1.FileTypeA,'mmreader') 1299 % ImageInfo=get(mmreader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt]))); 1300 Param.Civ2.ImageBitDepth=ImageInfo.BitsPerPixel/3; 1301 if batch 1302 Param.Civ2.ImageA=filecell.ima1.civ2{ifile,j};%file name must be used for batch instead of video object 1303 Param.Civ2.ImageB=filecell.ima2.civ2{ifile,j}; 1304 end 1305 else 1306 Param.Civ2.ImageA=filecell.ima1.civ2{ifile,j}; 1307 Param.Civ2.ImageB=filecell.ima2.civ2{ifile,j}; 1308 form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats 1309 ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size 1310 Param.Civ2.ImageBitDepth=ImageInfo.BitDepth; 1311 end 1312 1258 Param.Civ2.ImageA=filecell.ima1.civ2{ifile,j}; 1259 Param.Civ2.ImageB=filecell.ima2.civ2{ifile,j}; 1313 1260 if ~checkframe %&& size(time,1)>=i2_civ2(ifile) && size(time,2)>=j2_civ2(j) 1314 1261 Param.Civ2.Dt=time(i2_civ2(ifile)+1,j2_civ2(j)+1)-time(i1_civ2(ifile)+1,j1_civ2(j)+1); … … 1317 1264 end 1318 1265 Param.Civ2.Time=(time(i2_civ2(ifile)+1,j2_civ2(j)+1)+time(i1_civ2(ifile)+1,j1_civ2(j)+1))/2; 1319 if strcmp(Param. CivMode,'CivX')1266 if strcmp(Param.Program,'CivX') 1320 1267 Param.Civ2.term_a=num2stra(j1_civ2(j),nom_type_nc); 1321 1268 Param.Civ2.term_b=num2stra(j2_civ2(j),nom_type_nc); … … 1346 1293 end 1347 1294 end 1348 form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats 1349 if isempty(form) 1350 % ImageInfo=get(VideoReader(fullfile()); 1351 Param.Civ2.ImageBitDepth=ImageInfo.BitsPerPixel/3; 1352 else 1353 ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size 1354 Param.Civ2.ImageBitDepth=ImageInfo.BitDepth; 1355 end 1356 Param.Civ2.ImageWidth=ImageInfo.Width; 1357 Param.Civ2.ImageHeight=ImageInfo.Height; 1295 1296 Param.Civ2.ImageBitDepth=FileInfoA_civ2.BitDepth; 1297 Param.Civ2.ImageWidth=FileInfoA_civ2.Width; 1298 Param.Civ2.ImageHeight=FileInfoA_civ2.Height; 1358 1299 Param.Civ2.FrameIndexA=i1_civ2(ifile); 1359 Param.Civ2.FrameIndexB=i2_civ2(ifile); 1360 1361 end 1362 1363 1300 Param.Civ2.FrameIndexB=i2_civ2(ifile); 1301 end 1302 1364 1303 % write the command and eventually the cmx, xml or nml files 1365 cmd=write_cmd(Param ,batch);1304 cmd=write_cmd(Param); 1366 1305 write_param(Param); 1367 1368 1369 1306 1370 1307 % create the file used in run or batch 1371 switch Param. CivMode1372 case 'Matlab'1308 switch Param.Program 1309 case {'civ_matlab','civ_matlab.sh'} 1373 1310 filename_bat=regexprep(Param.OutputFile,'(\w+)([/\\])(\w+$)','$1$20_BAT$2$3.m'); 1374 1311 case {'CivX','CivAll'} … … 1393 1330 1394 1331 %% start calculation 1395 1396 if batch ==3 1332 %computation on cluster 1333 %if batch ==3 1334 if strcmp(Param.RunMode,'cluster') 1397 1335 switch batch_mode 1398 1336 case 'sge' %at the moment only psmn ENS Lyon uses it … … 1526 1464 end 1527 1465 end 1528 else 1529 switch Param. CivMode1530 case 'Matlab'1531 1532 background=1;1533 if background1466 else %computation on local computer 1467 switch Param.Program 1468 case {'civ_matlab','civ_matlab.sh'} 1469 % 1470 % background=1; 1471 if strcmp(Param.RunMode,'background') 1534 1472 filename_superbat=fullfile(RootBat,'job_list.m'); 1535 1473 fid=fopen(filename_superbat,'w'); … … 1689 1627 filecell=[];%default 1690 1628 errormsg=''; 1691 ListProgram=get(handles. ListProgram,'String');1692 CivMode=ListProgram{get(handles. ListProgram,'Value')};%Program to use , CivX or Matlab1629 ListProgram=get(handles.Program,'String'); 1630 CivMode=ListProgram{get(handles.Program,'Value')};%Program to use , CivX or Matlab 1693 1631 1694 1632 %% get the root name and check dir … … 3891 3829 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished 3892 3830 3893 % --- Executes on selection change in ListProgram.3894 function ListProgram_Callback(hObject, eventdata, handles)3895 ListProgram=get(handles. ListProgram,'String');3896 Program=ListProgram{get(handles. ListProgram,'value')};3831 % --- Executes on selection change in Program. 3832 function Program_Callback(hObject, eventdata, handles) 3833 ListProgram=get(handles.Program,'String'); 3834 Program=ListProgram{get(handles.Program,'value')}; 3897 3835 switch Program 3898 3836 case 'CivX' … … 3911 3849 set(handles.CheckDeformation,'Value',1) 3912 3850 set(handles.CheckDecimal,'Value',1) 3913 case 'Matlab'3851 case {'civ_matlab','civ_matlab.sh'} 3914 3852 set(handles.num_MaxDiff,'Visible','on') 3915 3853 set(handles.num_MaxVel,'Visible','on') … … 3987 3925 %changes : filename_cmx -> filename ( no extension ) 3988 3926 errormsg=''; 3989 switch Param. CivMode3927 switch Param.Program 3990 3928 case 'CivX' 3991 3929 if Param.CheckCiv1 … … 4129 4067 fclose(fid); 4130 4068 end 4131 case 'Matlab'4069 case {'civ_matlab','civ_matlab.sh'} 4132 4070 filename=regexprep(Param.OutputFile,'(\w+)([/\\])(\w+$)','$1$20_XML$2$3.xml'); 4133 4071 save(struct2xml(Param),filename); … … 4135 4073 4136 4074 4137 function cmd=write_cmd(Param ,batch)4075 function cmd=write_cmd(Param) 4138 4076 4139 4077 % initiate system command 4140 4078 cmd=[]; 4141 4079 4142 switch Param. CivMode4080 switch Param.Program 4143 4081 case 'CivX' 4144 4082 if isunix % check: necessaire aussi en RUN? … … 4160 4098 4161 4099 if Param.CheckCiv1 4162 switch Param. CivMode4100 switch Param.Program 4163 4101 case 'CivX' 4164 4102 if(isunix) %unix (or Mac) system … … 4189 4127 4190 4128 if Param.CheckFix1 4191 switch Param. CivMode4129 switch Param.Program 4192 4130 case 'CivX' 4193 4131 cmd=[cmd... … … 4216 4154 %CheckPatch1 4217 4155 if Param.CheckPatch1 4218 switch Param. CivMode4156 switch Param.Program 4219 4157 case 'CivX' 4220 4158 cmd=[cmd... … … 4267 4205 4268 4206 if Param.CheckCiv2 4269 switch Param. CivMode4207 switch Param.Program 4270 4208 case 'CivX' 4271 4209 if(isunix) … … 4297 4235 % CheckFix2 4298 4236 if Param.CheckFix2==1 4299 switch Param. CivMode4237 switch Param.Program 4300 4238 case 'CivX' 4301 4239 cmd=[cmd... … … 4324 4262 if Param.CheckPatch2==1 4325 4263 4326 switch Param. CivMode4264 switch Param.Program 4327 4265 4328 4266 case 'CivX' … … 4375 4313 end 4376 4314 4377 if isequal(Param. CivMode,'CivAll')4315 if isequal(Param.Program,'CivAll') 4378 4316 save(CivAllxml,[Param.OutputFile '.xml']); 4379 4317 cmd=[cmd sparam.CivBin ' -f ' Param.OutputFile '.xml ' CivAllCmd ' >' Param.OutputFile '.log' '\n']; 4380 4318 end 4381 4319 4382 if isequal(Param. CivMode,'Matlab')4383 if batch>14320 if isequal(Param.Program,'civ_matlab') 4321 if strcmp(Param.RunMode,'cluster')||strcmp(Param.RunMode,'background') 4384 4322 cmd=['#!/bin/bash \n '... 4385 4323 '#$ -cwd \n '... … … 4402 4340 4403 4341 4404 if isequal(Param. CivMode,'MatlabCompile')4342 if isequal(Param.Program,'civ_matlab.sh') 4405 4343 cmd=['#!/bin/bash \n '... 4406 4344 '#$ -cwd \n '... … … 4411 4349 4412 4350 4413 if isequal(Param. CivMode,'MatlabNonCompile')4351 if isequal(Param.Program,'MatlabNonCompile') 4414 4352 % cmd=[regexprep(which(civ_matlab),'.m$','')... 4415 4353 % '(' regexprep(filename,'(\w+)/(\w+$)','$1/0_XML$2.xml,')... -
trunk/src/find_file_series.m
r468 r469 56 56 switch FileType 57 57 case 'multimage' 58 % NomType='*'; 59 % i1_series=(1:FileInfo.NbFrame)'; 60 NbFrame=FileInfo.NbFrame; 58 NbFrame=FileInfo.NumberOfFrames; 61 59 case {'video','mmreader'} 62 60 NomType='*'; 63 61 NbFrame=FileInfo.NumberOfFrames; 64 % i1_series=(1:FileInfo.NumberOfFrames)';65 62 end 66 % if strcmp( FileType,'multimage')||strcmp( FileType,'video')||strcmp( FileType,'mmreader') 67 % NomType='*'; 68 % i1_series=(1:FileInfo.NumberOfFrames)'; 69 % end 63 70 64 RootFile_i=''; 71 65 NomTypePref=''; … … 91 85 end 92 86 if ~isempty(rr) 93 RootFile_i=[RootFile rr.i1]; 94 % checkpair=~isempty(regexp(NomType,'-','once'))||~isempty(regexp(NomType,'ab$','once'))||~isempty(regexp(NomType,'AB$','once'));%case of PIV results 95 if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || exist(fullfile(RootPath,[RootFile_i '.xml']),'file') 87 RootFile_i=[RootFile rr.i1];% new root file 88 if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file')) 96 89 RootFile=RootFile_i; 97 90 NomTypePref=r.tiretnum; -
trunk/src/get_file_type.m
r446 r469 5 5 % OUTPUT: 6 6 % FileType: type of file 7 % FileInfo: structure containing info on the file (case of images) 7 % FileInfo: structure containing info on the file (case of images or video), in particular 8 % .Height: image height in pixels 9 % .Width: image width in pixels 10 % .BitDepth: nbre of bits per pixel (8 of 16) 11 % .ColorType: 'greyscale' or 'color' 12 % .NumberOfFrames 13 % .FrameRate: nbre of frames per second, =[] for images 8 14 % Object: in case of video 9 15 % … … 26 32 FileType='xls'; 27 33 otherwise 28 if ~isempty( FileExt)&& ~isempty(imformats(FileExt(2:end)))34 if ~isempty(imformats(regexprep(FileExt,'^.',''))) 29 35 try 30 FileType='image';31 36 imainfo=imfinfo(fileinput); 32 37 if length(imainfo) >1 %case of image with multiple frames 33 38 FileType='multimage'; 34 FileInfo=imainfo {1};%take info from the first frame35 FileInfo.N bFrame=length(imainfo);39 FileInfo=imainfo(1);%take info from the first frame 40 FileInfo.NumberOfFrames=length(imainfo); 36 41 else 42 FileType='image'; 37 43 FileInfo=imainfo; 44 FileInfo.NumberOfFrames=1; 38 45 end 39 46 end … … 75 82 if exist('VideoReader.m','file')%recent version of Matlab 76 83 VideoObject=VideoReader(fileinput); 77 FileInfo .NumberOfFrames=get(VideoObject,'NumberOfFrames');84 FileInfo=get(VideoObject); 78 85 FileType='video'; 79 86 elseif exist('mmreader.m','file')% Matlab 2009a 80 87 VideoObject=mmreader(fileinput); 81 FileInfo .NumberOfFrames=get(VideoObject,'NumberOfFrames');88 FileInfo=get(VideoObject); 82 89 FileType='mmreader'; 83 end 90 end 91 FileInfo.BitDepth=FileInfo.BitsPerPixel/3; 84 92 end 85 93 end -
trunk/src/uvmat.m
r460 r469 906 906 907 907 %% read parameters (time, geometric calibration..) from a documentation file (.xml advised) 908 SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 909 filexml=fullfile(RootPath,[SubDirBase '.xml']);% new convention: xml above the image dir 910 DocExt='.xml'; 911 if ~exist(filexml,'file') 912 filexml=fullfile(RootPath,SubDir,[RootFile '.xml']);%old convention: xml within the image directroy 913 if ~exist(filexml,'file') 914 filexml=fullfile(RootPath,SubDir,[RootFile '.civ']); % very old convention: .civ file 915 if exist(filexml,'file') 916 DocExt='.civ'; 917 else 918 filexml=''; 919 end 920 end 921 end 908 XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt); 909 [tild,tild,DocExt]=fileparts(XmlFileName); 922 910 warntext='';%default warning message 923 911 NbSlice=1;%default 924 912 set(handles.RootPath,'BackgroundColor',[1 1 1]) 925 if ~isempty( filexml)913 if ~isempty(XmlFileName) 926 914 set(handles.view_xml,'Visible','on') 927 915 set(handles.view_xml,'BackgroundColor',[1 1 0]) 928 916 set(handles.view_xml,'String','view .xml') 929 917 drawnow 930 [XmlDataRead,warntext]=imadoc2struct( filexml);918 [XmlDataRead,warntext]=imadoc2struct(XmlFileName); 931 919 if ~isempty(warntext) 932 920 msgbox_uvmat('WARNING',warntext) … … 951 939 if ~isempty(hgeometry_calib) 952 940 GUserData=get(hgeometry_calib,'UserData'); 953 if ~(isfield(GUserData,'XmlInputFile') && strcmp(GUserData.XmlInputFile, filexml))941 if ~(isfield(GUserData,'XmlInputFile') && strcmp(GUserData.XmlInputFile,XmlFileName)) 954 942 answer=msgbox_uvmat('INPUT_Y-N','replace the display of geometry_calib with the new input data?'); 955 943 if strcmp(answer,'Yes') 956 geometry_calib( filexml);%diplay the new calibration points and parameters in geometry_calib944 geometry_calib(XmlFileName);%diplay the new calibration points and parameters in geometry_calib 957 945 end 958 946 end
Note: See TracChangeset
for help on using the changeset viewer.