Changeset 248
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r246 r248 2152 2152 Param.Patch1.SubDomain=subdomain_patch1; 2153 2153 end 2154 if box_test(4)==1 2155 Param.Civ2=par_civ2; 2156 end 2154 2157 [Data,erromsg]=civ_uvmat(Param,filecell.nc.civ1{ifile,j}); 2155 2158 if isempty(errormsg) … … 2705 2708 if ~testdiff % civ2 or patch2 are written in the same file as civ1 2706 2709 if box_test(4)==0 ; %check the existence of civ2 if it is not calculated 2707 Data=nc2struct(filename,'ListGlobalAttribute','civ2'); 2708 if isempty(Data.civ2)||isequal(Data.civ2,0) 2710 Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2'); 2711 if ~isempty(Data.CivStage) && Data.CivStage<4 %test for civ files 2712 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 2713 filecell=[]; 2714 return 2715 elseif isempty(Data.civ2)||isequal(Data.civ2,0) 2709 2716 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 2710 2717 filecell=[]; … … 2712 2719 end 2713 2720 elseif box_test(3)==0; %check the existence of patch if it is not calculated 2714 Data=nc2struct(filename,'ListGlobalAttribute','patch'); 2715 if isempty(Data.patch)||isequal(Data.patch,0) 2721 Data=nc2struct(filename,'ListGlobalAttribute','CivStage','patch') 2722 if ~isempty(Data.CivStage) 2723 if Data.CivStage<3 %test for civ files 2724 msgbox_uvmat('ERROR',['no patch data in ' filename]) 2725 filecell=[]; 2726 return 2727 end 2728 elseif isempty(Data.patch)||isequal(Data.patch,0) 2716 2729 msgbox_uvmat('ERROR',['no patch data in ' filename]) 2717 2730 filecell=[]; … … 2801 2814 return 2802 2815 else 2803 Data=nc2struct(filename,'ListGlobalAttribute','civ2'); 2804 if isempty(Data.civ2)||isequal(Data.civ2,0) 2816 Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2'); 2817 if ~isempty(Data.CivStage) && Data.CivStage<4 %test for civ files 2818 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 2819 filecell=[]; 2820 return 2821 elseif isempty(Data.civ2)||isequal(Data.civ2,0) 2805 2822 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 2806 2823 filecell=[]; … … 4677 4694 end 4678 4695 [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... 4679 set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]) ;4696 set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]) 4680 4697 Data.ListVarName={'ny','nx','A'}; 4681 4698 Data.VarDimName={'ny','nx',{'ny','nx'}}; -
trunk/src/civ_uvmat.m
r246 r248 8 8 ListVarCiv1={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F'}; 9 9 ListVarFix1={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F','Civ1_FF'}; 10 mask=''; 11 maskname='';%default 10 12 11 13 %% Civ1 12 14 if isfield (Param,'Civ1') 13 15 par_civ1=Param.Civ1; 14 str2num(par_civ1.rho)15 16 image1=imread(par_civ1.filename_ima_a); 16 17 image2=imread(par_civ1.filename_ima_b); … … 30 31 PointCoord(:,1)=reshape(GridX,[],1); 31 32 PointCoord(:,2)=reshape(GridY,[],1); 32 33 if ~isempty(par_civ1.maskname) 34 maskname=par_civ1.maskname; 35 mask=imread(maskname); 36 end 33 37 % caluclate velocity data (y and v in indices, reverse to y component) 34 [xtable ytable utable vtable ctable F] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,-shifty,PointCoord,str2num(par_civ1.rho), []);38 [xtable ytable utable vtable ctable F] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,-shifty,PointCoord,str2num(par_civ1.rho), mask); 35 39 list_param=(fieldnames(par_civ1))'; 36 40 list_remove={'pxcmx','pxcmy','npx','npy','gridflag','maskflag','term_a','term_b','T0'}; … … 148 152 Data.CivStage=3; 149 153 end 154 155 %% Civ2 156 if isfield (Param,'Civ2') 157 par_civ2=Param.Civ2 158 image1=imread(par_civ2.filename_ima_a); 159 image2=imread(par_civ2.filename_ima_b); 160 stepx=str2num(par_civ2.dx); 161 stepy=str2num(par_civ2.dy); 162 ibx2=ceil(str2num(par_civ2.ibx)/2); 163 iby2=ceil(str2num(par_civ2.iby)/2); 164 isx2=4; 165 isy2=4; 166 % shiftx=str2num(par_civ1.shiftx); 167 % shifty=str2num(par_civ1.shifty); 168 % TO GET shift from par_civ2.filename_nc1 169 miniy=max(1+isy2+shifty,1+iby2); 170 minix=max(1+isx2-shiftx,1+ibx2); 171 maxiy=min(size(image1,1)-isy2+shifty,size(image1,1)-iby2); 172 maxix=min(size(image1,2)-isx2-shiftx,size(image1,2)-ibx2); 173 [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy); 174 PointCoord(:,1)=reshape(GridX,[],1); 175 PointCoord(:,2)=reshape(GridY,[],1); 176 if ~isempty(par_civ2.maskname)&& ~strcmp(maskname,par_civ2.maskname)% mask exist, not already read in civ1 177 mask=imread(par_civ2.maskname); 178 end 179 % caluclate velocity data (y and v in indices, reverse to y component) 180 [xtable ytable utable vtable ctable F] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,-shifty,PointCoord,str2num(par_civ1.rho),mask); 181 list_param=(fieldnames(par_civ1))'; 182 list_remove={'pxcmx','pxcmy','npx','npy','gridflag','maskflag','term_a','term_b','T0'}; 183 index=zeros(size(list_param)); 184 for ilist=1:length(list_remove) 185 index=strcmp(list_remove{ilist},list_param); 186 if ~isempty(find(index,1)) 187 list_param(index)=[]; 188 end 189 end 190 for ilist=1:length(list_param) 191 Civ1_param{ilist}=['Civ1_' list_param{ilist}]; 192 eval(['Data.Civ1_' list_param{ilist} '=Param.Civ1.' list_param{ilist} ';']) 193 end 194 if isfield(Data,'Civ1_gridname') && strcmp(Data.Civ1_gridname(1:6),'noFile') 195 Data.Civ1_gridname=''; 196 end 197 if isfield(Data,'Civ1_maskname') && strcmp(Data.Civ1_maskname(1:6),'noFile') 198 Data.Civ1_maskname=''; 199 end 200 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param {'Civ1_Time','Civ1_Dt'}]; 201 Data.Civ1_Time=str2double(par_civ1.T0); 202 Data.Civ1_Dt=str2double(par_civ1.Dt); 203 Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F'};% cell array containing the names of the fields to record 204 Data.VarDimName={'nbvec1','nbvec1','nbvec1','nbvec1','nbvec1','nbvec1'}; 205 Data.VarAttribute{1}.Role='coord_x'; 206 Data.VarAttribute{2}.Role='coord_y'; 207 Data.VarAttribute{3}.Role='vector_x'; 208 Data.VarAttribute{4}.Role='vector_y'; 209 Data.VarAttribute{5}.Role='warnflag'; 210 Data.Civ1_X=reshape(xtable,[],1); 211 Data.Civ1_Y=reshape(size(image1,1)-ytable+1,[],1); 212 Data.Civ1_U=reshape(utable,[],1); 213 Data.Civ1_V=reshape(-vtable,[],1); 214 Data.Civ1_C=reshape(ctable,[],1); 215 Data.Civ1_F=reshape(F,[],1); 216 Data.CivStage=Data.CivStage+1; 217 end 150 218 %% write result 151 219 % 'TESTcalc' -
trunk/src/editxml.m
r180 r248 330 330 head_name=get(t,1,'name'); 331 331 %Path to shemas: 332 %path_uvmat=which('editxml');% check the path detected for source file uvmat333 %path_UVMAT=fileparts(path_uvmat); %path to UVMAT334 % xmlparam=fullfile(path_UVMAT,'PARAM.xml');332 path_uvmat=which('editxml');% check the path detected for source file uvmat 333 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 334 % xmlparam=fullfile(path_UVMAT,'PARAM.xml'); 335 335 xmlparam='PARAM.xml'; %will find PARAM.xml whose path is set in priority 336 336 if exist(xmlparam,'file') … … 338 338 sparam=convert(tparam); 339 339 if isfield(sparam,'SchemaPath') 340 schemafile=[fullfile(sparam.SchemaPath,head_name) '.xsd']; 341 end 342 if ~exist(schemafile,'file') 343 schemafile=fullfile(path_UVMAT,schemafile);%look for relative path definition 344 end 345 if exist(schemafile,'file') 346 xs=xmltree(schemafile); 347 else 348 msgbox_uvmat('ERROR',['The xml schema for ' CurrentFile ' is unknown, check the schema path set in the file PARAM.xml']) 349 [FileName, PathName]=uigetfile( ... 350 {'*.xsd', '(*.xsd)'; 351 '*.xsd', '.xsd files '; ... 352 '*.*', 'All Files (*.*)'}, ... 353 'Pick a .xsd schema' ,schemafile); %file browser 354 if ischar(PathName) && ischar(FileName) && exist(fullfile(PathName,FileName),'file') 355 DataIn.Schema=fullfile(PathName,FileName); 356 xs=xmltree(DataIn.Schema);%open the associated schema file 340 schemafile=[fullfile(sparam.SchemaPath,head_name) '.xsd']; 341 if ~exist(schemafile,'file') 342 schemafile=fullfile(path_UVMAT,schemafile);%look for relative path definition 343 end 344 if exist(schemafile,'file') 345 xs=xmltree(schemafile); 357 346 else 358 xs=[]; 347 msgbox_uvmat('ERROR',['The needed xml schema ' sparam.SchemaPath ' is not found, check the file PARAM.xml']) 348 [FileName, PathName]=uigetfile( ... 349 {'*.xsd', '(*.xsd)'; 350 '*.xsd', '.xsd files '; ... 351 '*.*', 'All Files (*.*)'}, ... 352 'Pick a .xsd schema' ,schemafile); %file browser 353 if ischar(PathName) && ischar(FileName) && exist(fullfile(PathName,FileName),'file') 354 DataIn.Schema=fullfile(PathName,FileName); 355 xs=xmltree(DataIn.Schema);%open the associated schema file 356 else 357 xs=[]; 358 end 359 359 end 360 360 end -
trunk/src/mouse_motion.m
r231 r248 224 224 xround=Field.X(ind_pt); 225 225 yround=Field.Y(ind_pt); 226 % if isfield(Field,'A')227 226 % dx=str2double(par.dx); 228 227 % dy=str2double(par.dy); … … 253 252 set(hhhh,'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2]) 254 253 end 255 [xtable ytable utable vtable ctable typevector result_conv] = pivlab (Field.A,Field.B,ibx2,iby2,isx2,isy2,shiftx,shifty,[xround yround], 1, []);254 [xtable ytable utable vtable ctable typevector result_conv] = pivlab (Field.A,Field.B,ibx2,iby2,isx2,isy2,shiftx,shifty,[xround size(Field.A,1)-yround+1], 1, []); 256 255 % Asub=Field.A(yround-iby2:yround+iby2,xround-ibx2:xround+ibx2);%first sub-image 257 256 % Asub=reshape(Asub,[],1);%first sub-image reshaped as matlab vector -
trunk/src/pivlab.m
r246 r248 42 42 %% mask 43 43 testmask=0; 44 image1=double(image1); 45 image2=double(image2); 44 46 if exist('mask','var') && ~isempty(mask) 45 47 testmask=1; … … 54 56 % 100>=mask> 20: velocity not calculated, impermeable (no flux through mask boundaries) 55 57 % 20>=mask: velocity=0 56 test_noflux=(mask< =100) ;57 test_undefined=(mask< =200 & mask>100 );58 image1(test_undefined)=min(min(image1)) *ones(size(image1));% put image to zero in the undefined area59 image2(test_undefined)=min(min(image 1))*ones(size(image1));% put image to zero in the undefined area58 test_noflux=(mask<100) ; 59 test_undefined=(mask<200 & mask>=100 ); 60 image1(test_undefined)=min(min(image1));% put image to zero in the undefined area 61 image2(test_undefined)=min(min(image2));% put image to zero in the undefined area 60 62 end 61 image1=double(image1);62 image2=double(image2);63 63 64 64 %% calculate correlations: MAINLOOP -
trunk/src/proj_field.m
r236 r248 1772 1772 testbound=1; 1773 1773 end 1774 if testYM in1774 if testYMax 1775 1775 testin=testin & (coord_Y <= YMax); 1776 1776 testbound=1; -
trunk/src/series.m
r246 r248 2167 2167 2168 2168 %check the current path to the selected function 2169 if ~isempty(list_transform{ind_coord}) 2169 2170 func=functions(list_transform{ind_coord}); 2170 2171 set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function 2171 2172 else 2173 set(handles.path_transform,'String',''); %show the path to the senlected function 2174 end 2172 2175 %------------------------------------------------------------------------ 2173 2176 % --- generates a series of file names with reference numbers between range1 and -
trunk/src/uvmat.m
r247 r248 1494 1494 maskname=maskfiles(ilist).name;% take the first mask file in the list 1495 1495 [rr,ff,x1,x2,xa,xb,xext,Mask_NomType{ilist}]=name2display(maskname); 1496 if ~strcmp(Mask_NomType{ilist},Mask_NomType{1}) 1497 msgbox_uvmat('ERROR',['inconsistent mask types ' Mask_NomType{1} Mask_NomType{ilist } ' coexist in the current image directory']) 1498 return 1499 end 1496 % 1497 % if ~strcmp(Mask_NomType{ilist},Mask_NomType{1}) 1498 % msgbox_uvmat('ERROR',['inconsistent mask types ' Mask_NomType{1} ' and ' Mask_NomType{ilist } ' coexist in the current image directory']) 1499 % return 1500 % end 1500 1501 [Path2,Name,ext]=fileparts(maskname); 1501 1502 Namedouble=double(Name); … … 1521 1522 Mask.NbSlice=nbslice; 1522 1523 num_i1=mod(num_i1-1,nbslice)+1; 1523 Mask.NomType= Mask_NomType{1};1524 Mask.NomType=regexprep(Mask_NomType{1},'0','');%remove '0' in nom type for masks 1524 1525 [maskname,mdetect]=name_generator(Mask.Base,num_i1,num_j1,'.png',Mask.NomType);% 1525 1526 mdetect=exist(maskname,'file'); … … 2147 2148 ParamIn.GUIName='get_field'; 2148 2149 [Field{1},ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn,num_i1); 2149 Field{1}2150 2150 if ~isempty(errormsg) 2151 2151 errormsg=['error in reading ' filename ': ' errormsg]; … … 2594 2594 2595 2595 %% Plot the projections on the selected projection objects 2596 'PLOT' 2596 2597 2597 % main projection object (uvmat display) 2598 2598 list_object=get(handles.list_object_1,'String');
Note: See TracChangeset
for help on using the changeset viewer.