Changeset 180 for trunk/src/uvmat.m
- Timestamp:
- Jan 18, 2011, 10:50:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r179 r180 212 212 set(hObject,'Units','Normalized') 213 213 movegui(hObject,'center') 214 UvData. PosColorbar=[0.805 0.022 0.019 0.445];215 UvData. SetObjectOrigin=[-0.05 -0.03]; %position for set_object216 UvData. SetObjectSize=[0.3 0.7];217 UvData. CalOrigin=[0.95 -0.03];%position for geometry_calib (TO IMPROVE)218 UvData. CalSize=[0.28 1];214 UvData.OpenParam.PosColorbar=[0.805 0.022 0.019 0.445]; 215 UvData.OpenParam.SetObjectOrigin=[-0.05 -0.03]; %position for set_object 216 UvData.OpenParam.SetObjectSize=[0.3 0.7]; 217 UvData.OpenParam.CalOrigin=[0.95 -0.03];%position for geometry_calib (TO IMPROVE) 218 UvData.OpenParam.CalSize=[0.28 1]; 219 219 220 220 %functions for the mouse and keyboard … … 235 235 set(handles.list_object_1,'String',{'1-PLANE'}); 236 236 end 237 set(handles.Fields,'Value',1) 238 set(handles.Fields,'string',{''})%TODO: PUT IN THE GUI 237 239 238 240 %TRANSFORM menu: builtin fcts … … 305 307 set(handles.uvmat,'UserData',UvData) 306 308 %initiates menu of vector colors 307 list_menu=calc_field;308 % list_menu=[{'ima_cor'};{'black'};{'white'};list_menu(3:end)];309 set(handles.col_vec,'String',list_menu)309 % list_menu=calc_field; 310 % %list_menu=[{'ima_cor'};{'black'};{'white'};list_menu(3:end)]; 311 % set(handles.col_vec,'String',list_menu) 310 312 311 313 %check the path and date of modification of all functions in uvmat … … 346 348 display_file_name(hObject, eventdata, handles,inputfile) 347 349 testinputfield=1; 348 % else 349 % UvData.TestInputFile=0; 350 end 351 if ~isempty(Field) 352 set(handles.Fields,'Value',1) 353 set(handles.Fields,'String',{'get_field...'}) 354 testinputfield=1; 355 356 % set the colorbar position on the interface: 357 % UvData.PosColorbar=[0.805 0.022 0.019 0.445]; 358 elseif ischar(input) 359 scan_i_Callback(handles.scan_i, eventdata, handles); 360 end 350 end 351 % if ~isempty(Field) 352 % menu_str=update_menu(handles.Fields,'get_field...'); 353 % % set(handles.Fields,'Value',1) 354 % % set(handles.Fields,'String',{'get_field...'}) 355 % testinputfield=1; 356 % elseif ischar(input) 357 % scan_i_Callback(handles.scan_i, eventdata, handles); 358 % end 361 359 else 362 360 if ishandle(handles.UVMAT_title) … … 391 389 msgbox_uvmat('ERROR',errormsg) 392 390 end 393 else394 update_rootinfo(hObject,eventdata,handles);395 391 end 396 392 end … … 874 870 875 871 % set default options in menu 'Fields' 872 876 873 if testima 877 set(handles.Fields,'Value',1) % set menu to 'image'878 set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'})874 % set(handles.Fields,'Value',1) % set menu to 'image' 875 % set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'}) 879 876 elseif isequal(FileExt,'.nc')||isequal(FileExt,'.cdf') 880 877 Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ'); 881 col_vec=get(handles.col_vec,'String'); 882 if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0) 883 set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'}) 884 set(handles.Fields,'Value',3) % set menu to 'velocity' 885 col_vec{1}='ima_cor'; 878 %col_vec=get(handles.col_vec,'String'); 879 if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)%if the new input is Civx 880 FieldList=calc_field; 881 set(handles.Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 882 set(handles.Fields,'Value',2) % set menu to 'velocity' 883 col_vec=FieldList; 884 col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) 886 885 else %general netcdf file (not civx) 887 886 set(handles.Fields,'Value',1) % set menu to 'get_field... 888 887 set(handles.Fields,'String',{'get_field...'}) 889 col_vec{1}='get_field...'; 888 col_vec={'get_field...'}; 889 hget_field=findobj('Name','get_field'); 890 if ~isempty(hget_field)%delete any existing get_field GUI for reinitialisation withthe new file series 891 hhget_field=guidata(hget_field); 892 if ~strcmp(get(hhget_field.inputfile,'String'),FileName)%delete any existing get_field GUI with file name different than the input 893 delete(hget_field) 894 end 895 end 890 896 end 891 897 set(handles.col_vec,'String',col_vec) … … 963 969 % search the files, recognize their type according to their name and fill the rootfile input windows 964 970 function MenuBrowse_1_Callback(hObject, eventdata, handles) 965 %------------------------------------------------------------------- 971 %------------------------------------------------------------------------ 966 972 % huvmat=get(handles.run0,'parent'); 967 973 UvData=get(handles.uvmat,'UserData'); … … 1031 1037 % --- Open again as second field the file whose name has been recorded in MenuFile_1 1032 1038 function MenuFile_1_1_Callback(hObject, eventdata, handles) 1039 % ----------------------------------------------------------------------- 1033 1040 fileinput_1=get(handles.MenuFile_1_1,'Label'); 1034 1041 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1037 1044 % --- Open again as second field the file whose name has been recorded in MenuFile_2 1038 1045 function MenuFile_2_1_Callback(hObject, eventdata, handles) 1046 % ----------------------------------------------------------------------- 1039 1047 fileinput_1=get(handles.MenuFile_2_1,'Label'); 1040 1048 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1043 1051 % --- Open again as second field the file whose name has been recorded in MenuFile_3 1044 1052 function MenuFile_3_1_Callback(hObject, eventdata, handles) 1053 % ----------------------------------------------------------------------- 1045 1054 fileinput_1=get(handles.MenuFile_3_1,'Label'); 1046 1055 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1049 1058 % --- Open again as second field the file whose name has been recorded in MenuFile_4 1050 1059 function MenuFile_4_1_Callback(hObject, eventdata, handles) 1060 % ----------------------------------------------------------------------- 1051 1061 fileinput_1=get(handles.MenuFile_4_1,'Label'); 1052 1062 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1055 1065 % --- Open again as second field the file whose name has been recorded in MenuFile_5 1056 1066 function MenuFile_5_1_Callback(hObject, eventdata, handles) 1067 % ----------------------------------------------------------------------- 1057 1068 fileinput_1=get(handles.MenuFile_5_1,'Label'); 1058 1069 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1160 1171 % default choice of fields 1161 1172 if isequal(ext_test,'.image') 1162 set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})1163 set(handles.Fields_1,'Value',2) % set menu to 'image'1173 % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'}) 1174 % set(handles.Fields_1,'Value',2) % set menu to 'image' 1164 1175 elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf') 1165 1176 Data=nc2struct(fileinput_1,[]); 1166 if isfield(Data,'absolut_time_T0')1167 set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})1168 set(handles.Fields_1,'Value',4) % set menu to 'velocity'1169 else1170 set(handles.Fields_1,'Value',2) % set menu to 'get_field...'1171 set(handles.Fields_1,'String',{'';'get_field...'});1172 end1177 % if isfield(Data,'absolut_time_T0') 1178 % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'}) 1179 % set(handles.Fields_1,'Value',4) % set menu to 'velocity' 1180 % else 1181 % set(handles.Fields_1,'Value',2) % set menu to 'get_field...' 1182 % set(handles.Fields_1,'String',{'';'get_field...'}); 1183 % end 1173 1184 end 1174 1185 set(handles.SubField,'Visible','on') … … 1179 1190 % --- Called by action in RootPath_1 edit box 1180 1191 function RootPath_1_Callback(hObject,eventdata,handles) 1192 % ----------------------------------------------------------------------- 1181 1193 update_rootinfo_1(hObject,eventdata,handles) 1182 1194 … … 1184 1196 % --- Called by action in RootFile_1 edit box 1185 1197 function RootFile_1_Callback(hObject, eventdata, handles) 1198 % ----------------------------------------------------------------------- 1186 1199 update_rootinfo_1(hObject,eventdata,handles) 1187 %-----------------------------------------------------------------------1188 1200 1189 1201 %------------------------------------------------------------------------ … … 1191 1203 function FileIndex_1_Callback(hObject, eventdata, handles) 1192 1204 %------------------------------------------------------------------------ 1193 1194 1205 run0_Callback(hObject, eventdata, handles) 1195 1206 … … 1198 1209 % calibration from an xml file, then refresh current plots 1199 1210 function update_rootinfo_1(hObject,eventdata,handles) %A REVOIR 1200 1211 % ----------------------------------------------------------------------- 1201 1212 set(handles.RootPath_1,'BackgroundColor',[1 1 0])% indicate active program by yellow color 1202 1213 drawnow … … 1472 1483 set(handles.masklevel,'Value',z) 1473 1484 1474 %------------------------------------------------------------------- 1485 %------------------------------------------------------------------------ 1475 1486 % --- Executes on button press in view_xml. 1476 1487 function view_xml_Callback(hObject, eventdata, handles) 1488 %------------------------------------------------------------------------ 1477 1489 [FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles); 1478 1490 option=get(handles.view_xml,'String'); … … 1482 1494 end 1483 1495 1484 %------------------------------------------------------------------- 1496 %------------------------------------------------------------------------ 1485 1497 % --- Executes on button press in mask_test. 1486 1498 function mask_test_Callback(hObject, eventdata, handles) 1487 %------------------------------------------------------------------- 1499 %------------------------------------------------------------------------ 1488 1500 %case of view mask selection 1489 1501 if isequal(get(handles.mask_test,'Value'),1) … … 2061 2073 %------------------------------------------------------------------------ 2062 2074 2063 %initialisation 2064 % errormsg=[]; % default error message 2075 %% initialisation 2065 2076 abstime=[]; 2066 2077 abstime_1=[]; … … 2070 2081 end 2071 2082 UvData=get(handles.uvmat,'UserData'); 2072 2073 2074 2083 if ishandle(handles.UVMAT_title) %remove title panel on uvmat 2075 2084 delete(handles.UVMAT_title) … … 2078 2087 %% determine the main input file information for action 2079 2088 FileType=[];%default 2089 if ~exist(filename,'file') 2090 errormsg=['input file ' filename ' does not exist']; 2091 return 2092 end 2093 %Ext=get(handles.FileExt,'String'); 2094 NomType=get(handles.FileIndex,'UserData'); 2095 %update the z position index 2096 nbslice_str=get(handles.nb_slice,'String'); 2097 if isequal(nbslice_str,'volume') 2098 z_index=num_j1; 2099 set(handles.z_index,'String',num2str(z_index)) 2100 else 2101 nbslice=str2num(nbslice_str); 2102 z_index=mod(num_i1-1,nbslice)+1; 2103 set(handles.z_index,'String',num2str(z_index)) 2104 end 2105 % refresh menu for save_mask if relevant 2106 masknumber=get(handles.masklevel,'String'); 2107 if length(masknumber)>=z_index 2108 set(handles.masklevel,'Value',z_index) 2109 end 2110 2111 %% read the first input field if a filename has been introduced 2080 2112 if ~isempty(filename) 2081 if ~exist(filename,'file') 2082 errormsg=['input file ' filename ' does not exist']; 2083 return 2084 end 2113 ObjectName=filename; 2114 FieldName=[];%default 2115 VelType=[];%default 2085 2116 Ext=get(handles.FileExt,'String'); 2086 NomType=get(handles.FileIndex,'UserData'); 2087 %update the z position index 2088 nbslice_str=get(handles.nb_slice,'String'); 2089 % z_index=1;%default 2090 if isequal(nbslice_str,'volume') 2091 z_index=num_j1; 2092 set(handles.z_index,'String',num2str(z_index)) 2093 else 2094 nbslice=str2num(nbslice_str); 2095 z_index=mod(num_i1-1,nbslice)+1; 2096 set(handles.z_index,'String',num2str(z_index)) 2097 end 2098 % refresh menu for save_mask if relevant 2099 masknumber=get(handles.masklevel,'String'); 2100 if length(masknumber)>=z_index 2101 set(handles.masklevel,'Value',z_index) 2102 end 2103 2104 % determine the input file type 2105 if isequal(Ext,'.nc')||isequal(Ext,'.cdf') 2117 if strcmp(Ext,'.nc')||strcmp(Ext,'.cdf') 2106 2118 FileType='netcdf'; 2119 list_fields=get(handles.Fields,'String');% list menu fields 2120 index_fields=get(handles.Fields,'Value');% selected string index 2121 FieldName= list_fields{index_fields}; % selected field 2122 if ~strcmp(FieldName,'get_field...')% read the field names on the interface get_field... 2123 VelType=setfield(handles); 2124 end 2125 if strcmp(FieldName,'velocity') 2126 list_code=get(handles.color_code,'String');% list menu fields 2127 index_code=get(handles.color_code,'Value');% selected string index 2128 if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white') 2129 list_code=get(handles.col_vec,'String');% list menu fields 2130 index_code=get(handles.col_vec,'Value');% selected string index 2131 ParamIn.ColorVar= list_code{index_code}; % selected field 2132 end 2133 end 2107 2134 elseif isfield(UvData,'MovieObject') 2135 ObjectName=UvData.MovieObject; 2108 2136 FileType='movie'; 2109 FieldName='image';2110 2137 elseif isequal(lower(Ext),'.avi') 2111 2138 FileType='avi'; 2112 FieldName='image';2113 2139 elseif isequal(lower(Ext),'.vol') 2114 2140 FileType='vol'; 2115 FieldName='image'; 2141 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') 2142 ParamIn.Npy=UvData.XmlData.Npy; 2143 ParamIn.Npx=UvData.XmlData.Npx; 2144 else 2145 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 2146 return 2147 end 2116 2148 else 2117 2149 form=imformats(Ext(2:end)); … … 2122 2154 FileType='image'; 2123 2155 end 2124 FieldName='image';2125 2156 end 2126 2157 end 2127 else 2128 FileType='netcdf'; 2129 FieldName='get_field...'; 2130 end 2131 VelType=[];%default 2132 if isequal(FileType,'netcdf') 2133 list_fields=get(handles.Fields,'String');% list menu fields 2134 index_fields=get(handles.Fields,'Value');% selected string index 2135 FieldName= list_fields{index_fields}; % selected field 2136 if ~isequal(FieldName,'get_field...')% read the field names on the interface get_field... 2137 VelType=setfield(handles); 2138 end 2139 end 2140 2141 %% choose a second field if Subfield option is 'on' 2158 ParamIn.FieldName=FieldName; 2159 ParamIn.VelType=VelType; 2160 ParamIn.GUIName='get_field'; 2161 [Field{1},ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn); 2162 if isfield(ParamOut,'Npx')&& isfield(ParamOut,'Npy') 2163 set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface 2164 set(handles.npy,'String',num2str(ParamOut.Npy)); 2165 end 2166 end 2167 2168 %% choose a second field if Subfield option is 'on', and if the field has changed 2169 VelType_1=[];%default 2142 2170 FieldName_1=[]; 2143 scal_color=[]; 2144 VelType_1=setfield_1(handles); 2145 % sub_value=get(handles.SubField,'Value'); 2146 FileType_1='none';%default 2171 ParamOut_1=[]; 2147 2172 if ~isempty(filename_1) 2148 % test for a constant second field (comparison with a fixed field) 2149 NomType_1=get(handles.FileIndex_1,'UserData'); 2150 Ext_1=get(handles.FileExt_1,'String'); 2151 % determine the input file type 2152 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf') 2153 FileType_1='netcdf'; 2154 elseif isfield(UvData,'MovieObject_1') 2155 FileType_1='movie'; 2156 FieldName_1='image'; 2157 elseif isequal(lower(Ext_1),'.avi') 2158 FileType='avi'; 2159 FieldName_1='image'; 2160 elseif isequal(lower(Ext_1),'.vol') 2161 FileType_1='vol'; 2162 FieldName_1='image'; 2163 elseif length(Ext_1)>1 2164 form=imformats(Ext_1(2:end)); 2165 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2166 if isequal(NomType_1,'*'); 2167 FileType_1='multimage'; 2168 else 2169 FileType_1='image'; 2170 end 2171 FieldName_1='image'; 2172 end 2173 end 2174 if ~isequal(FieldName_1,'image') 2175 list_fields=get(handles.Fields_1,'String');% list menu fields 2176 index_fields=get(handles.Fields_1,'Value');% selected string index 2177 FieldName_1= list_fields{index_fields}; % selected field 2178 if isequal(VelType_1,'*')% free veltype choice 2179 VelType_1=[]; 2180 elseif isequal(VelType_1,'"')% veltype the same as for the first field 2181 if isempty(VelType) 2182 VelType_1=[]; 2183 else 2184 VelType_1=VelType; 2185 end 2186 end 2187 end 2188 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2189 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) 2190 if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 2191 test_keepdata_1= isequal(filename_1,UvData.filename_1)&&... 2192 isequal(VelType_1,UvData.filename_1) && isequal(FieldName_1,UvData.FieldName_1); 2193 end 2194 end 2195 if test_keepdata_1 2196 Field{2}=UvData.Field_1; 2197 elseif ~exist(filename_1,'file') 2173 if ~exist(filename_1,'file') 2198 2174 errormsg=['second file ' filename_1 ' does not exist']; 2199 2175 return 2200 end 2201 end 2202 2203 %% read the input field(s) 2204 %read images 2205 if ~isempty(filename) && isequal(FieldName,'image') 2206 Npz=1;%default 2207 switch FileType 2208 case 'movie' 2209 try 2210 A=read(UvData.MovieObject,num_i1); 2211 catch 2212 errormsg=lasterr; 2176 else 2177 Name=filename_1; 2178 FieldName_1=[];%default 2179 VelType_1=[];%default 2180 Ext_1=get(handles.FileExt_1,'String'); 2181 NomType_1=get(handles.FileIndex_1,'UserData'); 2182 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf') 2183 FileType_1='netcdf'; 2184 elseif isfield(UvData,'MovieObject_1') 2185 Name=UvData.MovieObject_1; 2186 FileType_1='movie'; 2187 elseif isequal(lower(Ext_1),'.avi') 2188 FileType_1='avi'; 2189 elseif isequal(lower(Ext_1),'.vol') 2190 FileType_1='vol'; 2191 if isfield(UvData.XmlData_1,'Npy') && isfield(UvData.XmlData_1,'Npx') 2192 ParamIn.Npy=UvData.XmlData_1.Npy; 2193 ParamIn.Npx=UvData.XmlData_1.Npx; 2194 else 2195 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 2213 2196 return 2214 2197 end 2215 case 'avi' 2216 try 2217 mov=aviread(filename,num_i1); 2218 catch 2219 errormsg=lasterr; 2220 return 2198 else 2199 form=imformats(Ext_1(2:end)); 2200 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2201 if isequal(NomType_1,'*'); 2202 FileType_1='multimage'; 2203 else 2204 FileType_1='image'; 2205 end 2206 end 2207 end 2208 if strcmp(FileType_1,'netcdf') 2209 list_fields=get(handles.Fields_1,'String');% list menu fields 2210 index_fields=get(handles.Fields_1,'Value');% selected string index 2211 FieldName_1= list_fields{index_fields}; % selected field 2212 if ~isequal(FieldName_1,'get_field...')% read the field names on the interface get_field... 2213 VelType_1=setfield_1(handles); 2221 2214 end 2222 A=frame2im(mov(1)); 2223 case 'vol' 2224 A=imread(filename); 2225 if isfield(UvData.XmlData,'Npy') 2226 Npz=size(A,1)/UvData.XmlData.Npy; 2227 A=reshape(A',UvData.XmlData.Npx,UvData.XmlData.Npy,Npz); 2228 A=permute(A,[3 2 1]); 2215 if strcmp(VelType_1,'*')% free veltype choice 2216 VelType_1=[]; 2217 elseif strcmp(VelType_1,'"')% veltype the same as for the first field 2218 if isempty(VelType) 2219 VelType_1=[]; 2220 else 2221 VelType_1=VelType; 2222 end 2229 2223 end 2230 case 'multimage'2231 A=imread(filename,num_i1);2232 case 'image'2233 A=imread(filename);2234 end2235 npxy=size(A);2236 set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface2237 set(handles.npy,'String',num2str(npxy(1)));2238 Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers2239 Rangy=[npxy(1)-0.5 0.5]; %2240 Field{1}.NbDim=2;%default2241 Field{1}.AName='image';2242 Field{1}.ListVarName={'AY','AX','A'}; %2243 if ndims(A)==32244 if Npz==1;%color2245 Field{1}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %2246 Field{1}.AY=[npxy(1)-0.5 0.5];2247 Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers2224 if strcmp(FieldName_1,'velocity') 2225 list_code=get(handles.color_code,'String');% list menu fields 2226 index_code=get(handles.color_code,'Value');% selected string index 2227 if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white') 2228 list_code=get(handles.col_vec,'String');% list menu fields 2229 index_code=get(handles.col_vec,'Value');% selected string index 2230 ParamIn.ColorVar= list_code{index_code}; % selected field 2231 end 2232 end 2233 end 2234 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2235 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) 2236 if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 2237 test_keepdata_1= strcmp(filename_1,UvData.filename_1) && strcmp(VelType_1,UvData.VelType_1) && strcmp(FieldName_1,UvData.FieldName_1); 2238 end 2239 end 2240 if test_keepdata_1 2241 Field{2}=UvData.Field_1; 2248 2242 else 2249 Field{1}.NbDim=3; 2250 Field{1}.ListVarName=['AZ' Field{1}.ListVarName]; 2251 Field{1}.VarDimName={'AZ','AY','AX',{'AZ','AY','AX'}}; 2252 Field{1}.AZ=[npxy(1)-0.5 0.5]; 2253 Field{1}.AY=[npxy(2)-0.5 0.5]; 2254 Field{1}.AX=[0.5 npxy(3)-0.5]; % coordinates of the first and last pixel centers 2255 end 2256 else 2257 Field{1}.VarDimName={'AY','AX',{'AY','AX'}}; % 2258 Field{1}.AY=[npxy(1)-0.5 0.5]; 2259 Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 2260 end 2261 Field{1}.A=A; 2262 Field{1}.CoordUnit='pixel'; %used for mouse_motion 2263 end 2264 2265 %read a second image 2266 if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FieldName_1,'image') 2267 switch FileType_1 2268 case 'movie' 2269 A=read(UvData.MovieObject_1,num_i1); 2270 case 'avi' 2271 mov=aviread(filename_1,num_i1); 2272 A=frame2im(mov(1)); 2273 case 'vol' 2274 A=imread(filename_1); 2275 case 'multimage' 2276 A=imread(filename_1,num_i1); 2277 case 'image' 2278 A=imread(filename_1); 2279 case 'netcdf' 2280 otherwise 2281 errormsg=['unknown input file type ' filename_1]; 2282 end 2283 npxy=size(A); 2284 set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface 2285 set(handles.npy,'String',num2str(npxy(1))); 2286 Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 2287 Rangy=[npxy(1)-0.5 0.5]; % 2288 Field{2}.AName='image'; 2289 Field{2}.ListVarName={'AY','AX','A'}; % 2290 if size(A,3)==3;%color 2291 Field{2}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; % 2292 else 2293 Field{2}.VarDimName={'AY','AX',{'AY','AX'}}; % 2294 end 2295 Field{2}.AY=Rangy; 2296 Field{2}.AX=Rangx; 2297 Field{2}.A=A; 2298 Field{2}.CoordType='px'; %used for mouse_motion 2299 Field{2}.CoordUnit='px'; %used for move_mou 2300 end 2301 2302 %read ncfile(s) 2303 CivStage_1=0;%default 2304 VelType_out_1=[]; 2305 InputField={FieldName}; 2306 InputField_1={FieldName_1}; 2307 if (~isempty(filename)&& isequal(FileType,'netcdf')) || (~isempty(filename_1)&& isequal(FileType_1,'netcdf')) ; 2308 %read the velocity field(s) from netcdf rootfile(s) 2309 list_code=get(handles.col_vec,'String');% list menu fields 2310 index_code=get(handles.col_vec,'Value');% selected string index 2311 scal_color= list_code{index_code(1)}; % selected field 2312 if isequal(FieldName,'velocity')&& ~isequal(scal_color,'black') && ~isequal(scal_color,'white') 2313 InputField=[InputField scal_color]; 2314 end 2315 if isequal(FieldName_1,'velocity') && ~isequal(scal_color,'black') && ~isequal(scal_color,'white') 2316 InputField_1=[InputField_1 scal_color]; 2317 end 2318 if isequal(FileType,'netcdf') %read the first nc field 2319 if isequal(FieldName,'get_field...')% read the field names on the interface get_field. 2320 hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI 2321 if isempty(hget_field) 2322 hget_field= get_field(filename);%open the get_field GUI 2323 % set(hget_field,'name','get_field') 2324 elseif UvData.NewSeries% refresh the fet_field GUI for a new series 2325 delete(hget_field) 2326 hget_field= get_field(filename);%open the get_field GUI 2327 set(hget_field,'name','get_field')%rename get_field GUI for the 'slave' mode 2328 end 2329 hhget_field=guidata(hget_field); 2330 set(hhget_field.list_fig,'Value',1) 2331 set(hhget_field.list_fig,'String',{'uvmat'}) 2332 funct_list=get(hhget_field.ACTION,'UserData'); 2333 funct_index=get(hhget_field.ACTION,'Value'); 2334 funct=funct_list{funct_index};%select the current action in get_field, e;g. PLOT 2335 Field{1}=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot 2336 CivStage=0; 2337 VelType_out=[]; 2338 else 2339 [Field{1},VelType_out]=read_civxdata(filename,InputField,VelType); 2340 if isfield(Field{1},'Txt') 2341 errormsg=Field{1}.Txt; 2342 return 2343 end 2344 CivStage=Field{1}.CivStage; 2345 %UvData.NbDim=Field{1}.NbDim; 2346 end 2347 end 2348 if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FileType_1,'netcdf') %read the second file 2349 if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field. 2350 hget_field_1=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI 2351 if isempty(hget_field_1) 2352 hget_field_1= get_field(filename_1);%open the get_field GUI 2353 set(hget_field_1,'name','get_field_1') 2354 elseif UvData.NewSeries% refresh the fet_field GUI for a new series 2355 delete(hget_field_1) 2356 hget_field_1= get_field(filename);%open the get_field GUI 2357 set(hget_field_1,'name','get_field_1')%rename get_field GUI for the 'slave' mode 2358 end 2359 hhget_field_1=guidata(hget_field_1);%handles of GUI elements in get_field 2360 set(hhget_field_1.list_fig,'Value',1) 2361 set(hhget_field_1.list_fig,'String',{'uvmat'}) 2362 funct_list=get(hhget_field_1.ACTION,'UserData'); 2363 funct_index=get(hhget_field_1.ACTION,'Value'); 2364 funct=funct_list{funct_index}; 2365 Field{2}=funct(hget_field_1); %read the names of the variables to plot in the get_field GUI 2366 else 2367 [Field{2},VelType_out_1]=read_civxdata(filename_1,InputField_1,VelType_1); 2368 CivStage_1=Field{2}.CivStage; 2369 end 2370 if ~isequal(FileType,'netcdf') 2371 VelType_out=VelType_out_1; 2372 end 2373 end 2374 end 2375 2376 %store the second field for possible latter use 2377 if numel(Field)==2 2378 UvData.Field_1=Field{2}; 2243 ParamIn.FieldName=FieldName_1; 2244 ParamIn.VelType=VelType_1; 2245 ParamIn.GUIName='get_field_1'; 2246 [Field{2},ParamOut_1,errormsg] = read_field(Name,FileType_1,ParamIn); 2247 UvData.Field_1=Field{2}; %store the second field for possible use at next RUN 2248 end 2249 end 2250 end 2251 2252 %% update uvmat interface 2253 if isfield(ParamOut,'Npx') 2254 set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface 2255 set(handles.npy,'String',num2str(ParamOut.Npy)); 2256 elseif isfield(ParamOut_1,'Npx') 2257 set(handles.npx,'String',num2str(ParamOut_1.Npx));% display image size on the interface 2258 set(handles.npy,'String',num2str(ParamOut_1.Npy)); 2379 2259 end 2380 2260 2381 2261 %% update the display buttons for the first velocity type (first menuline) 2382 2262 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 2383 if ~isequal(FileType,'netcdf') 2384 reset_vel_type(veltype_handles) 2385 elseif isempty(VelType) && ~isequal(FieldName,'get_field...') 2386 set_veltype_display(veltype_handles,CivStage)%update the display of available velocity types for the first field 2387 if isempty(VelType_out) 2263 if ~isequal(FileType,'netcdf')|| isequal(FieldName,'get_field...') 2264 % reset_vel_type(veltype_handles) 2265 set(veltype_handles,'Visible','off') 2266 else% if isempty(ParamOut.VelType) && ~isequal(FieldName,'get_field...') 2267 set_veltype_display(veltype_handles,ParamOut.CivStage)%update the display of available velocity types for the first field 2268 if isempty(ParamOut.VelType) 2388 2269 reset_vel_type(veltype_handles) 2389 2270 else 2390 handle1=eval(['handles.' VelType_out]);2271 handle1=eval(['handles.' ParamOut.VelType]); 2391 2272 reset_vel_type(veltype_handles,handle1) 2392 2273 end 2393 2274 end 2275 field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList); 2276 set(handles.Fields,'String',ParamOut.FieldList); %update the field menu 2277 set(handles.Fields,'Value',find(field_index,1)) 2394 2278 2395 2279 %% update the display buttons for the second velocity type (second menuline) 2396 veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1]; 2397 if ~isequal(FileType_1,'netcdf') 2398 reset_vel_type(veltype_handles_1) 2399 elseif isempty(VelType_1) && ~isequal(FieldName_1,'get_field...') 2400 set_veltype_display(veltype_handles_1,CivStage_1)%update the display of available velocity types for the first field 2401 if isempty(VelType_out_1) 2402 reset_vel_type(veltype_handles_1) 2403 else 2404 handle1=eval(['handles.' VelType_out_1 '_1']); 2405 reset_vel_type(veltype_handles_1,handle1) 2406 end 2280 if ~isempty(filename_1) 2281 veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1]; 2282 if ~isequal(FileType_1,'netcdf')|| isequal(FieldName_1,'get_field...') 2283 set(veltype_handles_1,'Visible','off') 2284 %reset_vel_type(veltype_handles_1) 2285 else %if isempty(VelType_1) && ~isequal(FieldName_1,'get_field...') 2286 set_veltype_display(veltype_handles_1,ParamOut_1.CivStage)%update the display of available velocity types for the first field 2287 if isempty(ParamOut_1.VelType) 2288 reset_vel_type(veltype_handles_1) 2289 else 2290 handle1=eval(['handles.' ParamOut_1.VelType '_1']); 2291 reset_vel_type(veltype_handles_1,handle1) 2292 end 2293 end 2294 field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList); 2295 set(handles.Fields_1,'String',ParamOut_1.FieldList); %update the field menu 2296 set(handles.Fields_1,'Value',find(field_index,1)) 2407 2297 end 2408 2298 … … 2432 2322 end 2433 2323 2434 %multislice case 2435 % if ~isempty(filename) &&(~isfield(UvData,'NbDim') || isequal(UvData.NbDim,2))&&...%2D case 2436 % isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')&& isfield(UvData.XmlData.GeometryCalib,'SliceCoord') 2437 % siz=size(UvData.XmlData.GeometryCalib.SliceCoord); 2438 % end 2439 2440 %store the current open names, fields and vel types in uvmat interface 2441 UvData.filename=filename; 2324 %% store the current open names, fields and vel types in uvmat interface 2442 2325 UvData.filename_1=filename_1; 2443 UvData.VelType=VelType; 2444 UvData.VelType_1=VelType_1; 2445 UvData.FieldName=FieldName; 2446 UvData.FieldName_1=FieldName_1; 2447 if ~isempty(scal_color) 2448 UvData.CName=scal_color; 2449 end 2450 2451 %% coordinate transform or user fct 2326 UvData.VelType_1=[];%default 2327 UvData.FieldName_1=[]; 2328 if isfield(ParamOut_1,VelType) 2329 UvData.VelType_1=ParamOut_1.VelType; 2330 end 2331 if isfield(ParamOut_1,FieldName) 2332 UvData.FieldName_1=ParamOut_1.FieldName; 2333 end 2334 2335 %% apply coordinate transform or other user fct 2452 2336 XmlData=[];%default 2453 2337 if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority … … 2480 2364 2481 2365 %% calculate scalar 2482 if isequal(FileType,'netcdf') && ~isequal( FieldName,'get_field...')%2483 Field{1}=calc_field( InputField,Field{1});2484 end 2485 if length(Field)==2 && ~test_keepdata_1 && isequal(FileType_1,'netcdf') && ~isequal( FieldName_1,'get_field...')2486 Field{2}=calc_field( InputField_1,Field{2});2366 if isequal(FileType,'netcdf') && ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2367 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1}); 2368 end 2369 if length(Field)==2 && ~test_keepdata_1 && isequal(FileType_1,'netcdf') && ~isequal(ParamOut_1.FieldName,'get_field...')%&&~isempty(FieldName_1) 2370 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2}); 2487 2371 end 2488 2372 … … 2494 2378 end 2495 2379 2496 %% test 3D , default projection menuplane and typical mesh (needed to menuopen set_object)2380 %% get bounds and mesh (needed for mouse action and to open set_object) 2497 2381 test_x=0; 2498 2382 test_z=0;% test for unstructured z coordinate 2499 2383 [UvData.Field,errormsg]=check_field_structure(UvData.Field); 2500 2384 if ~isempty(errormsg) 2501 errormsg=['error in uvmat/r un0_Callback/check_field_structure: ' errormsg];2385 errormsg=['error in uvmat/refresh_field/check_field_structure: ' errormsg]; 2502 2386 return 2503 2387 end 2504 [CellVarIndex,NbDim,VarType]=find_field_indices(UvData.Field); 2388 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(UvData.Field); 2389 if ~isempty(errormsg) 2390 errormsg=['error in uvmat/refresh_field/find_field_indices: ' errormsg]; 2391 return 2392 end 2505 2393 [NbDim,imax]=max(NbDim); 2506 2394 if ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) %unstructured coordinates … … 2558 2446 UvData.Field.YMin=YMin; 2559 2447 2560 %% create a default projection menuplane2561 UvData.Object{1}.Style='plane';%main plotting plane2562 UvData.Object{1}.ProjMode='projection';%main plotting plane2563 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat2564 2565 2448 2566 2449 %% 3D case (menuvolume) 2567 2450 if NbDim==3% && UvData.NewSeries 2568 2451 test_set_object=1; 2569 hset_object=findobj(allchild(0),'tag','set_object'); 2452 hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI 2570 2453 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 2571 2454 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 2572 if ~isempty(hset_object) 2573 hhset_object=guidata(hset_object);2574 ZBounds_old(1)=get(hhset_object.z_slider,'Min');2575 ZBounds_old(2)=get(hhset_object.z_slider,'Max');2576 if isequal(ZBounds_old,ZBounds)2577 test_set_object=0; 2578 else2579 delete( test_set_object);2580 end2581 end 2582 if test_set_object% reinitiate set_object2583 delete_object(1); 2455 if ~isempty(hset_object) %if set_object is detected 2456 % hhset_object=guidata(hset_object); 2457 % % ZBounds_old(1)=get(hhset_object.z_slider,'Min'); 2458 % % ZBounds_old(2)=get(hhset_object.z_slider,'Max'); 2459 % % if isequal(ZBounds_old,ZBounds) 2460 % test_set_object=0;% do not refresh the GUI set_object 2461 % else 2462 delete(hset_object);% delete the GUI set_object if it does not fit 2463 % end 2464 end 2465 if test_set_object% reinitiate the GUI set_object 2466 delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.list_object_1 and 2 2584 2467 UvData.Object{1}.Style='plane';%main plotting plane 2585 2468 UvData.Object{1}.ProjMode='projection';%main plotting plane … … 2597 2480 set_object(UvData.Object{1},PlotHandles,ZBounds); 2598 2481 set(handles.list_object_1,'Value',1); 2482 set(handles.list_object_1,'String',{'1-PLANE'}); 2483 set(handles.edit_object,'Value',1)% put the plane in edit mode to enable the z cursor 2484 edit_object_Callback([],[], handles) 2599 2485 end 2600 2486 %multilevel case (single menuplane in a 3D space) … … 2615 2501 UvData.Object{1}.ZObject=UvData.ZIndex; 2616 2502 end 2503 else 2504 % create a default projection menuplane 2505 UvData.Object{1}.Style='plane';%main plotting plane 2506 UvData.Object{1}.ProjMode='projection';%main plotting plane 2507 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2508 set(handles.list_object_1,'Value',1); 2509 set(handles.list_object_1,'String',{'1-PLANE'}); 2617 2510 end 2618 2511 if ~isfield(UvData.Object{1},'plotaxes') 2619 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 2620 set(handles.list_object_1,'Value',1); 2621 set(handles.list_object_1,'String',{'1-PLANE'}); 2512 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 2622 2513 end 2623 2514 … … 2640 2531 PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac 2641 2532 keeplim(1)=get(handles.FixedLimits,'Value');% test for fixed graph limits 2642 PosColorbar{1}=UvData. PosColorbar;%prescribe the colorbar position on the uvmat interface2533 PosColorbar{1}=UvData.OpenParam.PosColorbar;%prescribe the colorbar position on the uvmat interface 2643 2534 2644 2535 % second projection object (view_field display) … … 2729 2620 hget_field=findobj(allchild(0),'name','get_field'); 2730 2621 if isempty(hget_field) 2731 get_field([],ObjectData)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field) 2732 else 2733 errormsg='The field defined by get_field cannot be plotted'; 2734 return 2622 get_field(filename)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field) 2735 2623 end 2624 errormsg='The field defined by get_field cannot be plotted'; 2625 return 2736 2626 end 2737 2627 end … … 2853 2743 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' UvData.TimeUnit] ) 2854 2744 end 2855 end2856 2857 %% update the input file name in the get_field GUI2858 if isequal(FieldName,'get_field...')2859 set(hhget_field.inputfile,'String',filename)2860 Tabchar={''};%default2861 Tabcell=[];2862 if isfield(Field{1},'ListGlobalAttribute')&& ~isempty(Field{1}.ListGlobalAttribute)2863 for iline=1:length(Field{1}.ListGlobalAttribute)2864 Tabcell{iline,1}=Field{1}.ListGlobalAttribute{iline};2865 if isfield(Field{1}, Field{1}.ListGlobalAttribute{iline})2866 eval(['val=Field{1}.' Field{1}.ListGlobalAttribute{iline} ';'])2867 if ischar(val);2868 Tabcell{iline,2}=val;2869 else2870 Tabcell{iline,2}=num2str(val);2871 end2872 end2873 end2874 if ~isempty(Tabcell)2875 Tabchar=cell2tab(Tabcell,'=');2876 Tabchar=[{''};Tabchar];2877 end2878 end2879 set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field2880 end2881 if isequal(FieldName_1,'get_field...')2882 set(hhget_field_1.inputfile,'String',filename_1)2883 Tabchar={''};%default2884 Tabcell=[];2885 if isfield(Field{2},'ListGlobalAttribute')&& ~isempty(Field{2}.ListGlobalAttribute)2886 for iline=1:length(Field{2}.ListGlobalAttribute)2887 Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline};2888 if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline})2889 eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';'])2890 if ischar(val);2891 Tabcell{iline,2}=val;2892 else2893 Tabcell{iline,2}=num2str(val);2894 end2895 end2896 end2897 if ~isempty(Tabcell)2898 Tabchar=cell2tab(Tabcell,'=');2899 Tabchar=[{''};Tabchar];2900 end2901 end2902 set(hhget_field_1.attributes,'String',Tabchar);%update list of global attributes in get_field2903 2745 end 2904 2746 … … 3713 3555 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes, 3714 3556 % associate the set_object interface handle to the plotting axes 3715 if isfield(UvData ,'SetObjectOrigin')3557 if isfield(UvData.OpenParam,'SetObjectOrigin') 3716 3558 pos_uvmat=get(huvmat,'Position'); 3717 pos_set_object(1:2)=UvData. SetObjectOrigin + pos_uvmat(1:2);3718 pos_set_object(3:4)=UvData. SetObjectSize .* pos_uvmat(3:4);3559 pos_set_object(1:2)=UvData.OpenParam.SetObjectOrigin + pos_uvmat(1:2); 3560 pos_set_object(3:4)=UvData.OpenParam.SetObjectSize .* pos_uvmat(3:4); 3719 3561 set(hset_object,'Position',pos_set_object) 3720 3562 end … … 4365 4207 UvData.MouseAction='none'; 4366 4208 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4209 hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI 4210 if ~isempty(hset_object) 4211 delete(hset_object)% delete the current GUI set_object 4212 end 4367 4213 end 4368 4214 set(handles.uvmat,'UserData',UvData); … … 4410 4256 function update_object(handles,IndexObj,option,ObjectName) 4411 4257 %------------------------------------------------------------------------ 4412 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4258 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4413 4259 if numel(UvData.Object)<IndexObj; 4414 4260 return … … 4420 4266 end 4421 4267 ZBounds=0; % default 4422 if isfield(UvData,'ZMin') && isfield(UvData,'ZMax')4423 ZBounds(1)=UvData.ZMin; %minimum for the Z slider4424 ZBounds(2)=UvData.ZMax;%maximum for the Z slider4425 4268 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax') 4269 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 4270 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 4271 end 4426 4272 hset_object=findobj(allchild(0),'tag','set_object'); 4427 4273 if ~isempty(hset_object) 4428 4274 delete(hset_object)% delete existing version of set_object 4275 end 4276 edit_test=get(handles.edit_object,'Value'); 4277 if edit_test 4278 ObjectData.enable_plot=1; 4279 else 4280 if isfield(ObjectData,'enable_plot') 4281 ObjectData=rmfield(ObjectData,'enable_plot'); 4282 end 4429 4283 end 4430 4284 hset_object=set_object(ObjectData,[],ZBounds);% call the set_object interface, … … 4434 4288 if option==1%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes) 4435 4289 PlotHandles=handles; 4436 % UvData.Object{IndexObj}.plotaxes=handles.axes3;4437 4290 else 4438 4291 hview_field=findobj(allchild(0),'tag','view_field'); … … 4441 4294 end 4442 4295 PlotHandles=guidata(hview_field); 4443 % hview_field=view_field(ProjData);4444 % hhviewfield=guidata(hviewfield);4445 % UvData.Object{IndexObj}.plotaxes=hhviewfield.axes3;4446 4296 end 4447 4297 if ~isempty(ProjData) 4448 plot_field(ProjData,PlotHandles.axes3,PlotHandles);4298 plot_field(ProjData,PlotHandles.axes3,PlotHandles); 4449 4299 end 4450 4300 set(handles.uvmat,'UserData',UvData) … … 4457 4307 end 4458 4308 elseif isequal(get(hother(iobj),'Type'),'image') 4459 4460 4461 4309 Acolor=get(hother(iobj),'CData'); 4310 Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2)); 4311 set(hother(iobj),'CData',Acolor); 4462 4312 else 4463 4313 set(hother(iobj),'Color','b') 4464 4314 end 4465 4315 set(hother(iobj),'Selected','off') … … 4467 4317 hother=findobj('Tag','DeformPoint'); 4468 4318 set(hother,'Color','b'); 4469 set(hother,'Selected','off') 4319 set(hother,'Selected','off') 4470 4320 if isfield(ObjectData,'DisplayHandle_uvmat') 4471 % for iview=1:length(ObjectData.HandlesDisplay) 4472 if ishandle(ObjectData.DisplayHandle_uvmat) 4473 uistack(ObjectData.DisplayHandle_uvmat,'top') 4474 linetype=get(ObjectData.DisplayHandle_uvmat,'Type'); 4475 if isequal(linetype,'line') 4476 set(ObjectData.DisplayHandle_uvmat,'Color','m'); %set the selected object to magenta color 4477 elseif isequal(linetype,'rectangle') 4478 set(ObjectData.DisplayHandle_uvmat,'EdgeColor','m'); %set the selected object to magenta color 4479 elseif isequal(linetype,'patch') 4480 set(ObjectData.DisplayHandle_uvmat,'FaceColor','m'); %set the selected object to magenta color 4481 end 4482 SubObjectData=get(ObjectData.DisplayHandle_uvmat,'UserData'); 4483 if isfield(SubObjectData,'SubObject') & ishandle(SubObjectData.SubObject) 4484 uistack(SubObjectData.SubObject,'top') 4485 for iobj=1:length(SubObjectData.SubObject) 4486 hsub=SubObjectData.SubObject(iobj); 4487 if isequal(get(hsub,'Type'),'rectangle') 4488 set(hsub,'EdgeColor','m'); %set the selected object to magenta color 4489 elseif isequal(get(hsub,'Type'),'image') 4490 Acolor=get(hsub,'CData'); 4491 Acolor(:,:,1)=Acolor(:,:,3); 4492 set(hsub,'CData',Acolor); 4493 else 4494 set(hsub,'Color','m') 4495 end 4321 if ishandle(ObjectData.DisplayHandle_uvmat) 4322 uistack(ObjectData.DisplayHandle_uvmat,'top') 4323 linetype=get(ObjectData.DisplayHandle_uvmat,'Type'); 4324 if isequal(linetype,'line') 4325 set(ObjectData.DisplayHandle_uvmat,'Color','m'); %set the selected object to magenta color 4326 elseif isequal(linetype,'rectangle') 4327 set(ObjectData.DisplayHandle_uvmat,'EdgeColor','m'); %set the selected object to magenta color 4328 elseif isequal(linetype,'patch') 4329 set(ObjectData.DisplayHandle_uvmat,'FaceColor','m'); %set the selected object to magenta color 4330 end 4331 SubObjectData=get(ObjectData.DisplayHandle_uvmat,'UserData'); 4332 if isfield(SubObjectData,'SubObject') & ishandle(SubObjectData.SubObject) 4333 uistack(SubObjectData.SubObject,'top') 4334 for iobj=1:length(SubObjectData.SubObject) 4335 hsub=SubObjectData.SubObject(iobj); 4336 if isequal(get(hsub,'Type'),'rectangle') 4337 set(hsub,'EdgeColor','m'); %set the selected object to magenta color 4338 elseif isequal(get(hsub,'Type'),'image') 4339 Acolor=get(hsub,'CData'); 4340 Acolor(:,:,1)=Acolor(:,:,3); 4341 set(hsub,'CData',Acolor); 4342 else 4343 set(hsub,'Color','m') 4496 4344 end 4497 4345 end 4498 if isfield(SubObjectData,'DeformPoint') & ishandle(SubObjectData.DeformPoint) 4499 set(SubObjectData.DeformPoint,'Color','m') 4500 end 4501 end 4502 % end 4346 end 4347 if isfield(SubObjectData,'DeformPoint') & ishandle(SubObjectData.DeformPoint) 4348 set(SubObjectData.DeformPoint,'Color','m') 4349 end 4350 end 4351 % end 4503 4352 end 4504 4353 pause(0.1) … … 4545 4394 end 4546 4395 4547 4396 %------------------------------------------------------------------------ 4548 4397 % -------------------------------------------------------------------- 4549 4398 function MenuExportMovie_Callback(hObject, eventdata, handles) … … 4631 4480 msgbox_uvmat('CONFIRMATION',{['movie ' aviname ' created '];['with ' num2str(imax) ' frames']}) 4632 4481 4633 4634 % ------------------------------------------------------------------ 4482 %------------------------------------------------------------------------ 4635 4483 function MenuCalib_Callback(hObject, eventdata, handles) 4484 %------------------------------------------------------------------------ 4636 4485 4637 4486 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface … … 4651 4500 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); 4652 4501 set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib 4653 if isfield(UvData ,'CalOrigin')4502 if isfield(UvData.OpenParam,'CalOrigin') 4654 4503 pos_uvmat=get(handles.uvmat,'Position'); 4655 pos_cal(1)=pos_uvmat(1)+UvData. CalOrigin(1)*pos_uvmat(3);4656 pos_cal(2)=pos_uvmat(2)+UvData. CalOrigin(2)*pos_uvmat(4);4657 pos_cal(3:4)=UvData. CalSize .* pos_uvmat(3:4);4504 pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.CalOrigin(1)*pos_uvmat(3); 4505 pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.CalOrigin(2)*pos_uvmat(4); 4506 pos_cal(3:4)=UvData.OpenParam.CalSize .* pos_uvmat(3:4); 4658 4507 end 4659 4508 geometry_calib(FileName,pos_cal);% call the geometry_calib interface … … 4661 4510 set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action 4662 4511 4663 4664 % ------------------------------------------------------------------ 4512 %------------------------------------------------------------------------ 4665 4513 function MenuMask_Callback(hObject, eventdata, handles) 4514 %------------------------------------------------------------------------ 4666 4515 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4667 4516 ListObj=UvData.Object; … … 4766 4615 end 4767 4616 4768 %set(handles.uvmat,'UserData',UvData); 4769 4770 % ------------------------------------------------------------------ 4617 %------------------------------------------------------------------------ 4771 4618 %-- open the GUI set_grid.fig to create grid 4772 4619 function MenuGrid_Callback(hObject, eventdata, handles) 4620 %------------------------------------------------------------------------ 4773 4621 %UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4774 4622 … … 4786 4634 %set(handles.uvmat,'UserData',UvData); 4787 4635 4788 %---------------------------------------------------------------- 4636 %------------------------------------------------------------------------ 4789 4637 % open the GUI 'series' 4790 %----------------------------------------------------------------4791 4638 function MenuSeries_Callback(hObject, eventdata, handles) 4792 %------------------------------------------------------------------- 4639 %------------------------------------------------------------------------ 4793 4640 series; %first display of the GUI to fill waiting time 4794 4641 [param.FileName]=read_file_boxes(handles); … … 4835 4682 series(param); %run the series interface 4836 4683 4837 % 4684 %------------------------------------------------------------------------ 4838 4685 % -- open the GUI civ.fig for civx (PIV) 4839 % ------------------------------------------------------------------4840 4686 function MenuPIV_Callback(hObject, eventdata, handles) 4687 %------------------------------------------------------------------------ 4841 4688 4842 4689 [FileName,RootPath,filebase,FileIndices,ext,SubDir]=read_file_boxes(handles); … … 4874 4721 param.ImaExt=ext; 4875 4722 civ(param);% interface de civ(not in the uvmat file) 4876 4877 % 4723 4724 %------------------------------------------------------------------------ 4878 4725 function MenuTools_Callback(hObject, eventdata, handles) 4879 4880 % ------------------------------------------------------------------ 4726 %------------------------------------------------------------------------ 4727 4728 %------------------------------------------------------------------------ 4881 4729 function MenuEditObject_Callback(hObject, eventdata, handles) 4730 %------------------------------------------------------------------------ 4882 4731 set(handles.edit_object,'Value',1) 4883 4732 edit_Callback(hObject, eventdata, handles) 4884 4733 4885 %------------------------------------------------------------------------ --4734 %------------------------------------------------------------------------ 4886 4735 function enable_transform(handles,state) 4736 %------------------------------------------------------------------------ 4887 4737 set(handles.transform_fct,'Visible',state) 4888 4738 set(handles.TRANSFORM_txt,'Visible',state) … … 4897 4747 function MenuEditVectors_Callback(hObject, eventdata, handles) 4898 4748 %------------------------------------------------------------------------ 4899 % set(handles.MenuEditVectors,'checked','on')4900 4749 set(handles.edit_vect,'Visible','on') 4901 4750 set(handles.edit_vect,'Value',1) 4902 4751 edit_vect_Callback(hObject, eventdata, handles) 4903 4752 4904 % -------------------------------------------------------------------- 4753 % ----------------------------------------------------------------------- 4905 4754 function Menupoints_Callback(hObject, eventdata, handles) 4755 %------------------------------------------------------------------------ 4906 4756 data.Style='points'; 4907 4757 data.ProjMode='projection';%default 4908 4758 create_object(data,handles) 4909 4759 4910 % -------------------------------------------------------------------- 4760 % ----------------------------------------------------------------------- 4911 4761 function Menuline_Callback(hObject, eventdata, handles) 4912 % set(handles.create,'Visible','on') 4913 % set(handles.create,'Value',1) 4914 % LINE_Callback(hObject,eventdata,handles) 4762 %------------------------------------------------------------------------ 4915 4763 data.Style='line'; 4916 4764 data.ProjMode='projection';%default … … 4954 4802 create_object(data,handles) 4955 4803 4956 % 4804 %------------------------------------------------------------------------ 4957 4805 function Menuplane_Callback(hObject, eventdata, handles) 4806 %------------------------------------------------------------------------ 4958 4807 data.Style='plane'; 4959 4808 data.ProjMode='projection';%default … … 4961 4810 create_object(data,handles) 4962 4811 4963 % 4812 %------------------------------------------------------------------------ 4964 4813 function Menuvolume_Callback(hObject, eventdata, handles) 4814 %------------------------------------------------------------------------ 4965 4815 data.Style='volume'; 4966 4816 data.ProjMode='interp';%default … … 5109 4959 end 5110 4960 5111 4961 %------------------------------------------------------------------------ 5112 4962 % --- Executes on button press in delete_object. 5113 4963 function delete_object_Callback(hObject, eventdata, handles) 4964 %------------------------------------------------------------------------ 5114 4965 IndexObj=get(handles.list_object_2,'Value'); 5115 5116 5117 4966 if IndexObj>1 4967 delete_object(IndexObj) 4968 end 5118 4969 5119 4970
Note: See TracChangeset
for help on using the changeset viewer.