Changeset 387 for trunk/src/civ.m
- Timestamp:
- Apr 4, 2012, 3:31:30 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r386 r387 1095 1095 Param.xml=s.RunParam; 1096 1096 else 1097 msgbox_uvmat('ERROR','no run civ binaries defined in PARAM.xml')1097 errormsg='no run civ binaries defined in PARAM.xml'; 1098 1098 return 1099 1099 end … … 1110 1110 [s,w]=system(test_command); 1111 1111 if ~isequal(s,0) 1112 msgbox_uvmat('ERROR',[batch_mode ' batch system not available'])1112 errormsg=[batch_mode ' batch system not available']; 1113 1113 return 1114 1114 end … … 1137 1137 Param.xml.(bin_name{1})=fullname; 1138 1138 else 1139 msgbox_uvmat('ERROR',['Binary ' Param.xml.(bin_name{1}) ' defined in PARAM.xml does not exist'])1139 errormsg=['Binary ' Param.xml.(bin_name{1}) ' defined in PARAM.xml does not exist']; 1140 1140 return 1141 1141 end … … 1239 1239 % Param.Civ1.Grid=[filecell.filebase '_' name_generator(Param.Civ1.Grid,i1_grid,1,'.grid','_i')]; 1240 1240 if ~exist(Param.Civ1.GridName,'file') 1241 msgbox_uvmat('ERROR','grid file absent for civ1') 1241 errormsg='grid file absent for civ1'; 1242 return 1242 1243 end 1243 1244 elseif ~exist(Param.Civ1.Grid,'file') 1244 msgbox_uvmat('ERROR','grid file absent for civ1') 1245 errormsg='grid file absent for civ1'; 1246 return 1245 1247 end 1246 1248 end … … 1250 1252 switch CivMode 1251 1253 case 'CivX' 1252 cmd=[cmd...1253 cmd_civ1(filecell.nc.civ1{ifile,j},Param)'\n'];1254 [cmd_civ,errormsg]=cmd_civ1(filecell.nc.civ1{ifile,j},Param); 1255 cmd=[cmd cmd_civ '\n']; 1254 1256 if ~isempty(errormsg) 1255 msgbox_uvmat('ERROR',errormsg)1256 1257 return 1257 1258 end … … 1318 1319 % patch1.gridPatch=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1319 1320 if ~exist(patch1.gridPatch,'file') 1320 msgbox_uvmat('ERROR','grid file absent for patch1') 1321 errormsg='grid file absent for patch1'; 1322 return 1321 1323 end 1322 1324 elseif exist(gridname,'file') 1323 1325 patch1.gridPatch=gridname; 1324 1326 else 1325 msgbox_uvmat('ERROR','grid file absent for patch1') 1327 errormsg='grid file absent for patch1'; 1328 return 1326 1329 end 1327 1330 end … … 1456 1459 % patch2.gridPatch=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1457 1460 if ~exist(patch2.gridPatch,'file') 1458 msgbox_uvmat('ERROR','grid file absent for patch2') 1461 errormsg='grid file absent for patch2'; 1462 return 1459 1463 end 1460 1464 elseif exist(gridname,'file') 1461 1465 patch2.gridPatch=gridname; 1462 1466 else 1463 msgbox_uvmat('ERROR','grid file absent for patch2') 1467 errormsg='grid file absent for patch2'; 1468 return 1464 1469 end 1465 1470 end … … 1495 1500 [fid,message]=fopen(filename_bat,'w'); 1496 1501 if isequal(fid,-1) 1497 msgbox_uvmat('ERROR', ['creation of .bat file: ' message])1502 errormsg=['creation of .bat file: ' message]; 1498 1503 return 1499 1504 end … … 1516 1521 [fid,message]=fopen(filename_bat,'w'); 1517 1522 if isequal(fid,-1) 1518 msgbox_uvmat('ERROR', ['creation of .bat file: ' message])1523 errormsg= ['creation of .bat file: ' message]; 1519 1524 return 1520 1525 end … … 1537 1542 if isempty(errormsg) 1538 1543 display([filecell.nc.civ1{ifile,j} ' written']) 1539 else1540 msgbox_uvmat('ERROR',errormsg)1544 % else 1545 % msgbox_uvmat('ERROR',errormsg) 1541 1546 end 1542 1547 end … … 3031 3036 else %case civ2 alone 3032 3037 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 3033 if ~exist(fullfile( filepath,subdir_civ2,ext_dir),'dir')3038 if ~exist(fullfile(RootPath,subdir_civ2,ext_dir),'dir') 3034 3039 errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) 3035 3040 set(handles.ListPairCiv2,'Value',1); … … 3637 3642 end 3638 3643 end 3639 %------------------------------------------------------------------------ 3640 % --- Executes on button press in CheckMask. 3644 3645 %------------------------------------------------------------------------ 3646 % --- Executes on button press in CheckMask: common to all panels (civ1, Civ2..) 3641 3647 function CheckMask_Callback(hObject, eventdata, handles) 3642 3648 %------------------------------------------------------------------------ … … 3645 3651 parent_tag=get(hparent,'Tag'); 3646 3652 hchildren=get(hparent,'children'); 3647 handle_txtbox=findobj(hchildren,'tag','txt_Mask'); 3648 % handle_dx=findobj(hchildren,'tag','num_Dx'); 3649 % handle_dy=findobj(hchildren,'tag','num_Dy'); 3653 handle_txtbox=findobj(hchildren,'tag','Mask');% look for the mask name box in the same panel 3650 3654 testmask=0; 3651 3655 if value … … 3673 3677 end 3674 3678 if testmask 3675 % stage=4;%default3676 3679 if strcmp(parent_tag,'Civ1') 3677 3680 set(handles.Mask,'Visible','on') 3678 3681 set(handles.Mask,'String',filemask) 3679 3682 set(handles.CheckMask,'Value',1) … … 3907 3910 Data.VarDimName= {'ny','nx',{'ny','nx'}}; 3908 3911 Data.A=imread(filecell.ima1.civ1{1}); 3912 if ndims(Data.A)==3 %case of color image 3913 Data.VarDimName= {'ny','nx',{'ny','nx','rgb'}}; 3914 end 3909 3915 Data.ny=[size(Data.A,1) 1]; 3910 3916 Data.nx=[1 size(Data.A,2)]; … … 3915 3921 Param.Civ1=par_civ1; 3916 3922 Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV 3917 hview_field=view_field(Data); 3923 hview_field=view_field(Data); %view the image in the GUI view_field 3918 3924 set(0,'CurrentFigure',hview_field) 3919 3925 hhview_field=guihandles(hview_field); … … 3960 3966 3961 3967 %------------------------------------------------------------------------ 3962 function cmd=cmd_civ1(filename,Param)3968 function [cmd,errormsg]=cmd_civ1(filename,Param) 3963 3969 %------------------------------------------------------------------------ 3964 3970 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 3965 3971 %changes : filename_cmx -> filename ( no extension ) 3966 3972 cmd=''; 3967 errormsg=''; %default3968 3973 filename=regexprep(filename,'.nc',''); %file name for the result 3969 3974 if isequal(Param.Civ1.Dt,0) … … 3972 3977 Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'.png',''); 3973 3978 Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'.png',''); 3974 fid=fopen([filename '.civ1.cmx'],'w');3979 [fid,errormsg]=fopen([filename '.civ1.cmx'],'w'); 3975 3980 if isequal(fid,-1) 3976 display(['cmd file ' filename ' cannot be created'])3981 errormsg=['cmd file ' filename ' cannot be created: ' errormsg]; 3977 3982 return 3978 3983 end … … 4054 4059 filename=regexprep(filename,'.nc',''); 4055 4060 MaskName_string='';%default 4056 % if Param.(fixname).CheckMask4057 % MaskName_string=[' -maskName "' Param.(fixname).Mask '"'];4058 % end4059 4061 MaxVel_string='';%default 4060 4062 if ~isempty(Param.(fixname).MaxVel) … … 4095 4097 %------------------------------------------------------------------------ 4096 4098 % --- CheckCiv2 CheckCiv2 CheckCiv2 CheckCiv2 4097 function cmd=cmd_civ2(filename,Param)4099 function [cmd,errormsg]=cmd_civ2(filename,Param) 4098 4100 %------------------------------------------------------------------------ 4099 4101 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4100 4102 % global civ2Bin sge%name of the executable for checkciv1 calculation 4103 cmd=''; 4101 4104 filename=regexprep(filename,'.nc',''); 4102 4105 if isequal(Param.Civ2.Dt,'0') … … 4107 4110 [fid,errormsg]=fopen([filename '.civ2.cmx'],'w'); 4108 4111 if isequal(fid,-1) 4109 msgbox_uvmat('ERROR',errormsg)4110 cmd='';4111 4112 return 4112 4113 end
Note: See TracChangeset
for help on using the changeset viewer.