- Timestamp:
- Mar 3, 2010, 1:47:56 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_get_field.m
r19 r32 1 %'read_get_field': read the list of selected variables from the GUI get_field (SAME AS THE FIRST 1 %'read_get_field': read the list of selected variables from the GUI get_field 2 3 % OUTPUT: 4 % SubField: structure with fields 5 % .ListVarName: list of selected variables 6 % .VarDimName: cells with the corresponding dimension names 7 % .Field1, 2...: if an input file has been opened by get_field 8 % errormsg: error message (=[] when no error) 9 2 10 % INPUT: 3 11 % hget_field: handles of the GUI get_field … … 34 42 dim_vec_z=0; 35 43 c_index=[]; 44 45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 46 % ordinary (1D) plot 36 47 if test_1Dplot 37 48 % select ordinate variable(s) 38 49 inputlist=get(handles.ordinate,'String'); 39 50 val=get(handles.ordinate,'Value');% selection(s) for ordinate … … 42 53 VarIndex_y(ilist)=name2index(VarNameCell{ilist},Field.ListVarName);%index of the variable in ListVarName 43 54 dim_ordinate{ilist}=Field.VarDimName{VarIndex_y(ilist)};% name of the corresponding dimension 44 % if iscell(dim_ordinate{ilist})45 % dim_ordinate{ilist}=dim_ordinate{ilist}{1};%take the first dimension name (char chain) in case of a matrix46 % end47 55 testpermute(ilist)=0;%default 48 56 nbvar=nbvar+1; … … 56 64 end 57 65 58 66 % select abscissa variable 59 67 inputlist=get(handles.abscissa,'String'); 60 68 val=get(handles.abscissa,'Value');% a single selection is expected for abscissa … … 95 103 end 96 104 end 97 98 105 test3D=strcmp(get(handles.coord_z_scalar,'Visible'),'on')||strcmp(get(handles.coord_z_vectors,'Visible'),'on'); 99 106 VarSubIndexA=[]; 100 107 101 %scalar variable 108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 109 %scalar field 102 110 test_xdimvar=0;%default 103 111 test_ydimvar=0;%default … … 233 241 end 234 242 end 243 244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 245 % vectors 235 246 test_vec_x_dimvar=0;%default 236 247 test_vec_y_dimvar=0;%default … … 278 289 SubVarAttribute{nbvar}=VarAttribute{VarIndexV}; 279 290 end 280 SubVarAttribute{nbvar}.Role='vector_y'; 281 291 SubVarAttribute{nbvar}.Role='vector_y'; 282 292 283 293 % select x variable for vector 284 294 inputlist=get(handles.coord_x_vectors,'String'); 285 295 val=get(handles.coord_x_vectors,'Value');% a single selection is expected for abscissa … … 287 297 VarIndex=name2index(VarName,Field.ListVarName);%index of the variable in ListVarName 288 298 if isempty(VarIndex)% default abscissa = matrix indexTODO like scalar 289 % coord_x_name=dimname_u{2};% name of the x coordinate = dimension of the plotted quantity290 299 empty_coord_vec_x=1; 291 300 else … … 315 324 end 316 325 317 326 % select y variable for vector 318 327 inputlist=get(handles.coord_y_vectors,'String'); 319 328 val=get(handles.coord_y_vectors,'Value');% a single selection is expected for abscissa … … 321 330 VarIndex=name2index(VarName,Field.ListVarName);%index of the variable in ListVarName 322 331 if isempty(VarIndex)% default abscissa = matrix indexTODO like scalar 323 % coord_x_name=dimname_u{2};% name of the x coordinate = dimension of the plotted quantity324 332 empty_coord_vec_y=1; 325 333 else … … 383 391 end 384 392 end 385 386 387 if test3D % (a revoir) 393 394 if test3D % (a revoir) 388 395 %scalar w variable 389 396 inputlist=get(handles.vector_z,'String'); … … 428 435 end 429 436 end 437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 430 438 431 439 % get the input field … … 434 442 SubField=nc2struct(inputfield,ListVarName); 435 443 else % subfield stored in memory 444 SubField.ListGlobalAttribute={}; 436 445 SubField.ListVarName=ListVarName; 437 446 SubField.VarDimName=VarDimName; … … 441 450 SubField.VarAttribute=SubVarAttribute; 442 451 443 %permute indices if coord_y is not the first matrix index 452 %permute indices if coord_y is not the first matrix index: scalar case 444 453 if test_scalar 445 454 VarNameA=Field.ListVarName{VarIndexA}; … … 560 569 end 561 570 562 %permute indices if coord_y is not the first matrix index 571 %permute indices if coord_y is not the first matrix index: vector case 563 572 if test_vector 564 573 VarNameU=Field.ListVarName{VarIndexU}; 565 DimCellU=Field.VarDimName{VarIndexU} ;566 eval(['npxy=size(SubField.' VarNameU ')']) 574 DimCellU=Field.VarDimName{VarIndexU} % list of dimensions for u component 575 eval(['npxy=size(SubField.' VarNameU ')']) % npxy= dimension values for the u component 567 576 SingleCellU={}; 568 577 if numel(npxy) < numel(DimCellU) -
trunk/src/series.m
r29 r32 614 614 end 615 615 %read the ImaDoc file 616 % mode=''; %default617 % testheading=0;618 616 XmlData=[]; 619 617 NbSlice_calib={}; … … 660 658 elseif error==1, warntext='inconsistent number of fields in the .civ file'; 661 659 end 662 % set(handles.npx,'String',num2str(npx));%fills nbre of pixels x box663 % set(handles.npy,'String',num2str(npy));%fills nbre of pixels y box664 % set(handles.pxcm,'String',num2str(pxcmx));%fills scale x (pixel/cm) box665 % set(handles.pycm,'String',num2str(pxcmy));%fills scale y (pixel/cm) box666 % set(handles.pxcm,'Visible','on');%fills scale x (pixel/cm) box667 % set(handles.pycm,'Visible','on');%fills scale y (pixel/cm) box668 % set(handles.view_xml,'Visible','on')669 % set(handles.view_xml,'String','view .civ')670 660 end 671 661 if addtest … … 917 907 enable_j(handles,'Off') 918 908 end 919 920 921 % elseif isequal(mode,'series(Dj)')922 % enable_j(handles,'On')923 % if nbfield==1924 % enable_i(handles,'Off')925 % else926 % enable_i(handles,'On')927 % end928 % elseif isequal(mode,'series(Di)')929 % if nbfield2 > 1930 % enable_j(handles,'On')931 % else932 % enable_j(handles,'Off')933 % end934 % end935 909 set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1 936 % SetSeries.displ_num=displ_num;937 910 set(hseries,'UserData',SeriesData) 938 911 … … 1667 1640 %check the current path to the selected function 1668 1641 PathName=list_path{index_ACTION};%current recorded path 1669 % if ~isequal(path_series,PathName)1670 % CurrentPath=fileparts(which(ACTION));1671 % if ~isequal(CurrentPath,PathName)1672 % addpath(PathName)1673 % errormsg=check_functions;1674 % msgbox_uvmat('CONFIRMATION',[['path ' PathName ' added to the current Matlab pathes'];errormsg])1675 % end1676 % end1677 1642 set(handles.path,'String',PathName); %show the path to the senlected function 1678 1643 1679 1644 %default setting for the visibility of the GUI elements 1680 %set( handles.Field,'Visible','off')%default1681 1645 set(handles.RootPath,'UserData','many') 1682 1646 set(handles.SubDir,'Visible','on') … … 1981 1945 end 1982 1946 1983 1984 1985 % %----------------------------------------------------------------------1986 % % --- display image movie and display time average1987 % %OBSOLETE: A SUPPRIMER1988 % %----------------------------------------------------------------------1989 % function movie_ima(handles,filecell,filecell_1,num1,num_a,field)1990 %1991 % global hfig1 hfig2 hfig3 poscolbar1992 % global A val HIST1993 %1994 % A=[];aviobj=[];1995 % % set(hfig1,'UserData','ima')% set the current field state to 'image'1996 % set(handles.zoom,'Value',1); %put zoom on1997 % nom_type=get(handles.file_input,'UserData');1998 % % field=get(handles.civ1,'UserData');1999 % % fields=field(1).fields;2000 % set(handles.speed,'Visible','On')%show slider to set movie speed2001 % set(handles.mo_speed_txt,'Visible','On')2002 %2003 % if ~isempty(filecell_1)2004 % file1=get(handles.file1_input,'UserData');2005 % field1=file1.field;2006 % scal_type1=field1.fields;2007 % vel_type1=field1.vel_type;2008 % filename_1=filecell_1(1);% first file name in the series2009 % else2010 % filename_1=[];2011 % end2012 % scal_type{1}=field(1).fields;2013 % vel_type{1}=field(1).vel_type;2014 % % display the first field2015 % [A,time,dt,rangx0,rangy0]=view_ima(handles,cell2mat(filecell(1)),filename_1,num1(1),num_a(1));2016 %2017 % % calculate the histogram of the first image2018 % nxy=size(A);2019 % ndim=length(nxy);2020 % if ndim==2 % case of B/W images2021 % nxy(3)=1;2022 % end2023 % C=reshape(A,nxy(1)*nxy(2),nxy(3));2024 % Amaxmax=double(max(max(max(A))));2025 % Aminmin=double(min(min(min(A))));2026 % if isa(C,'uint8')|isa(C,'uint16')2027 % C=double(C);2028 % dC=1;2029 % else2030 % dC=(Amaxmax-Aminmin)/100;2031 % end2032 % val=[Aminmin:dC:Amaxmax];% define bins for histogram2033 % HIST=hist(C,val);% initiate the global histogram2034 % if ndim==2, HIST=HIST'; end;2035 %2036 % auto_scale=get(handles.auto_scale,'Value');2037 % min_input=str2num(get(handles.min_input,'String'));% select the minimum2038 % max_input=str2num(get(handles.scale_input,'String'));% select the max2039 % zoomstate=get(handles.zoom,'Value');2040 %2041 % if isequal(get(handles.window_input,'String'),'avi'),2042 % basename=get(handles.file_input,'String');2043 % prompt = {'file name';'frames per second';'frame resolution ([nbpixels x y])';'axis position relative to the frame'};2044 % dlg_title = 'select properties of the output avi movie';2045 % num_lines= 1;2046 % def = {[basename '_out.avi'];'5';'[1024 768]';'[0.05 0.07 0.87 0.88]'};2047 % answer = inputdlg(prompt,dlg_title,num_lines,def);2048 % aviname=answer{1};2049 % fps=str2num(answer{2});2050 % if exist(aviname,'file')==22051 % delete(aviname);2052 % end;2053 % aviobj=avifile(aviname,'Compression','None','fps',fps);2054 %2055 % %display first view for tests2056 % figure(2);2057 % hh=get(gcf,'CurrentAxes');2058 % if isempty(hh),2059 % hfig1=axes;2060 % else2061 % hfig1=hh;2062 % end;2063 % if isequal(filecell_1,{})2064 % filename_1=[];2065 % else2066 % filename_1=cell2mat(filecell_1(1));2067 % end2068 % poscolbar=[0.93 0.15 0.02 0.7];2069 % view_ima(handles,cell2mat(filecell(1)),filename_1,num1(1),num_a(1));% show the first field2070 % nbpix=eval(answer{3});2071 % set(gcf,'Position',[1 1 nbpix])% resolution XVGA2072 % set(hfig1,'Position',eval(answer{4}));2073 %2074 % msgbox({'adjust figure 2 with its matlab edit menu ' ;...2075 % 'then type any keyboard key to get the avi movie as a copy of figure 2 display'})2076 % pause;2077 % hh=colorbar;2078 % poscolbar=get(hh,'Position');2079 % end2080 %2081 % %%%%%%%%%%%%%%%%2082 % %mask and usrdfct2083 % maskname=[]; %default2084 % if isequal(get(handles.mask_test,'Value'),1)2085 % maskbase=get(handles.mask_test,'UserData');2086 % end2087 % % image or scalar processing programme set by user2088 % % if (get(handles.usr_fct,'Value')==1)2089 % % usrfct=get(handles.usr_fct,'UserData');2090 % % else2091 % % usrfct='';2092 % % end2093 % nburst=1; % nburst(1) =nbre of names in filename= nbre of bursts2094 % set(handles.text_display_1,'String',['image movie'])2095 % nbfield=length(filecell);2096 % if nbfield >12097 % for ifile=2:nbfield2098 % stopstate=get(handles.run0,'BusyAction');2099 % if isequal(stopstate,'queue')% enable STOP command2100 % pausetime=1.02-get(handles.speed,'Value');2101 % pause(pausetime)2102 % if isequal(get(handles.mask_test,'Value'),1)2103 % maskname=name_generator(maskbase,num1(ifile),1,'.png','png_series');2104 % end2105 % if isequal(AName{1},'image')2106 % A=read_image(cell2mat(filecell(ifile)),num1(ifile),maskname);% read the first image, num2 is the counter for avi files2107 % else % read the first field from the netcdf file, imposing the pixel positions in the selected domain2108 % [A,time(ifile),dtr,rgx,rgy,vt_out,erread]=read_scalar(filecell{ifile},vel_type,scal_type,rangx0,rangy0,nxy,maskname);2109 % if erread==1;2110 % errordlg({['no spatial derivative in ' filecell{ifile}]; 'run patch first'}); return2111 % elseif erread==2;2112 % errordlg(['no field ' vel_type{1} ' in ' filecell{ifile}]); return2113 % elseif erread==3;2114 % errordlg(['scalar ' scal_type{1} ' not found in' filecell{ifile}]); return2115 % elseif erread==4;2116 % errordlg(['all points aligned in' filecell{ifile}]); return2117 % end2118 % end2119 %2120 % % read the second image2121 % if ~isempty(filecell_1)2122 % if isequal(scal_type{1},'image')2123 % A1=read_image(cell2mat(filecell_1(ifile)),num1(ifile),maskname);% read the second image, num2 is the counter for avi files2124 % Avalue_1=double(A1(indy,indx,:));2125 % else % read the second field from the netcdf file, imposing the pixel positions in the selected domain2126 % [Avalue_1,time1(ifile),dtr,rgx,rgy,vt_out,erread]=read_scalar(filecell_1{ifile},{vel_type1},{scal_type1},rangx0,rangy0,npxy,maskname,usrfct);2127 % if erread==1;2128 % errordlg({['no spatial derivative in ' filecell_1{ifile}]; 'run patch first'}); return2129 % elseif erread==2;2130 % errordlg(['no field ' vel_type1 ' in ' filecell_1{ifile}]); return2131 % elseif erread==3;2132 % errordlg(['scalar ' scal_type1 ' not found in' filecell_1{ifile}]); return2133 % elseif erread==4;2134 % errordlg(['all points aligned in' filecell_1{ifile}]); return2135 % end2136 % end2137 % time(ifile)=(time(ifile)+time1(ifile))/2;2138 % Avalue=Avalue-Avalue_1;2139 % end2140 % set(handles.abs_time,'String',time);2141 % set(handles.field_counter,'String',num2str(num1(ifile)));2142 % set(handles.a_input,'String',num2stra(num_a(ifile),nom_type));2143 % C=reshape(A,nxy(1)*nxy(2),nxy(3));% reshape in a vector2144 % [val,HIST]=hist_update(val,HIST,C,dC);2145 % [h,Amin,Amax]=plot_image(hfig1,rangx0,rangy0,1,scal_type{1},auto_scale,min_input,max_input,poscolbar,A);2146 % set(handles.min_input,'String',num2str(Amin));% select the minimum2147 % set(handles.scale_input,'String',num2str(Amax));% select the minimum2148 % if ~isequal(aviobj,[]),2149 % % mov=getframe(hfig1);2150 % mov=getframe(gcf);2151 % aviobj=addframe(aviobj,mov);end2152 % if (get(handles.zoom,'Value') == get(handles.zoom,'Max')),zoom on,end2153 % set(handles.field_counter,'String',num2str(num1(ifile)))2154 % % end2155 % end2156 % end2157 % end2158 % aviobj=close(aviobj);2159 %2160 % %plot global image histogram2161 % HIST=HIST/(nbfield*nxy(1)*nxy(2));% normalized by the number of points2162 % axes(hfig2) %in main window2163 % if ndim==22164 % plot(val,HIST)2165 % else2166 % plot(val,HIST(:,1),'r',val,HIST(:,2),'g',val,HIST(:,3),'b')2167 % end2168 % residu=1-sum(HIST,1);2169 % title(['histo, residu ' num2str(residu)])2170 % grid on2171 % axes(hfig3)2172 % cla %clear the second histogram window2173 %2174 2175 2176 2177 2178 1947 %%%%%%%%%%%%% 2179 1948 function [ind_remove]=find_pairs(dirpair,ind_i,last_i) … … 2201 1970 end 2202 1971 2203 %-------------------------------------------------------- 1972 %---------------------------------------------------- 1973 % determine the list of index pairs of processing file 1974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1975 function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode) 1976 num_i1=num_i;% set of first image numbers by default 1977 num_i2=num_i; 1978 num_j1=num_j; 1979 num_j2=num_j; 1980 num_i_out=num_i; 1981 num_j_out=num_j; 1982 if isequal (NomType,'_i1-i2_j') |isequal (NomType,'_i1-i2') 1983 num_i1_line=num_i+ind_shift(3);% set of first image numbers 1984 num_i2_line=num_i+ind_shift(4); 1985 % adjust the first and last field number 1986 indsel=find(num_i1_line >= 1); 1987 num_i_out=num_i(indsel); 1988 num_i1_line=num_i1_line(indsel); 1989 num_i2_line=num_i2_line(indsel); 1990 num_j1=meshgrid(num_j,ones(size(num_i1_line))); 1991 num_j2=meshgrid(num_j,ones(size(num_i1_line))); 1992 [xx,num_i1]=meshgrid(num_j,num_i1_line); 1993 [xx,num_i2]=meshgrid(num_j,num_i2_line); 1994 elseif isequal (NomType,'_i_j1-j2') || isequal (NomType,'#_ab') 1995 if isequal(mode,'bursts') %case of bursts (png_old or png_2D) 1996 num_j1=ind_shift(1)*ones(size(num_i)); 1997 num_j2=ind_shift(2)*ones(size(num_i)); 1998 else 1999 num_j1_col=num_j+ind_shift(1);% set of first image numbers 2000 num_j2_col=num_j+ind_shift(2); 2001 % adjust the first field number 2002 indsel=find((num_j1_col >= 1)); 2003 num_j_out=num_j(indsel); 2004 num_j1_col=num_j1_col(indsel); 2005 num_j2_col=num_j2_col(indsel); 2006 [num_i1,num_j1]=meshgrid(num_i,num_j1_col); 2007 [num_i2,num_j2]=meshgrid(num_i,num_j2_col); 2008 end 2009 end 2204 2010 2205 2011 -
trunk/src/series/check_files.m
r27 r32 150 150 hh=uicontrol('Style','listbox', 'Position', [20 340 500 40], 'String', message); 151 151 end 152 %----------------------------------------------------153 % determine the list of index pairs of processing file154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%155 function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode)156 num_i1=num_i;% set of first image numbers by default157 num_i2=num_i;158 num_j1=num_j;159 num_j2=num_j;160 num_i_out=num_i;161 num_j_out=num_j;162 if isequal (NomType,'_i1-i2_j') |isequal (NomType,'_i1-i2')163 num_i1_line=num_i+ind_shift(3);% set of first image numbers164 num_i2_line=num_i+ind_shift(4);165 % adjust the first and last field number166 indsel=find(num_i1_line >= 1);167 num_i_out=num_i(indsel);168 num_i1_line=num_i1_line(indsel);169 num_i2_line=num_i2_line(indsel);170 num_j1=meshgrid(num_j,ones(size(num_i1_line)));171 num_j2=meshgrid(num_j,ones(size(num_i1_line)));172 [xx,num_i1]=meshgrid(num_j,num_i1_line);173 [xx,num_i2]=meshgrid(num_j,num_i2_line);174 elseif isequal (NomType,'_i_j1-j2') || isequal (NomType,'#_ab')175 if isequal(mode,'bursts') %case of bursts (png_old or png_2D)176 num_j1=ind_shift(1)*ones(size(num_i));177 num_j2=ind_shift(2)*ones(size(num_i));178 else179 num_j1_col=num_j+ind_shift(1);% set of first image numbers180 num_j2_col=num_j+ind_shift(2);181 % adjust the first field number182 indsel=find((num_j1_col >= 1));183 num_j_out=num_j(indsel);184 num_j1_col=num_j1_col(indsel);185 num_j2_col=num_j2_col(indsel);186 [num_i1,num_j1]=meshgrid(num_i,num_j1_col);187 [num_i2,num_j2]=meshgrid(num_i,num_j2_col);188 end189 end
Note: See TracChangeset
for help on using the changeset viewer.