Changeset 174
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r173 r174 267 267 oldfile=filebase; 268 268 end 269 testall=get(handles.ImaDoc,'UserData');269 % testall=get(handles.ImaDoc,'UserData'); 270 270 ind_opening=1;%default 271 271 browse.incr_pair=[0 0]; %default 272 if testall 273 menu={'*.*', 'All Files (*.*)'; '*.xml; *.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 274 '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc','.nc files'}; 275 else % menu selecting only .civ or .avi files 276 menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 277 '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... 278 '*.*', 'All Files (*.*)'}; 279 end 272 % if testall 273 % menu={'*.*', 'All Files (*.*)'; '*.xml; *.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 274 % '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc','.nc files'}; 275 % else % menu selecting only .civ or .avi files 276 menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)'; 277 '*.xml', '.xml files '; ... 278 '*.civ', '.civ files '; ... 279 '*.png','.png image files'; ... 280 '*.jpg',' jpeg image files'; ... 281 '*.tif','.tif image files'; ... 282 '*.avi;*.AVI','.avi movie files'; ... 283 '*.nc','.netcdf files'; ... 284 '*.*', 'All Files (*.*)'}; 285 % menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 286 % '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... 287 % '*.*', 'All Files (*.*)'}; 288 % end 280 289 [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); 281 290 fileinput=[PathName FileName];%complete file name … … 431 440 end 432 441 set(handles.browse_root,'UserData',browse);% store information from browser 433 testall=isequal(menu(filtindex,1),{'*.*'});434 set(handles.ImaDoc,'UserData',testall);442 % testall=isequal(menu(filtindex,1),{'*.*'}); 443 % set(handles.ImaDoc,'UserData',testall); 435 444 436 445 RootName_Callback(hObject, eventdata, handles); … … 1868 1877 civAllxml=set(civAllxml,1,'name','CivDoc'); 1869 1878 end 1870 filename_cmx=filecell.nc.civ1{ifile,j};%output netcdf file 1871 filename_cmx(end-1:end+1)='cmx';%name of cmx file 1879 %filename_cur=filecell.nc.civ1{ifile,j};%output netcdf file 1880 [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extention) 1881 %filename_cmx(end-1:end+6)='civ1.cmx';%name of cmx file 1872 1882 if batch 1873 [Rootbat,Filebat,extbat]=fileparts(filename_cmx);1874 filename_bat=fullfile(Rootbat,['job_' Filebat extbat]);1883 % [Rootbat,Filebat,extbat]=fileparts(filename_cmx); 1884 filename_bat=fullfile(Rootbat,['job_' Filebat]); 1875 1885 else 1876 filename_bat=f ilename_cmx;1877 end 1878 filename_bat (end-2:end)='bat';1886 filename_bat=fullfile(Rootbat,Filebat); 1887 end 1888 filename_bat=[filename_bat '.bat']; 1879 1889 1880 1890 %CIV1 … … 1882 1892 par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j}; 1883 1893 par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j}; 1884 namelog=[f ilename_cmx([1:end-3]) 'log'];1894 namelog=[fullfile(Rootbat,Filebat) '.civ1.log']; 1885 1895 par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j))); 1886 1896 par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2); … … 1935 1945 i_cmd=i_cmd+1; 1936 1946 if isequal(civAll,0) 1937 cmd=[cmd CIV1_CMD(f ilename_cmx(1:end-4),namelog,par_civ1,handles,sparam) '\n'];1947 cmd=[cmd CIV1_CMD(fullfile(Rootbat,Filebat),'',par_civ1,handles,sparam) '\n']; 1938 1948 else 1939 1949 civAllCmd=[civAllCmd ' civ1 ']; 1940 str=CIV1_CMD_Unified(f ilename_cmx([1:end-4]),namelog,par_civ1);1950 str=CIV1_CMD_Unified(fullfile(Rootbat,Filebat),'',par_civ1); 1941 1951 fieldnames=fields(str); 1942 1952 [civAllxml,uid_civ1]=add(civAllxml,1,'element','civ1'); … … 2054 2064 par_civ2.filename_ima_b=filecell.ima2.civ2{ifile,j}; 2055 2065 %par_civ2.filename_ima_b([end-3:end])=[];%remove .png extension 2056 namelog=[filename_cmx([1:end-3]) 'log']; 2066 [Rootbat,Filebat]=fileparts(filecell.nc.civ2{ifile,j});%output netcdf file (without extention) 2067 namelog=[fullfile(Rootbat,Filebat) '.civ2.log']; 2057 2068 par_civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j))); 2058 2069 par_civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2); … … 2108 2119 %endTESTgrid 2109 2120 i_cmd=i_cmd+1; 2110 cmd_CIV2=CIV2_CMD(f ilename_cmx(1:end-4),namelog,par_civ2,sparam);2121 cmd_CIV2=CIV2_CMD(fullfile(Rootbat,Filebat),[],par_civ2,sparam);%creates the cmx file [fullfile(Rootbat,Filebat) '.civ2.cmx] 2111 2122 if isequal(civAll,0) 2123 flname=fullfile(Rootbat,Filebat); 2112 2124 if(isunix) 2113 cmd=[cmd 'cp -f ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2 '\n'];2125 cmd=[cmd 'cp -f ' flname '.civ2.cmx ' flname '.cmx\n' cmd_CIV2 '\n']; 2114 2126 else 2115 f ilename_cmx=regexprep(filename_cmx,'\\','\\\\');2116 cmd=[cmd 'copy /Y "' f ilename_cmx '2" "' filename_cmx '"\n' cmd_CIV2 '\n'];2127 flname=regexprep(flname,'\\','\\\\'); 2128 cmd=[cmd 'copy /Y "' flname '.civ2.cmx" "' flname '.cmx"\n' cmd_CIV2 '\n']; 2117 2129 end 2118 2130 else … … 2253 2265 end 2254 2266 super_cmd=[super_cmd cmd_str '\n']; 2255 % eval(cmd_str);2256 2267 disp(cmd_str); 2257 2268 end … … 2478 2489 subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf output data 2479 2490 subdir_civ2=get(handles.subdir_civ2,'String'); 2480 if isequal(subdir_civ1,''),subdir_civ1=' A'; end% put default subdir2491 if isequal(subdir_civ1,''),subdir_civ1='CIV'; end% put default subdir 2481 2492 if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir 2482 2493 currentdir=pwd;%store the current working directory … … 2708 2719 %create the new subdir_civ2_new 2709 2720 if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir') 2710 [xx,m2]=mkdir( subdir_civ2_new);2721 [xx,m2]=mkdir(fullfile(Path_ima,subdir_civ2_new)); 2711 2722 [xx,msg2] = fileattrib(subdir_civ2_new,'+w','g'); %yield writing access (+w) to user group (g) 2712 2723 if ~isequal(m2,'') … … 4043 4054 4044 4055 %changes : filename_cmx -> filename ( no extension ) 4045 4056 % input namelog not used 4046 4057 if isequal(par.Dt,'0') 4047 4058 par.Dt='1' ;%case of 'displacement' mode … … 4086 4097 % namelog=regexprep(namelog,'\\','\\\\'); 4087 4098 if(isunix) 4088 [Rootbat,Filebat,extbat]=fileparts(namelog); 4089 ncName=fullfile(Rootbat,[ Filebat '.nc']); 4090 cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file 4091 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog ' ' regexprep(namelog,'\.log','') '.civ1.log' '\n' 'chmod g+w ' ncName]; 4099 % filename 4100 % namelog 4101 % 4102 % [Rootbat,Filebat,extbat]=fileparts(namelog); 4103 % ncName=fullfile(Rootbat,[ Filebat '.nc']); 4104 cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 4105 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc'];%rename .log as .civ1.log and set the netcdf result file for group user writting 4106 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx 4092 4107 else %Windows system 4108 filename=regexprep(filename,'\\','\\\\'); 4093 4109 cmd_CIV1=['"' sparam.Civ1Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file 4094 4110 cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\'); 4095 4111 namelog=regexprep(namelog,'\\','\\\\'); 4096 cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ1.log"']; 4112 cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; 4113 cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ1.cmx"']; 4097 4114 end 4098 4115 … … 4197 4214 par.Dt='1' ;%case of 'displacement' mode 4198 4215 end 4199 4200 4216 par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); 4201 4217 par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');% bug : .png appears two times ? 4202 fid=fopen([filename '.cmx2'],'w'); 4218 [fid,errormsg]=fopen([filename '.civ2.cmx'],'w'); 4219 if isequal(fid,-1) 4220 msgbox_uvmat('ERROR',errormsg) 4221 cmd_CIV2=''; 4222 return 4223 end 4203 4224 fprintf(fid,['############## CMX file' '\n' ]); 4204 4225 fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility … … 4234 4255 4235 4256 if(isunix) 4236 cmd_CIV2=[sparam.Civ2Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file 4237 [Rootbat,Filebat,extbat]=fileparts(namelog); 4238 ncName=fullfile(Rootbat,[ Filebat '.nc']); 4239 cmd_CIV2=[cmd_CIV2 '\n' 'mv ' namelog ' ' regexprep(namelog,'\.log','') '.civ2.log' '\n' 'chmod g+w ' ncName]; 4257 % cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 4258 % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc']; 4259 % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx, the result file is named [filename '.nc'] by CIVx 4260 4261 cmd_CIV2=[sparam.Civ2Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 4262 cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc']; 4263 cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.cmx' ' ' filename '.civ2.cmx' '\n'];%rename .cmx as .civ2.cmx, the result file is named [filename '.nc'] by CIVx 4264 % [Rootbat,Filebat,extbat]=fileparts(namelog); 4265 % ncName=fullfile(Rootbat,[ Filebat '.nc']); 4266 % cmd_CIV2=[cmd_CIV2 '\n' 'mv ' namelog ' ' regexprep(namelog,'\.log','') '.civ2.log' '\n' 'chmod g+w ' ncName]; 4240 4267 else 4268 filename=regexprep(filename,'\\','\\\\'); 4241 4269 cmd_CIV2=['"' sparam.Civ2Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file 4242 4270 cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\'); 4243 namelog=regexprep(namelog,'\\','\\\\');4244 cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ2.log"'];4271 cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"']; 4272 cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ2.cmx"']; 4245 4273 end 4246 4274 -
trunk/src/proj_field.m
r173 r174 918 918 %----------------------------------------------------------------- 919 919 920 %initialisation of the input parameters of the projection plane 921 %----------------------------------------------------------------- 920 %% initialisation of the input parameters of the projection plane 922 921 ProjMode='projection';%direct projection by default 923 922 if isfield(ObjectData,'ProjMode'),ProjMode=ObjectData.ProjMode; end; … … 948 947 NormVec_Y=cos(Phi)*sin(Theta); 949 948 NormVec_Z=cos(Theta); 950 951 % test for 3D fields952 test3D=0;953 if isfield(FieldData,'nb_dim')954 test3D=isequal(FieldData.nb_dim,3);955 end956 test3C=test3D; %default 3 vel components957 949 958 950 %mesh sizes DX and DY … … 1248 1240 Coord_y=[]; 1249 1241 Coord_x=[]; 1250 nb_dim=numel( size(DimValue));1242 nb_dim=numel(DimValue); 1251 1243 for idim=1:nb_dim %loop on space dimensions 1252 1244 test_interp(idim)=0;%test for coordiate interpolation (non regular grid), =0 by default … … 1296 1288 if nb_dim==3 1297 1289 DZ=abs(DCoord_min(1)); 1298 Coord_z=linspace(Coord{1}(1),Coord{1}(end), npz);1290 Coord_z=linspace(Coord{1}(1),Coord{1}(end),DimValue(1)); 1299 1291 test_direct_z=test_direct(1); 1300 1292 end … … 1342 1334 % case with no rotation and interpolation 1343 1335 if isequal(ProjMode,'projection') && isequal(Phi,0) && isequal(Theta,0) && isequal(Psi,0) 1344 if ~testXMin && ~testXMax && ~testYMin && ~testYMax 1336 if ~testXMin && ~testXMax && ~testYMin && ~testYMax && nb_dim==2 1345 1337 ProjData=FieldData; 1346 1338 else … … 1367 1359 Xbound(1)=Coord{2}(1)+DXinit*(min_ind2-1); 1368 1360 end 1361 if nb_dim==3 %TODO: to update 1362 min_ind3=ceil((Coord{1}(1)-ZMax)/DZinit)+1; 1363 max_ind2=floor((Coord{1}(2)-XMin)/DZinit)+1; 1364 Zbound(2)=Coord{1}(1)+DXinit*(max_ind2-1); 1365 Zbound(1)=Coord{1}(1)+DXinit*(min_ind2-1); 1366 end 1369 1367 min_ind1=max(min_ind1,1);% deals with margin (bound lower than the first index) 1370 1368 min_ind2=max(min_ind2,1); -
trunk/src/uvmat.m
r163 r174 426 426 end 427 427 [FileName, PathName] = uigetfile( ... 428 {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol;*.nc;*.cmx;*.fig;*.log;*.dat;*.bat;', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.vol,*.nc,*.cmx 428 {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol;*.nc;*.cmx;*.fig;*.log;*.dat;*.bat;', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.vol,*.nc,*.cmx,*.fig,*.log,*.dat,*.bat)'; 429 429 '*.xml', '.xml files '; ... 430 430 '*.xls', '.xls files '; ... … … 437 437 '*.nc','.netcdf files'; ... 438 438 '*.cdf','.netcdf files'; ... 439 '*.cmx','.cmx text files';... 440 '*.cmx2','.cmx2 text files';... 439 '*.cmx','.cmx text files ';... 441 440 '*.fig','.fig files (matlab fig)';... 442 441 '*.log','.log text files ';... … … 2205 2204 %read images 2206 2205 if ~isempty(filename) && isequal(FieldName,'image') 2206 Npz=1;%default 2207 2207 switch FileType 2208 2208 case 'movie' … … 2223 2223 case 'vol' 2224 2224 A=imread(filename); 2225 if isfield(UvData.XmlData,'Npy') 2226 Npz=size(A,1)/UvData.XmlData.Npy; 2227 A=reshape(A,Npz,UvData.XmlData.Npy,UvData.XmlData.Npx); 2228 end 2225 2229 case 'multimage' 2226 2230 A=imread(filename,num_i1); … … 2235 2239 Field{1}.AName='image'; 2236 2240 Field{1}.ListVarName={'AY','AX','A'}; % 2237 if size(A,3)==3;%color 2238 Field{1}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; % 2241 if ndims(A)==3 2242 if Npz==1;%color 2243 Field{1}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; % 2244 Field{1}.AY=[npxy(1)-0.5 0.5]; 2245 Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 2246 else 2247 Field{1}.ListVarName=['AZ' Field{1}.ListVarName]; 2248 Field{1}.VarDimName={'AZ','AY','AX',{'AZ','AY','AX'}}; 2249 Field{1}.AZ=[0.5 npxy(1)-0.5]; 2250 Field{1}.AY=[npxy(2)-0.5 0.5]; 2251 Field{1}.AX=[0.5 npxy(3)-0.5]; % coordinates of the first and last pixel centers 2252 end 2239 2253 else 2240 2254 Field{1}.VarDimName={'AY','AX',{'AY','AX'}}; % 2241 end2242 Field{1}.AY=Rangy;2243 Field{1}.AX=Rangx;2255 Field{1}.AY=[npxy(1)-0.5 0.5]; 2256 Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 2257 end 2244 2258 Field{1}.A=A; 2245 % Field{1}.CoordType='px'; %used for mouse_motion2246 2259 Field{1}.CoordUnit='pixel'; %used for mouse_motion 2247 2260 end … … 2488 2501 test_x=0; 2489 2502 test_z=0;% test for unstructured z coordinate 2490 UvData.ZMax=0;2491 UvData.ZMin=0;%default2503 % UvData.ZMax=0; 2504 % UvData.ZMin=0;%default 2492 2505 %UvData.Mesh=1; %default 2493 2506 [UvData.Field,errormsg]=check_field_structure(UvData.Field); … … 2522 2535 YName=UvData.Field.ListVarName{VarType{imax}.coord(2)}; 2523 2536 XName=UvData.Field.ListVarName{VarType{imax}.coord(3)}; 2524 end 2525 2537 eval(['ZMax=max(UvData.Field.' ZName ');']) 2538 eval(['ZMin=min(UvData.Field.' ZName ');']) 2539 end 2526 2540 eval(['XMax=max(UvData.Field.' XName ');']) 2527 2541 eval(['XMin=min(UvData.Field.' XName ');']) … … 2565 2579 UvData.Field.YMax=XMax; 2566 2580 UvData.Field.YMin=XMin; 2567 if test_z2581 if NbDim==3 2568 2582 UvData.Field.ZMax=ZMax; 2569 2583 UvData.Field.ZMin=ZMin; … … 2642 2656 if NbDim==3 && UvData.NewSeries 2643 2657 UvData.Object{1}.NbDim=UvData.NbDim;%test for 3D objects 2644 UvData.Object{1}.RangeZ= Field.Mesh;%main plotting plane2645 UvData.Object{1}.Coord(1,3)=(UvData. ZMin+UvData.ZMax)/2;%section at a middle plane chosen2658 UvData.Object{1}.RangeZ=UvData.Field.Mesh;%main plotting plane 2659 UvData.Object{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen 2646 2660 UvData.Object{1}.Phi=0; 2647 2661 UvData.Object{1}.Theta=0; … … 2649 2663 UvData.Object{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR 2650 2664 PlotHandles=get_plot_handles(handles); 2651 ZBounds(1)=UvData. ZMin; %minimum for the Z slider2652 ZBounds(2)=UvData. ZMax;%maximum for the Z slider2665 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 2666 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 2653 2667 UvData.Object{1}.Name='1-PLANE'; 2654 2668 UvData.Object{1}.enable_plot=1;
Note: See TracChangeset
for help on using the changeset viewer.