Changeset 525
- Timestamp:
- Aug 19, 2012, 1:07:24 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_field_cells.m
r516 r525 141 141 ListRole={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','vector_x_tps','vector_y_tps','warnflag','errorflag',... 142 142 'ancillary','image','color','discrete','scalar','coord_tps'};% rmq vector_x_tps and vector_y_tps to be replaced by vector_x and vector_y 143 % NbDim=zeros(size(CellVarIndex));%default144 143 145 144 for ilist=1:numel(ListRole) … … 220 219 NbDim(icell)=1; 221 220 test_coord=1; 221 elseif numel(DimCell)==1 222 NbDim(icell)=0;% set of data without coordinates 222 223 end 223 224 end -
trunk/src/plot_field.m
r517 r525 278 278 end 279 279 end 280 if ~checkancillary% does not display variables with attribute '.Role=ancillary'280 % if ~checkancillary% does not display variables with attribute '.Role=ancillary' 281 281 VarName=FieldData.ListVarName{VarIndex(ivar)}; 282 282 VarValue=FieldData.(VarName); … … 289 289 txt_cell=[txt_cell;{txt}]; 290 290 end 291 end291 % end 292 292 end 293 293 end -
trunk/src/series.m
r523 r525 661 661 662 662 %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% 663 ext_imadoc='';664 if exist([FileBase '.xml'],'file')665 ext_imadoc='.xml';666 elseif exist([FileBase '.civ'],'file')667 ext_imadoc='.civ';668 end669 %read the ImaDoc file670 663 XmlData=[]; 671 664 NbSlice_calib={}; 672 if isequal(ext_imadoc,'.xml') 673 [XmlData,warntext]=imadoc2struct([FileBase '.xml']); 665 XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5}); 666 if ~isempty(XmlFileName) 667 [XmlData,warntext]=imadoc2struct(XmlFileName); 674 668 if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName) 675 669 [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); … … 692 686 msgbox_uvmat('WARNING',warntext) 693 687 end 694 elseif isequal(ext_imadoc,'.civ')695 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']);696 time=XmlData.Time;697 if error==2, warntext=['no file ' FileBase '.civ'];698 elseif error==1, warntext='inconsistent number of fields in the .civ file';699 end700 688 end 701 689 … … 783 771 for iview=1:nbview 784 772 pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index 773 if strcmp(get(handles.num_first_j,'Visible'),'off') 774 pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index 775 end 785 776 index_min(iview)=find(pair_max{iview}>0, 1 ); 786 777 index_max(iview)=find(pair_max{iview}>0, 1, 'last' ); … … 829 820 830 821 822 %% set default options in menu 'Fields' 823 switch FileType 824 case {'civx','civdata'} 825 [FieldList,ColorList]=calc_field; 826 set(handles.FieldName,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 827 set(handles.FieldName,'Value',2) % set menu to 'velocity 828 set(handles.Coord_x,'Value',1); 829 set(handles.Coord_x,'String',{'X'}); 830 set(handles.Coord_y,'Value',1); 831 set(handles.Coord_y,'String',{'Y'}); 832 case 'netcdf' 833 set(handles_Fields,'Value',1) 834 set(handles_Fields,'String',{'get_field...'}) 835 hget_field=get_field(FileName); 836 hhget_field=guidata(hget_field); 837 get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); 838 otherwise 839 set(handles_Fields,'Value',1) % set menu to 'image' 840 set(handles_Fields,'String',{'image'}) 841 set(handles.Coord_x,'Value',1); 842 set(handles.Coord_x,'String',{'AX'}); 843 set(handles.Coord_y,'Value',1); 844 set(handles.Coord_y,'String',{'AY'}); 845 end 831 846 % %% set default options in menu 'Fields'%% TODO: check VelType 832 847 % if ~testima … … 1327 1342 set(handles.ref_j_text,'Visible',state) 1328 1343 1329 %-----------------------------------1330 % function view_FieldMenu(handles,state)1331 % % set(handles.FieldName,'Visible',state)1332 % % set(handles.Field_text,'Visible',state)1333 % set(handles.InputFields,'Visible',state)1334 1335 % %-----------------------------------1336 % function view_FieldMenu_1(handles,state)1337 % set(handles.FieldName_1,'Visible',state)1338 % set(handles.Field_text_1,'Visible',state)1339 1340 1344 1341 1345 %%%%%%%%%%%%%%%%%%%% … … 2046 2050 end 2047 2051 2048 % %------------------------------------------------------------------------2049 % % --- Executes on button press in REFRESH.2050 % function REFRESH_INDICES_Callback(hObject, eventdata, handles)2051 % %------------------------------------------------------------------------2052 % % hObject handle to REFRESH (see GCBO)2053 % % eventdata reserved - to be defined in a future version of MATLAB2054 % % handles structure with handles and user data (see GUIDATA)2055 % set(handles.REFRESH,'BackgroundColor',[0.7 0.7 0.7])2056 % InputTable=get(handles.InputTable,'Data');2057 % check_lines=get(handles.REFRESH,'UserData');2058 %2059 % %% check the indices and FileTypes for each series (limited to the new ones to save time)2060 % for ind_list=1:length(check_lines)2061 % if check_lines(ind_list)2062 % InputLine=InputTable(ind_list,:);2063 % detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data)2064 % detect_idem=detect_idem(detect_idem>0);2065 % if ~isempty (detect_idem)2066 % InputLine(detect_idem)=InputTable(ind_list-1,detect_idem);2067 % set(handles.InputTable,'Data',InputTable)2068 % end2069 % fileinput=fullfile_uvmat(InputLine{1},InputLine{2},InputLine{3},InputLine{5},InputLine{4},1,2,1,2);2070 % %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2})2071 % %update file series defined by the selected line2072 % [InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list);2073 % if ~isempty(errormsg)2074 % msgbox_uvmat('ERROR',errormsg)2075 % return2076 % end2077 % end2078 % end2079 % set(handles.InputTable,'Data',InputTable)2080 % SeriesData=get(handles.series,'UserData');2081 %2082 % state_j='off';2083 % state_Pairs='off';2084 % state_InputFields='off';2085 % val=get(handles.ListView,'Value');2086 % ListViewString={''};2087 % if ~isempty(SeriesData)2088 % % ListViewString={};2089 % for iview=1:size(InputTable,1)2090 % if ~isempty(SeriesData.j1_series{iview})2091 % state_j='on';2092 % end2093 % if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview})2094 % state_Pairs='on';2095 % ListViewString{iview}=num2str(iview);2096 % if check_lines(iview)2097 % val=iview;%select the last pair if it is a new entry2098 % end2099 % end2100 % if strcmp(SeriesData.FileType{iview},'civx')||strcmp(SeriesData.FileType{iview},'civdata')2101 % state_InputFields='on';2102 % end2103 % end2104 % end2105 % set(handles.ListView,'Value',val)2106 % set(handles.ListView,'String',ListViewString)2107 % if strcmp(state_Pairs,'on')2108 % ListView_Callback(hObject,eventdata,handles)2109 % end2110 % set(handles.PairString,'Visible',state_Pairs)2111 % enable_j(handles,state_j)2112 % set(handles.REFRESH,'BackgroundColor',[1 0 0])2113 % set(handles.REFRESH,'visible','off')2114 2115 % -----------------------------------------------------------------------2116 % --- Update min and max indices of a file series by scanning with find_file_series2117 % --- which also changes the root file and NomType in case of movie. Also adjust the string representation of indices (e.g;2118 % --- 1 or 001 by the function find_file_series2119 % --- This function also dispaly the set of availbale files in the series2120 % --- and the menus appropriate to the file type as well as timing possibly set2121 % --- by an xml image documentation file2122 function [RootFile,NomType,errormsg]=update_indices(handles,fileinput,iview)2123 % -----------------------------------------------------------------------2124 %% look for min and max indices existing in the file series and update SeriesData2125 errormsg='';2126 [FilePath,FileName,FileExt]=fileparts(fileinput);2127 % detect the file type, get the movie object if relevant, and look for the corresponding file series:2128 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists2129 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);2130 if isempty(RootFile)&&isempty(i1_series)2131 errormsg='no input file in the series';2132 return2133 end2134 2135 %% adjust the min and max indices common to all the file series2136 MinIndex=get(handles.MinIndex,'Data');2137 MaxIndex=get(handles.MaxIndex,'Data');2138 MinIndex_i=min(i1_series(i1_series>0));2139 if ~isempty(i2_series)2140 MaxIndex_i=max(i2_series(i2_series>0));2141 else2142 MaxIndex_i=max(i1_series(i1_series>0));2143 end2144 MinIndex_j=min(j1_series(j1_series>0));2145 if ~isempty(j2_series)2146 MaxIndex_j=max(j2_series(j2_series>0));2147 else2148 MaxIndex_j=max(j1_series(j1_series>0));2149 end2150 MinIndex{iview,1}=MinIndex_i;2151 MinIndex{iview,2}=MinIndex_j;2152 MaxIndex{iview,1}=MaxIndex_i;2153 MaxIndex{iview,2}=MaxIndex_j;2154 set(handles.MinIndex,'Data',MinIndex)2155 set(handles.MaxIndex,'Data',MaxIndex)2156 SeriesData=get(handles.series,'UserData');2157 SeriesData.i1_series{iview}=i1_series;2158 SeriesData.i2_series{iview}=i2_series;2159 SeriesData.j1_series{iview}=j1_series;2160 SeriesData.j2_series{iview}=j2_series;2161 SeriesData.FileType{iview}=FileType;2162 2163 %% display the set of existing files as an image2164 set(handles.Waitbar,'Units','pixels')2165 pos=get(handles.Waitbar,'Position');2166 xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices2167 yima=0.5:pos(4)-0.5;2168 [XIma,YIma]=meshgrid(xima,yima);2169 nb_i=size(i1_series,3);2170 nb_j=size(i1_series,2);2171 ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i;2172 ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j;2173 [Ind_i,Ind_j]=meshgrid(ind_i,ind_j);2174 CData=zeros([size(XIma) 3]);2175 file_ima=double((i1_series(:,:,1)>0)');2176 if numel(file_ima)>=22177 if size(file_ima,1)==12178 CLine=interp1(ind_i,file_ima,xima,'nearest');2179 CData(:,:,2)=ones(size(yima'))*CLine;2180 else2181 CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest');2182 end2183 set(handles.Waitbar,'CData',CData)2184 end2185 set(handles.Waitbar,'Units','normalized')2186 2187 %% enable field and veltype menus2188 % testfield=isequal(get(handles.FieldName,'enable'),'on');2189 % testfield_1=isequal(get(handles.FieldName_1,'enable'),'on');2190 % testveltype=isequal(get(handles.VelType,'enable'),'on');2191 % testveltype_1=isequal(get(handles.VelType_1,'enable'),'on');2192 % testtransform=isequal(get(handles.TransformName,'Enable'),'on');2193 % testnc=0;2194 % testnc_1=0;2195 % testcivx=0;2196 % testcivx_1=0;2197 % testima=0; %test for image input2198 % if isequal(lower(FileExt),'.avi') %.avi file2199 % testima=1;2200 % elseif ~isempty(imformats(FileExt(2:end)))2201 % testima=1;2202 % elseif isequal(FileExt,'.vol')2203 % testima=1;2204 % end2205 %TODO: update2206 % if length(FileExtCell)==1 || length(FileExtCell)>22207 % for iview=1:length(FileExtCell)2208 % if isequal(FileExtCell{iview},'.nc')2209 % testnc=1;2210 % end2211 % if isequal(FileTypeCell{iview},'civx')2212 % testcivx=1;2213 % end2214 % end2215 % elseif length(FileExtCell)==22216 % testnc=isequal(FileExtCell{1},'.nc');2217 % testnc_1=isequal(FileExtCell{2},'.nc');2218 % testcivx=isequal(FileTypeCell{1},'civx');2219 % testcivx_1=isequal(FileTypeCell{2},'civx');2220 % end2221 switch FileType2222 case {'civx','civdata'}2223 %view_FieldMenu(handles,'on')2224 menustr=get(handles.FieldName,'String');2225 if isequal(menustr,{'get_field...'})2226 set(handles.FieldName,'String',{'get_field...';'velocity';'vort';'div';'more...'})2227 end2228 set(handles.VelType,'Visible','on')2229 set(handles.FieldTransform,'Visible','on')2230 % view_TRANSFORM(handles,'on')2231 % TODO: second menu2232 % view_FieldMenu_1(handles,'on')2233 % if testcivx_12234 % menustr=get(handles.FieldName_1,'String');2235 % if isequal(menustr,{'get_field...'})2236 % set(handles.FieldName_1,'String',{'get_field...';'velocity';'vort';'div';'more...'})2237 % end2238 % else2239 % set(handles.FieldName_1,'Value',1)2240 % set(handles.FieldName_1,'String',{'get_field...'})2241 % set(handles.VelType_1,'Visible','on')2242 % set(handles.VelType_text_1,'Visible','on');2243 % end2244 % view_FieldMenu_1(handles,'off')2245 case 'netcdf'2246 % view_FieldMenu(handles,'on')2247 set(handles.FieldName,'Value',1)2248 set(handles.FieldName,'String',{'get_field...'})2249 set(handles.FieldTransform,'Visible','off')2250 % view_TRANSFORM(handles,'off')2251 case {'image','multimage','video'}2252 % view_FieldMenu(handles,'off')2253 % view_FieldMenu_1(handles,'off')2254 set(handles.VelType,'Visible','off')2255 set(handles.VelType_text,'Visible','off');2256 end2257 2258 2259 %TODO:update2260 % if ~isequal(FileExt,'.nc') && ~isequal(FileExt,'.cdf') && ~testima2261 % msgbox_uvmat('ERROR',['invalid input file extension ' FileExt])2262 % return2263 % end2264 2265 %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%%2266 ext_imadoc='';2267 FileBase=fullfile(RootPath,RootFile);2268 if isequal(FileExt,'.xml')||isequal(FileExt,'.civ')2269 ext_imadoc=FileExt;2270 elseif exist([FileBase '.xml'],'file')2271 ext_imadoc='.xml';2272 elseif exist([FileBase '.civ'],'file')2273 ext_imadoc='.civ';2274 end2275 %read the ImaDoc file2276 XmlData=[];2277 NbSlice_calib={};2278 if isequal(ext_imadoc,'.xml')2279 [XmlData,warntext]=imadoc2struct([FileBase '.xml']);2280 if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName)2281 [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName);2282 end2283 if isfield(XmlData,'Time')2284 time{iview}=XmlData.Time;2285 end2286 if isfield(XmlData,'Camera')2287 if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice)2288 NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform2289 if ~isequal(NbSlice_calib{iview},NbSlice_calib{1})2290 msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series');2291 end2292 end2293 if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit)2294 TimeUnit=XmlData.Camera.TimeUnit;2295 end2296 end2297 if ~isempty(warntext)2298 msgbox_uvmat('WARNING',warntext)2299 end2300 elseif isequal(ext_imadoc,'.civ')2301 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']);2302 time{iview}=XmlData.Time;2303 if error==2, warntext=['no file ' FileBase '.civ'];2304 elseif error==1, warntext='inconsistent number of fields in the .civ file';2305 end2306 end2307 2308 %% update time table2309 TimeTable=get(handles.TimeTable,'Data');2310 TimeTable{iview,1}=time(MinIndex_i,MinIndex_j);2311 TimeTable{iview,4}=time(MaxIndex_i,MaxIndex_j);2312 set(handles.TimeTable,'Data',TimeTable)2313 2314 %% number of slices2315 if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord')2316 siz=size(XmlData.GeometryCalib.SliceCoord);2317 if siz(1)>12318 NbSlice=siz(1);2319 else2320 NbSlice=1;2321 end2322 set(handles.num_NbSlice,'String',num2str(NbSlice))2323 end2324 % set(handles.mode,'Visible','off') % do not show index pairstring by default2325 set(handles.PairString,'Visible','off')2326 % set(handles.num_ref_i,'Visible','off')2327 % set(handles.ref_i_text,'Visible','off')2328 testpair=0;2329 %set the menus of image pairstring and default selection for series2330 %list pairstring if relevant2331 % Val=get(handles.NomType,'Value');2332 % synchronise_view(handles,Val)2333 2334 % if ~isfield(SeriesData,'j1_series')||isempty(SeriesData.j1_series{index})2335 % state_j='off'; %no need for j index2336 % else2337 % state_j='on'; %case of j index2338 % end2339 % show index pairstring if files exist2340 set(handles.series,'UserData',SeriesData)2341 2052 2342 2053 … … 2355 2066 % --- Executes on selection change in RunMode. 2356 2067 function RunMode_Callback(hObject, eventdata, handles) 2068 2069 2070 % --- Executes on selection change in popupmenu14. 2071 function popupmenu14_Callback(hObject, eventdata, handles) 2072 % hObject handle to popupmenu14 (see GCBO) 2073 % eventdata reserved - to be defined in a future version of MATLAB 2074 % handles structure with handles and user data (see GUIDATA) 2075 2076 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu14 contents as cell array 2077 % contents{get(hObject,'Value')} returns selected item from popupmenu14 2078 2079 2080 % --- Executes during object creation, after setting all properties. 2081 function popupmenu14_CreateFcn(hObject, eventdata, handles) 2082 % hObject handle to popupmenu14 (see GCBO) 2083 % eventdata reserved - to be defined in a future version of MATLAB 2084 % handles empty - handles not created until after all CreateFcns called 2085 2086 % Hint: popupmenu controls usually have a white background on Windows. 2087 % See ISPC and COMPUTER. 2088 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2089 set(hObject,'BackgroundColor','white'); 2090 end -
trunk/src/uvmat.m
r523 r525 993 993 switch FileType 994 994 case {'civx','civdata'} 995 [FieldList,ColorList]=calc_field; 996 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 997 set(handles_Fields,'Value',2) % set menu to 'velocity 998 % col_vec=FieldList; 999 % col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) 1000 set(handles.ColorScalar,'Value',1) 1001 set(handles.ColorScalar,'String',ColorList) 1002 set(handles.Vectors,'Visible','on') 1003 set(handles.Coord_x,'Value',1); 1004 set(handles.Coord_x,'String',{'X'}); 1005 set(handles.Coord_y,'Value',1); 1006 set(handles.Coord_y,'String',{'Y'}); 995 [FieldList,ColorList]=calc_field; 996 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 997 set(handles_Fields,'Value',2) % set menu to 'velocity 998 set(handles.ColorScalar,'Value',1) 999 set(handles.ColorScalar,'String',ColorList) 1000 set(handles.Vectors,'Visible','on') 1001 set(handles.Coord_x,'Value',1); 1002 set(handles.Coord_x,'String',{'X'}); 1003 set(handles.Coord_y,'Value',1); 1004 set(handles.Coord_y,'String',{'Y'}); 1007 1005 case 'netcdf' 1008 1006 set(handles_Fields,'Value',1) … … 1010 1008 hget_field=get_field(FileName); 1011 1009 hhget_field=guidata(hget_field); 1012 get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); 1013 % set(handles_Fields,'Value',1) % set menu to 'get_field... 1014 % set(handles_Fields,'String',{'get_field...'}) 1015 % col_vec={'get_field...'}; 1016 % 1017 % set(handles.ColorScalar,'String',col_vec) 1010 get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); 1018 1011 otherwise 1019 1012 set(handles_Fields,'Value',1) % set menu to 'image' 1020 1013 set(handles_Fields,'String',{'image'}) 1021 1022 1023 1024 1014 set(handles.Coord_x,'Value',1); 1015 set(handles.Coord_x,'String',{'AX'}); 1016 set(handles.Coord_y,'Value',1); 1017 set(handles.Coord_y,'String',{'AY'}); 1025 1018 end 1026 1019 set(handles.uvmat,'UserData',UvData)
Note: See TracChangeset
for help on using the changeset viewer.