Changeset 229 for trunk/src/civ.m
- Timestamp:
- Apr 2, 2011, 9:48:51 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r227 r229 1130 1130 end 1131 1131 set(handles.list_pair_civ1,'String',displ_pair'); 1132 ichoice= min(find(select));1132 ichoice=find(select,1); 1133 1133 if (isempty(ichoice) || ichoice < 1); ichoice=1; end; 1134 1134 initial=get(handles.list_pair_civ1,'Value');%initial choice of pair … … 1310 1310 end 1311 1311 val=get(handles.list_pair_civ2,'Value'); 1312 ichoice= min(find(select));1312 ichoice=find(select,1); 1313 1313 if (isempty(ichoice) || ichoice < 1); ichoice=1; end; 1314 1314 if get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0 … … 1352 1352 lastfield=str2double(get(handles.nb_field,'String')); 1353 1353 if ~isnan(lastfield) 1354 ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& ...1355 (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield) );1356 num1=num1( ind);1354 test_find=(num1-floor(index_pair/2)*ones(size(num1))>0)& ... 1355 (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield); 1356 num1=num1(test_find); 1357 1357 end 1358 1358 set(handles.first_i,'String',num2str(num1(1))); … … 1365 1365 lastfield2=str2double(get(handles.nb_field2,'String')); 1366 1366 if ~isnan(lastfield2) 1367 ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...1368 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2) );1369 num1=num_j( ind);1367 test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 1368 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); 1369 num1=num_j(test_find); 1370 1370 end 1371 1371 set(handles.first_j,'String',num2str(num1(1))); … … 1390 1390 lastfield=str2double(get(handles.nb_field,'String')); 1391 1391 if ~isnan(lastfield) 1392 ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& ...1393 (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield) );1394 num1=num1( ind);1392 test_find=(num1-floor(index_pair/2)*ones(size(num1))>0)& ... 1393 (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield); 1394 num1=num1(test_find); 1395 1395 end 1396 1396 set(handles.first_i,'String',num2str(num1(1))); … … 1403 1403 lastfield2=str2double(get(handles.nb_field2,'String')); 1404 1404 if ~isnan(lastfield2) 1405 ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...1406 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2) );1407 num1=num_j( ind);1405 test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 1406 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); 1407 num1=num_j(test_find); 1408 1408 end 1409 1409 set(handles.first_j,'String',num2str(num1(1))); … … 1418 1418 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1419 1419 batch=0; 1420 launch_jobs(hObject, eventdata, handles,batch);1420 errormsg=launch_jobs(hObject, eventdata, handles,batch); 1421 1421 set(handles.RUN, 'Enable','On') 1422 1422 set(handles.RUN,'BackgroundColor',[1 0 0]) 1423 1423 1424 1424 % start status callback to visualise results 1425 if isfield(handles,'status') && ~isequal(get(handles.CivAll,'Value'),3) 1425 if ~isempty(errormsg) 1426 display(errormsg) 1427 msgbox_uvmat('ERROR',errormsg) 1428 elseif isfield(handles,'status') && ~isequal(get(handles.CivAll,'Value'),3) 1426 1429 set(handles.status,'Value',1);%suppress status display 1427 1430 status_Callback(hObject, eventdata, handles) … … 1435 1438 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784]) 1436 1439 batch=1; 1437 launch_jobs(hObject, eventdata, handles, batch) 1440 errormsg=launch_jobs(hObject, eventdata, handles, batch); 1438 1441 set(handles.BATCH, 'Enable','On') 1439 1442 set(handles.BATCH,'BackgroundColor',[1 0 0]) 1440 1443 1441 1444 % start status callback to visualise results 1442 if isfield(handles,'status') 1443 set(handles.status,'Value',1);%suppress status display 1444 status_Callback(hObject, eventdata, handles) 1445 if ~isempty(errormsg) 1446 display(errormsg) 1447 msgbox_uvmat('ERROR',errormsg) 1448 elseif isfield(handles,'status') 1449 set(handles.status,'Value',1);%suppress status display 1450 status_Callback(hObject, eventdata, handles) 1445 1451 end 1446 1452 1447 1453 %------------------------------------------------------------------------ 1448 1454 % --- Lauch command called by RUN and BATCH: remote processing 1449 function launch_jobs(hObject, eventdata, handles, batch)1455 function errormsg=launch_jobs(hObject, eventdata, handles, batch) 1450 1456 %----------------------------------------------------------------------- 1457 errormsg='';%default 1451 1458 %% check the selected list of operations: 1452 1459 operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; … … 1459 1466 index_first=find(box_test==1,1); 1460 1467 if isempty(index_first) 1461 msgbox_uvmat('ERROR','no selected operation')1468 errormsg='no selected operation'; 1462 1469 return 1463 1470 end … … 1466 1473 [box_missing,ind_missing]=min(box_used); 1467 1474 if isequal(box_missing,0); %there is a missing step in the sequence of operations 1468 msgbox_uvmat('ERROR',['missing' cell2mat(operations(ind_missing))]);1475 errormsg=['missing' cell2mat(operations(ind_missing))]; 1469 1476 return 1470 1477 end … … 1506 1513 [ref_i,ref_j,errormsg]=find_ref_indices(handles); 1507 1514 if ~isempty(errormsg) 1508 msgbox_uvmat('ERROR',errormsg)1509 1515 return 1510 1516 end … … 1530 1536 sparam=s.BatchParam; 1531 1537 if ~ismember(sparam.BatchMode,{'sge'}) 1532 msgbox_uvmat('ERROR',['batch mode ' sparam.BatchMode ' not supported by UVMAT']) 1538 errormsg=['batch mode ' sparam.BatchMode ' not supported by UVMAT']; 1539 return 1533 1540 end 1534 1541 else 1535 msgbox_uvmat('ERROR','no batch civ binaries defined in PARAM.xml')1542 errormsg='no batch civ binaries defined in PARAM.xml'; 1536 1543 return 1537 1544 end … … 1550 1557 'ListString',str,'ListSize',[200 200],'Name','job priority','InitialValue',3); 1551 1558 if isequal(v,0) % to handle Cancel button and figure close, 1559 errormsg='job cancelled'; 1552 1560 return % a better way should be create 1553 1561 end … … 1577 1585 if isfield(sparam,'Civ1Bin') 1578 1586 Civ1Bin=sparam.Civ1Bin; 1579 which(Civ1Bin)1580 1587 if ~exist(Civ1Bin,'file')||~isempty(which(Civ1Bin))% if path defined as relative to uvmat 1581 1588 sparam.Civ1Bin=fullfile(path_UVMAT,Civ1Bin); … … 1791 1798 i_cmd=i_cmd+1; 1792 1799 if isequal(civAll,0) 1793 if(isunix)1794 cmd=[cmd 'cp -f ' flname '.civ1.cmx ' flname '.cmx\n'];1795 else1796 flname=regexprep(flname,'\\','\\\\');1797 cmd=[cmd 'copy /Y "' flname '.civ1.cmx" "' flname '.cmx"\n'];1798 end1799 cmd=[cmd CIV1_CMD(fullfile(Rootbat,Filebat),'',par_civ1,handles,sparam) '\n'] 1800 % if(isunix) 1801 % cmd=[cmd 'cp -f ' flname '.civ1.cmx ' flname '.cmx\n']; 1802 % else 1803 % flname=regexprep(flname,'\\','\\\\'); 1804 % cmd=[cmd 'copy /Y "' flname '.civ1.cmx" "' flname '.cmx"\n']; 1805 % end 1806 cmd=[cmd CIV1_CMD(fullfile(Rootbat,Filebat),'',par_civ1,handles,sparam) '\n']; 1800 1807 else 1801 1808 civAllCmd=[civAllCmd ' civ1 ']; … … 1907 1914 if box_test(4)==1 || box_test(5)==1 || box_test(6)==1 1908 1915 filename_cmx=filecell.nc.civ2{ifile,j};%output netcdf file 1909 filename_cmx( [end-1:end+1])=[ 'cmx'];%name of cmx file1916 filename_cmx(end-1:end+1)='cmx';%name of cmx file 1910 1917 end 1911 1918 … … 1919 1926 par_civ2.term_b=num2stra(num_b_civ2(j),nom_type_nc); 1920 1927 par_civ2.filename_nc1=filecell.nc.civ1{ifile,j}; 1921 par_civ2.filename_nc1( [end-2:end])=[]; % remove '.nc'1928 par_civ2.filename_nc1(end-2:end)=[]; % remove '.nc' 1922 1929 test_mask=get(handles.get_mask_civ2,'Value'); 1923 1930 if test_mask==0 … … 2160 2167 if ~batch && ~isequal(get(handles.CivAll,'Value'),3) 2161 2168 [Rootbat,Filebat,extbat]=fileparts(filename_bat); 2162 filename_superbat=fullfile(Rootbat, ['job_list.bat']);2169 filename_superbat=fullfile(Rootbat,'job_list.bat'); 2163 2170 fid=fopen(filename_superbat,'w'); 2164 2171 fprintf(fid,super_cmd'); … … 2361 2368 last_j=str2double(get(handles.last_j,'String')); 2362 2369 incr_j=str2double(get(handles.incr_j,'String')); 2363 num_i_ref= [first_i:incr_i:last_i];2364 num_j_ref= [first_j:incr_j:last_j];2370 num_i_ref=first_i:incr_i:last_i; 2371 num_j_ref=first_j:incr_j:last_j; 2365 2372 if isequal(mode,'displacement') 2366 2373 num_i1=num_i_ref; … … 2920 2927 end 2921 2928 if box_test(4)==1 %if civ2 is performed 2922 h = waitbar(0, ['copy images to the .png format for civ2']);% display a wait bar2929 h = waitbar(0,'copy images to the .png format for civ2');% display a wait bar 2923 2930 for ifile=1:nbfield 2924 2931 waitbar(ifile/nbfield); … … 2969 2976 num_a_civ1=ref_j; 2970 2977 num_b_civ1=ref_j; 2971 num1_civ2=ref_i-floor(index_civ2/2)*ones(size(ref_i)); ;2978 num1_civ2=ref_i-floor(index_civ2/2)*ones(size(ref_i)); 2972 2979 num2_civ2=ref_i+ceil(index_civ2/2)*ones(size(ref_i)); 2973 2980 num_a_civ2=ref_j; … … 3286 3293 filebase_a=get(handles.RootName_1,'String'); 3287 3294 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 3288 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice)3295 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) 3289 3296 mask_displ='no mask'; 3290 3297 end … … 3330 3337 filebase_a=get(handles.RootName_1,'String'); 3331 3338 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 3332 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice)3339 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) 3333 3340 mask_displ='no mask'; 3334 3341 end … … 3371 3378 filebase_a=get(handles.RootName_1,'String'); 3372 3379 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 3373 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice)3380 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) 3374 3381 mask_displ='no mask'; 3375 3382 end … … 3603 3610 'Pick a file',filebase); 3604 3611 filegrid=fullfile(PathName,FileName); 3605 if isempty(FileName)| isempty(PathName)|isequal(FileName,0)|~exist(filegrid,'file')3612 if isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filegrid,'file') 3606 3613 set(handles.browse_gridciv2,'Value',0); 3607 3614 set(handles.grid_civ2,'string',''); … … 4156 4163 civ1.mask=par.maskname; 4157 4164 end 4158 civ1.dt= 1%par.Dt;4165 civ1.dt=par.Dt; 4159 4166 civ1.unit='pixel'; 4160 4167 civ1.absolut_time_T0=par.T0; … … 4387 4394 end 4388 4395 4389 % open an image file with the browser4396 %% open an image file with the browser 4390 4397 ind_opening=1;%default 4391 4398 browse.incr_pair=[0 0]; %default 4392 4399 oldfile=get(handles.RootName,'String'); 4393 menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 4394 '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... 4395 '*.*', 'All Files (*.*)'}; 4396 [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); 4400 menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)'; 4401 '*.xml', '.xml files '; ... 4402 '*.civ', '.civ files '; ... 4403 '*.png','.png image files'; ... 4404 '*.jpg',' jpeg image files'; ... 4405 '*.tif','.tif image files'; ... 4406 '*.avi;*.AVI','.avi movie files'; ... 4407 '*.nc','.netcdf files'; ... 4408 '*.*', 'All Files (*.*)'}; 4409 [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file of the second series',oldfile); 4397 4410 fileinput=[PathName FileName];%complete file name 4398 4411 sizf=size(fileinput); 4399 if (~ischar(fileinput)| ~isequal(sizf(1),1)),return;end %stop if fileinput not a character string4412 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string 4400 4413 [path,name,ext]=fileparts(fileinput); 4401 4414 [path1]=fileparts(filebase); 4415 % if isunix 4416 % ['readlink ' path] 4417 % [status,path]=system(['readlink ' path]) 4418 % [status,path1]=system(['readlink ' path1])% look for the true path in case of symbolic paths 4419 % end 4402 4420 if ~strcmp(path1,path) 4403 4421 msgbox_uvmat('ERROR','The two input image series must be in the same directory') … … 4412 4430 %check image extension 4413 4431 if ~strcmp(ext,get(handles.ImaExt,'String')) 4414 msgbox_uvmat('ERROR','The two input image series must have the same exten ion name')4432 msgbox_uvmat('ERROR','The two input image series must have the same extension name') 4415 4433 return 4416 4434 end 4417 4435 4418 %check image size 4419 A=imread(fileinput); 4420 npxy=get(handles.ImaExt,'UserData'); 4421 if ~isequal(npxy(1),size(A,1))|| ~isequal(npxy(2),size(A,2)) 4422 msgbox_uvmat('ERROR','The two input image series must have the same size') 4436 %% check coincidence of image sizes 4437 ref_i=get(handles.ref_i,'string'); 4438 ref_j=get(handles.ref_j,'string'); 4439 [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]); 4440 A=imread(filecell.ima1.civ1{1}); 4441 A_1=imread(fileinput); 4442 npxy=size(A); 4443 npxy_1=size(A_1); 4444 if ~isequal(size(A),size(A_1)) 4445 msgbox_uvmat('ERROR','The two input image series do not have the same size') 4423 4446 return 4424 4447 end
Note: See TracChangeset
for help on using the changeset viewer.