Changeset 315
- Timestamp:
- Dec 3, 2011, 10:25:45 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/check_files.m
r306 r315 41 41 'civ_3D';... function associated with the interface 'civ_3D.fig' for PIV in volume (in progress) 42 42 'civ_3D.fig';... 43 'civ_ uvmat';...% civ programs, Matlab version (called by civ.m, option Civuvmat)43 'civ_matlab';...% civ programs, Matlab version (called by civ.m, option Civprogram/Matlab in the upper menu bar) 44 44 'close_fig';...% function activated when a figure is closed 45 45 'copyfields';...% copy fields between two matlab structures … … 71 71 'peaklock';...% 72 72 'phys_XYZ';...% transform coordiantes from pixels to phys 73 'pivlab';...% PIV program (Civ1), called by civ_uvmat74 73 'px_XYZ';...% transform coordiantes from phys to pixels 75 74 'plot_field';...%displays a vector field and/or scalar or images -
trunk/src/civ.m
r314 r315 23 23 %TODO: search range 24 24 25 % Last Modified by GUIDE v2.5 30-Nov-2011 21:52:5225 % Last Modified by GUIDE v2.5 03-Dec-2011 16:08:25 26 26 % Begin initialization code - DO NOT EDIT 27 27 gui_Singleton = 1; … … 533 533 ind_opening=2;% propose 'fix' as the default option 534 534 Data=nc2struct(fileinput,'ListGlobalAttribute','CivStage','absolut_time_T0','fix','patch','civ2','fix2'); 535 if isfield(Data,'Txt') 536 msgbox_uvmat('ERROR',Data.Txt) 537 return 538 end 535 539 if ~isempty(Data.CivStage)%test for civ files 536 540 ind_opening=Data.CivStage; … … 959 963 %could be included in get_mask callback ? 960 964 if isequal(get(handles.CheckMask,'Value'),1) 961 maskname=get(handles.txt_Mask Name,'String');965 maskname=get(handles.txt_Mask,'String'); 962 966 if ~exist(maskname,'file') 963 967 get_mask_civ1_Callback(hObject, eventdata, handles); … … 965 969 end 966 970 if isequal(get(handles.CheckMask,'Value'),1) 967 maskname=get(handles.txt_Mask Name,'String');971 maskname=get(handles.txt_Mask,'String'); 968 972 if ~exist(maskname,'file') 969 973 get_mask_fix1_Callback(hObject, eventdata, handles); … … 977 981 end 978 982 if isequal(get(handles.CheckMask,'Value'),1) 979 maskname=get(handles.txt_Mask Name,'String');983 maskname=get(handles.txt_Mask,'String'); 980 984 if ~exist(maskname,'file') 981 985 get_mask_fix2_Callback(hObject, eventdata, handles); … … 1097 1101 %% MAIN LOOP 1098 1102 time=get(handles.ImaDoc,'UserData'); %get the set of times 1099 super_cmd=[];1100 1103 batch_file_list=[]; 1101 1104 … … 1129 1132 if Param.CheckCiv1 1130 1133 % read image-dependent parameters 1131 Param.Civ1. filename_ima_a=filecell.ima1.civ1{ifile,j};1132 Param.Civ1. filename_ima_b=filecell.ima2.civ1{ifile,j};1134 Param.Civ1.ImageA=filecell.ima1.civ1{ifile,j}; 1135 Param.Civ1.ImageB=filecell.ima2.civ1{ifile,j}; 1133 1136 if size(time,1)>=i2_civ1(ifile) && size(time,2)>=j2_civ1(j) 1134 1137 Param.Civ1.Dt=(time(i2_civ1(ifile),j2_civ1(j))-time(i1_civ1(ifile),j1_civ1(j))); 1135 Param.Civ1.T 0=((time(i2_civ1(ifile),j2_civ1(j))+time(i1_civ1(ifile),j1_civ1(j)))/2);1138 Param.Civ1.Time=((time(i2_civ1(ifile),j2_civ1(j))+time(i1_civ1(ifile),j1_civ1(j)))/2); 1136 1139 else 1137 1140 Param.Civ1.Dt=1; 1138 Param.Civ1.T 0=0;1141 Param.Civ1.Time=0; 1139 1142 end 1140 1143 Param.Civ1.term_a=num2stra(j1_civ1(j),nom_type_nc);%UTILITE? 1141 Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);% 1142 Param.Civ1.pxcmx=1; %velocities are expressed in pixel dispalcement 1143 Param.Civ1.pxcmy=1; 1144 Param.Civ1.ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size 1145 1146 %TODO : civ should not need npx and npy 1147 1144 Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);% 1145 ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size 1146 Param.Civ1.ImageWidth=ImageInfo.Width; 1147 Param.Civ1.ImageHeight=ImageInfo.Height; 1148 Param.Civ1.ImageBitDepth=ImageInfo.BitDepth; 1148 1149 % read mask parameters 1149 1150 if Param.Civ1.CheckMask % the lines below should be changed with the new gui 1150 %matbe they when check_mask the Maskname is read 1151 if exist(Param.Civ1.MaskName,'file') 1152 Param.Civ1.MaskFlag='y'; 1153 else 1154 maskbase=[filecell.filebase '_' Param.Civ1.MaskName]; % 1155 nbslice_mask=str2double(maskdispl(1:end-4)); % 1151 if ~exist(Param.Civ1.Mask,'file') 1152 maskbase=[filecell.filebase '_' Param.Civ1.Mask]; % 1153 nbslice_mask=str2double(Param.Civ1.Mask(1:end-4)); % 1156 1154 i1_mask=mod(i1_civ1(ifile)-1,nbslice_mask)+1; 1157 Param.Civ1.MaskName=name_generator(maskbase,i1_mask,1,'.png','_i'); 1158 if exist(Param.Civ1.MaskName,'file') 1159 Param.Civ1.maskflag='y'; 1160 else 1161 Param.Civ1.MaskName='noFile use default'; 1162 Param.Civ1.MaskFlag='n'; 1163 end 1155 Param.Civ1.Mask=name_generator(maskbase,i1_mask,1,'.png','_i'); 1164 1156 end 1165 else 1166 Param.Civ1.MaskName='noFile use default'; 1167 Param.Civ1.MaskFlag='n'; 1168 end 1169 1157 end 1170 1158 % read grid parameters 1171 1159 if Param.Civ1.CheckGrid 1172 % Param.Civ1.GridFlag='y'; 1173 if isequal(Param.Civ1.GridName(end-3:end),'grid') 1174 nbslice_grid=str2double(Param.Civ1.GridName(1:end-4)); % 1160 if numel(Param.Civ1.Grid)>=4 && isequal(Param.Civ1.Grid(end-3:end),'grid') 1161 nbslice_grid=str2double(Param.Civ1.Grid(1:end-4)); % 1175 1162 if ~isnan(nbslice_grid) 1176 1163 i1_grid=mod(i1_civ1(ifile)-1,nbslice_grid)+1; 1177 Param.Civ1.Grid Name=[filecell.filebase '_' name_generator(Param.Civ1.GridName,i1_grid,1,'.grid','_i')];1164 Param.Civ1.Grid=[filecell.filebase '_' name_generator(Param.Civ1.Grid,i1_grid,1,'.grid','_i')]; 1178 1165 if ~exist(Param.Civ1.GridName,'file') 1179 1166 msgbox_uvmat('ERROR','grid file absent for civ1') 1180 1167 end 1181 elseif ~exist(Param.Civ1.Grid Name,'file')1168 elseif ~exist(Param.Civ1.Grid,'file') 1182 1169 msgbox_uvmat('ERROR','grid file absent for civ1') 1183 1170 end 1184 1171 end 1185 % else1186 % Param.Civ1.GridName='noFile use default';1187 % Param.Civ1.GridFlag='n';1188 1172 end 1189 1173 … … 1282 1266 end 1283 1267 if Param.CheckCiv2==1 1284 Param.Civ2. filename_ima_a=filecell.ima1.civ2{ifile,j};1285 Param.Civ2. filename_ima_b=filecell.ima2.civ2{ifile,j};1268 Param.Civ2.ImageA=filecell.ima1.civ2{ifile,j}; 1269 Param.Civ2.ImageB=filecell.ima2.civ2{ifile,j}; 1286 1270 if size(time,1)>=i2_civ2(ifile) && size(time,2)>=j2_civ2(j) 1287 1271 Param.Civ2.Dt=num2str(time(i2_civ2(ifile),j2_civ2(j))-time(i1_civ2(ifile),j1_civ2(j))); 1288 Param.Civ2.T 0=num2str((time(i2_civ2(ifile),j2_civ2(j))+time(i1_civ2(ifile),j1_civ2(j)))/2);1272 Param.Civ2.Time=num2str((time(i2_civ2(ifile),j2_civ2(j))+time(i1_civ2(ifile),j1_civ2(j)))/2); 1289 1273 else 1290 1274 Param.Civ2.Dt=1; 1291 Param.Civ2.T 0=0;1275 Param.Civ2.Time=0; 1292 1276 end 1293 1277 Param.Civ2.term_a=num2stra(j1_civ2(j),nom_type_nc); … … 1295 1279 Param.Civ2.filename_nc1=filecell.nc.civ1{ifile,j}; 1296 1280 Param.Civ2.filename_nc1(end-2:end)=[]; % remove '.nc' 1297 Param.Civ2.pxcmx=1; %velocities are expressed in pixel dispalcement1298 Param.Civ2.pxcmy=1;1281 1282 % mask 1299 1283 if Param.Civ2.CheckMask 1300 maskdispl=get(handles.txt_Mask,'String'); 1301 if exist(maskdispl,'file') 1302 Param.Civ2.MaskName=maskdispl; 1303 Param.Civ2.MaskFlag='y'; 1304 else 1305 maskbase=[filecell.filebase '_' maskdispl]; % 1306 nbslice_mask=str2double(maskdispl(1:end-4)); % 1284 if ~exist(Param.Civ2.Mask,'file') 1285 maskbase=[filecell.filebase '_' Param.Civ2.Mask]; % 1286 nbslice_mask=str2double(Param.Civ2.Mask(1:end-4)); % 1307 1287 i1_mask=mod(i1_civ2(ifile)-1,nbslice_mask)+1; 1308 Param.Civ2.MaskName=name_generator(maskbase,i1_mask,1,'.png','_i'); 1309 if exist(Param.Civ2.MaskName,'file') 1310 Param.Civ2.MaskFlag='y'; 1311 else 1312 Param.Civ2.MaskName='noFile use default'; 1313 Param.Civ2.MaskFlag='n'; 1288 Param.Civ2.Mask=name_generator(maskbase,i1_mask,1,'.png','_i'); 1289 end 1290 end 1291 %grid 1292 if Param.Civ2.CheckGrid 1293 if numel(Param.Civ2.Grid)>=4 && isequal(Param.Civ2.Grid(end-3:end),'grid') 1294 nbslice_grid=str2double(Param.Civ2.Grid(1:end-4)); % 1295 if ~isnan(nbslice_grid) 1296 i1_grid=mod(i1_civ2(ifile)-1,nbslice_grid)+1; 1297 Param.Civ2.Grid=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1314 1298 end 1315 1299 end 1316 else 1317 Param.Civ2.MaskName='noFile use default'; 1318 Param.Civ2.MaskFlag='n'; 1319 end 1320 gridname=get(handles.txt_GridName,'String'); 1321 if numel(gridname)>=4 && isequal(gridname(end-3:end),'grid') 1322 nbslice_grid=str2double(gridname(1:end-4)); % 1323 if ~isnan(nbslice_grid) 1324 Param.Civ2.GridFlag='y'; 1325 i1_grid=mod(i1_civ2(ifile)-1,nbslice_grid)+1; 1326 Param.Civ2.GridName=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1327 % if exist(Param.Civ2.GridName,'file') 1328 % Param.Civ2.GridFlag='y'; 1329 % else 1330 % Param.Civ2.GridName='noFile use default'; 1331 % Param.Civ2.GridFlag='n'; 1332 % end 1333 elseif exist(gridname,'file') 1334 % Param.Civ2.GridFlag='y'; 1335 % else 1336 % Param.Civ2.GridName='noFile use default'; 1337 % Param.Civ2.GridFlag='n'; 1338 end 1339 % else 1340 % Param.Civ2.GridName='noFile use default'; 1341 % Param.Civ2.GridFlag='n'; 1342 end 1343 % A=imread(filecell.ima1.civ2{1,1});%read the first image to get the size 1344 % sizim=size(A); 1345 Param.Civ2.ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size 1346 % TODO: case of movie 1347 % Param.Civ2.npx=(sizim(2)); 1348 % Param.Civ2.npy=(sizim(1)); 1300 end 1301 ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size 1302 Param.Civ2.ImageWidth=ImageInfo.Width; 1303 Param.Civ2.ImageHeight=ImageInfo.Height; 1304 Param.Civ2.ImageBitDepth=ImageInfo.BitDepth; 1305 % TODO: case of movie 1349 1306 switch CivMode 1350 1307 case 'CivX' … … 3235 3192 set(gcf,'Pointer','arrow') 3236 3193 3237 3194 %------------------------------------------------------------------- 3195 % --- 3196 function closeview_field(gcbo,eventdata) 3197 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 3198 if ~isempty(hview_field) 3199 delete(hview_field) 3200 end 3201 3202 3203 %------------------------------------------------------------------------ 3204 % call 'view_field.fig' to display the field selected in the list of 'status' 3205 function open_view_field(hObject, eventdata) 3206 %------------------------------------------------------------------------ 3207 list=get(hObject,'String'); 3208 index=get(hObject,'Value'); 3209 rootroot=get(hObject,'UserData'); 3210 filename=list{index}; 3211 ind_dot=strfind(filename,'...'); 3212 filename=filename(1:ind_dot-1); 3213 filename=fullfile(rootroot,filename); 3214 delete(get(hObject,'parent'))%delete the display figure to stop the check process 3215 if exist(filename,'file')%visualise the vel field if it exists 3216 uvmat(filename) 3217 set(gcbo,'Value',1) 3218 end 3219 3220 %------------------------------------------------------------------------ 3221 % launched by pressing OK on the status figure 3222 function close_GUI(hObject, eventdata) 3223 %------------------------------------------------------------------------ 3224 delete(gcbf) 3225 3226 %------------------------------------------------------------------------ 3227 % launched by deleting the status figure 3228 function stop_status(hObject, eventdata) 3229 %------------------------------------------------------------------------ 3230 hciv=findobj(allchild(0),'tag','civ'); 3231 hhciv=guidata(hciv); 3232 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ 3233 set(hhciv.status,'BackgroundColor',[0 1 0]) 3238 3234 3239 3235 … … 3351 3347 end 3352 3348 3353 3349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3350 % Callbacks in the uipanel Fix1 3351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3354 3352 %------------------------------------------------------------------------ 3355 3353 % --- Executes on button press in CheckMask. … … 3358 3356 maskval=get(handles.CheckMask,'Value'); 3359 3357 if isequal(maskval,0) 3360 set(handles.txt_Mask Name,'String','')3358 set(handles.txt_Mask,'String','') 3361 3359 else 3362 3360 mask_displ='no mask'; %default … … 3391 3389 set(handles.CheckMask,'Value',1) 3392 3390 end 3393 set(handles.txt_MaskName,'String',mask_displ)3394 3391 set(handles.txt_Mask,'String',mask_displ) 3395 set(handles.txt_MaskName,'String',mask_displ) 3392 set(handles.txt_Mask,'String',mask_displ) 3393 set(handles.txt_Mask,'String',mask_displ) 3396 3394 end 3397 3395 … … 3434 3432 end 3435 3433 set(handles.txt_Mask,'String',mask_displ) 3436 set(handles.txt_Mask Name,'String',mask_displ)3434 set(handles.txt_Mask,'String',mask_displ) 3437 3435 end 3438 3436 … … 3443 3441 maskval=get(handles.CheckMask,'Value'); 3444 3442 if isequal(maskval,0) 3445 set(handles.txt_Mask Name,'String','')3443 set(handles.txt_Mask,'String','') 3446 3444 else 3447 3445 mask_displ='no mask'; %default … … 3471 3469 set(handles.CheckMask,'Value',0) 3472 3470 end 3473 set(handles.txt_Mask Name,'String',mask_displ)3471 set(handles.txt_Mask,'String',mask_displ) 3474 3472 end 3475 3473 … … 3608 3606 hparent=get(hObject,'parent'); 3609 3607 hchildren=get(hparent,'children'); 3610 handle_txtbox=findobj(hchildren,'tag','txt_Grid Name');3608 handle_txtbox=findobj(hchildren,'tag','txt_Grid'); 3611 3609 handle_dx=findobj(hchildren,'tag','num_Dx'); 3612 3610 handle_dy=findobj(hchildren,'tag','num_Dy'); 3611 handle_title_dx=findobj(hchildren,'tag','title_Dx'); 3612 handle_title_dy=findobj(hchildren,'tag','title_Dy'); 3613 3613 testgrid=0; 3614 3614 filegrid=''; … … 3639 3639 set(handle_dx,'Visible','off'); 3640 3640 set(handle_dy,'Visible','off'); 3641 set(handle_title_dy,'Visible','off'); 3642 set(handle_title_dx,'Visible','off'); 3641 3643 set(handle_txtbox,'Visible','on') 3642 3644 set(handle_txtbox,'String',filegrid) 3643 3645 else 3644 3646 set(hObject,'Value',0); 3645 set(handle_dx,'Visible','on'); 3647 set(handle_dx,'Visible','on'); 3646 3648 set(handle_dy,'Visible','on'); 3649 set(handle_title_dy,'Visible','on'); 3650 set(handle_title_dx,'Visible','on'); 3647 3651 set(handle_txtbox,'Visible','off') 3648 3652 end 3649 3653 3650 3654 %% if hObject is on the checkciv1 frame, duplicate action for checkciv2 frame 3651 PanelName=get(hparent,'tag') ;3652 if strcmp(PanelName,' panel_Civ1')3655 PanelName=get(hparent,'tag') 3656 if strcmp(PanelName,'Civ1') 3653 3657 hchildren=get(handles.Civ2,'children'); 3654 handle_checkbox=findobj(hchildren,'tag',' check_Grid');3655 handle_txtbox=findobj(hchildren,'tag','txt_Grid Name');3658 handle_checkbox=findobj(hchildren,'tag','CheckGrid'); 3659 handle_txtbox=findobj(hchildren,'tag','txt_Grid'); 3656 3660 handle_dx=findobj(hchildren,'tag','num_Dx'); 3657 3661 handle_dy=findobj(hchildren,'tag','num_Dy'); 3662 handle_title_dx=findobj(hchildren,'tag','title_Dx'); 3663 handle_title_dy=findobj(hchildren,'tag','title_Dy'); 3658 3664 set(handle_checkbox,'UserData',filegrid);%store for future use 3659 3665 if testgrid … … 3661 3667 set(handle_dx,'Visible','off'); 3662 3668 set(handle_dy,'Visible','off'); 3669 set(handle_title_dx,'Visible','off'); 3670 set(handle_title_dy,'Visible','off'); 3663 3671 set(handle_txtbox,'Visible','on') 3664 3672 set(handle_txtbox,'String',filegrid) 3665 else 3666 set(handle_checkbox,'Value',0); 3667 set(handles.CheckGrid,'Value',0); 3668 set(handle_dx,'Visible','on'); 3669 set(handle_dy,'Visible','on'); 3670 set(handle_txtbox,'Visible','off') 3673 % else 3674 % set(handle_checkbox,'Value',0); 3675 % set(handles.CheckGrid,'Value',0); 3676 % set(handle_dx,'Visible','on'); 3677 % set(handle_dy,'Visible','on'); 3678 % set(handle_title_dx,'Visible','on'); 3679 % set(handle_title_dy,'Visible','on'); 3680 % set(handle_txtbox,'Visible','off') 3671 3681 end 3672 3682 end … … 3676 3686 %------------------------------------------------------------------------ 3677 3687 value=get(hObject,'Value'); 3688 hparent=get(hObject,'parent'); 3689 parent_tag=get(hparent,'Tag'); 3690 hchildren=get(hparent,'children'); 3691 handle_txtbox=findobj(hchildren,'tag','txt_Mask'); 3692 % handle_dx=findobj(hchildren,'tag','num_Dx'); 3693 % handle_dy=findobj(hchildren,'tag','num_Dy'); 3678 3694 testmask=0; 3679 3695 if value … … 3684 3700 testmask=1; 3685 3701 else % browse for a mask 3686 filemask=get(h andles.CheckMask,'UserData');%look for previous mask name stored as UserData3702 filemask=get(hObject,'UserData');%look for previous mask name stored as UserData 3687 3703 if exist(filemask,'file') 3688 3704 filebase=filemask; 3689 3705 end 3690 [FileName, PathName , filterindex] = uigetfile( ...3706 [FileName, PathName] = uigetfile( ... 3691 3707 {'*.png', ' (*.png)'; 3692 3708 '*.png', '.png files '; ... … … 3694 3710 'Pick a mask file *.png',filebase); 3695 3711 filemask=fullfile(PathName,FileName); 3696 set(h andles.CheckMask,'UserData',filemask);%store for future use3712 set(hObject,'UserData',filemask);%store for future use 3697 3713 if ~(isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filemask,'file')) 3698 3714 testmask=1; … … 3701 3717 end 3702 3718 if testmask 3703 set(handles.num_Dx,'Visible','off'); 3704 set(handles.num_Dy,'Visible','off'); 3705 set(handles.num_Dx,'Visible','off'); 3706 set(handles.num_Dy,'Visible','off'); 3707 set(handles.txt_MaskName,'Visible','on') 3708 set(handles.txt_MaskName,'String',filemask) 3709 else 3710 set(handles.CheckMask,'Value',0); 3711 set(handles.CheckGrid,'Value',0); 3712 set(handles.num_Dx,'Visible','on'); 3713 set(handles.num_Dy,'Visible','on'); 3714 set(handles.num_Dx,'Visible','on'); 3715 set(handles.num_Dy,'Visible','on'); 3716 set(handles.txt_MaskName,'Visible','off') 3719 stage=1;%default 3720 switch parent_tag 3721 % case 'Fix1' 3722 % stage=2; 3723 case 'Civ2' 3724 stage=3; 3725 % case 'Fix2' 3726 % stage=4; 3727 end 3728 set(handles.txt_Mask(stage:end),'Visible','on') 3729 set(handles.txt_Mask(stage:end),'String',filemask) 3730 set(handles.CheckMask(stage:end),'Value',1) 3731 else 3732 set(hObject,'Value',0); 3733 set(handle_txtbox,'Visible','off') 3717 3734 end 3718 3735 … … 3922 3939 ref_j=1;%default 3923 3940 end 3924 [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]=...3941 [filecell,i1,i21,j1,j2,i1_civ2,i2_civ2,j1_civ2,j2_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... 3925 3942 set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]); 3926 3943 Data.ListVarName={'ny','nx','A'}; 3927 Data.VarDimName= {'ny','nx',{'ny','nx'}};3944 Data.VarDimName= {'ny','nx',{'ny','nx'}}; 3928 3945 Data.A=imread(filecell.ima1.civ1{1}); 3929 3946 Data.ny=[size(Data.A,1) 1]; 3930 3947 Data.nx=[1 size(Data.A,2)]; 3931 3948 par_civ1=read_GUI(handles.Civ1); 3932 par_civ1.filename_ima_a=filecell.ima1.civ1{1}; 3933 par_civ1.filename_ima_b=filecell.ima2.civ1{1}; 3934 par_civ1.T0=0; 3935 par_civ1.Dt=1; 3949 par_civ1.ImageWidth=size(Data.A,1); 3950 par_civ1.ImageHeight=size(Data.A,2); 3951 par_civ1.Mask='all';% will provide only the grid set for PIV, no image correlation 3936 3952 Param.Civ1=par_civ1; 3937 Data=civ_uvmat(Param); 3938 Data.ListVarName=[Data.ListVarName {'ny','nx','A'}]; 3939 Data.VarDimName=[Data.VarDimName {'ny','nx',{'ny','nx'}}]; 3940 Data.A=imread(filecell.ima1.civ1{1}); 3941 Data.ny=[size(Data.A,1) 1]; 3942 Data.nx=[1 size(Data.A,2)]; 3953 Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV 3943 3954 hview_field=view_field(Data); 3944 3955 set(0,'CurrentFigure',hview_field) … … 3948 3959 ViewData.CivHandle=handles.civ;% indicate the handle of the civ GUI in view_field 3949 3960 ViewData.axes3.B=imread(filecell.ima2.civ1{1});%store the second image in the UserData of the GUI view_field 3950 ViewData.axes3.X= Data.Civ1_X; %keep the set of points in memeory3951 ViewData.axes3.Y= Data.Civ1_Y;3961 ViewData.axes3.X=Grid.Civ1_X; %keep the set of points in memeory 3962 ViewData.axes3.Y=Grid.Civ1_Y; 3952 3963 set(hview_field,'UserData',ViewData) 3953 3964 corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display … … 3970 3981 end 3971 3982 3972 %------------------------------------------------------------------- 3973 % --- 3974 function closeview_field(gcbo,eventdata) 3975 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 3976 if ~isempty(hview_field) 3977 delete(hview_field) 3978 end 3979 3980 3981 %------------------------------------------------------------------------ 3982 % call 'view_field.fig' to display the field selected in the list of 'status' 3983 function open_view_field(hObject, eventdata) 3984 %------------------------------------------------------------------------ 3985 list=get(hObject,'String'); 3986 index=get(hObject,'Value'); 3987 rootroot=get(hObject,'UserData'); 3988 filename=list{index}; 3989 ind_dot=findstr(filename,'...'); 3990 filename=filename(1:ind_dot-1); 3991 filename=fullfile(rootroot,filename); 3992 delete(get(hObject,'parent'))%delete the display figure to stop the check process 3993 if exist(filename,'file')%visualise the vel field if it exists 3994 uvmat(filename) 3995 set(gcbo,'Value',1) 3996 end 3997 3998 %------------------------------------------------------------------------ 3999 % launched by pressing OK on the status figure 4000 function close_GUI(hObject, eventdata) 4001 %------------------------------------------------------------------------ 4002 delete(gcbf) 4003 4004 %------------------------------------------------------------------------ 4005 % launched by deleting the status figure 4006 function stop_status(hObject, eventdata) 4007 %------------------------------------------------------------------------ 4008 hciv=findobj(allchild(0),'tag','civ'); 4009 hhciv=guidata(hciv); 4010 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ 4011 set(hhciv.status,'BackgroundColor',[0 1 0]) 3983 3984 %------------------------------------------------------------------------ 3985 % --- Executes on button press in CheckThreshold. 3986 function CheckThreshold_Callback(hObject, eventdata, handles) 3987 %------------------------------------------------------------------------ 3988 huipanel=get(hObject,'parent'); 3989 obj(1)=findobj(huipanel,'Tag','num_MinIma'); 3990 obj(2)=findobj(huipanel,'Tag','num_MaxIma'); 3991 obj(3)=findobj(huipanel,'Tag','title_Threshold'); 3992 if get(hObject,'Value') 3993 set(obj,'Visible','on') 3994 else 3995 set(obj,'Visible','off') 3996 end 3997 4012 3998 4013 3999 %------------------------------------------------------------------------ … … 4039 4025 % end 4040 4026 4041 4042 4043 4044 4027 %------------------------------------------------------------------------ 4045 4028 function cmd=cmd_civ1(filename,Param) … … 4048 4031 %changes : filename_cmx -> filename ( no extension ) 4049 4032 filename=regexprep(filename,'.nc',''); %file name for the result 4050 Param.Civ14051 4033 if isequal(Param.Civ1.Dt,'0') 4052 4034 Param.Civ1.Dt='1' ;%case of 'displacement' mode 4053 4035 end 4054 Param.Civ1. filename_ima_a=regexprep(Param.Civ1.filename_ima_a,'.png','');4055 Param.Civ1. filename_ima_b=regexprep(Param.Civ1.filename_ima_b,'.png','');4036 Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'.png',''); 4037 Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'.png',''); 4056 4038 fid=fopen([filename '.civ1.cmx'],'w'); 4057 4039 fprintf(fid,['############## CMX file' '\n' ]); 4058 fprintf(fid, ['FirstImage ' regexprep(Param.Civ1. filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility4059 fprintf(fid, ['LastImage ' regexprep(Param.Civ1. filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility4040 fprintf(fid, ['FirstImage ' regexprep(Param.Civ1.ImageA,'\\','\\\\') '\n' ]);% for windows compatibility 4041 fprintf(fid, ['LastImage ' regexprep(Param.Civ1.ImageB,'\\','\\\\') '\n' ]);% for windows compatibility 4060 4042 fprintf(fid, ['XX' '\n' ]); 4061 fprintf(fid, ['Mask ' Param.Civ1.MaskFlag '\n' ]); 4062 fprintf(fid, ['MaskName ' regexprep(Param.Civ1.MaskName,'\\','\\\\') '\n' ]); 4063 fprintf(fid, ['ImageSize ' num2str(Param.Civ1.ImageInfo.Width) ' ' num2str(Param.Civ1.ImageInfo.Height) '\n' ]); %VERIFIER CAS GENERAL ? 4043 if isfield(Param.Civ1,'Mask') 4044 fprintf(fid, ['Mask ' 'y' '\n' ]); 4045 fprintf(fid, ['MaskName ' regexprep(Param.Civ1.Mask,'\\','\\\\') '\n' ]); 4046 else 4047 fprintf(fid, ['Mask ' 'n' '\n' ]); 4048 fprintf(fid, ['MaskName ' 'noFile use default' '\n' ]); 4049 end 4050 fprintf(fid, ['ImageSize ' num2str(Param.Civ1.ImageWidth) ' ' num2str(Param.Civ1.ImageHeight) '\n' ]); %VERIFIER CAS GENERAL ? 4064 4051 fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ1.Bx) ' ' num2str(Param.Civ1.By) '\n' ]); 4065 4052 fprintf(fid, ['SearchBoxeSize ' num2str(Param.Civ1.Searchx) ' ' num2str(Param.Civ1.Searchy) '\n' ]); 4066 4053 fprintf(fid, ['RO ' num2str(Param.Civ1.Rho) '\n' ]); 4067 if isfield(Param.Civ1,'Grid Name')4054 if isfield(Param.Civ1,'Grid') 4068 4055 fprintf(fid, ['GridSpacing ' '25' ' ' '25' '\n' ]); 4069 4056 else … … 4071 4058 end 4072 4059 fprintf(fid, ['XX 1.0' '\n' ]); 4073 fprintf(fid, ['Dt_TO ' num2str(Param.Civ1.Dt) ' ' num2str(Param.Civ1.T 0) '\n' ]);4074 fprintf(fid, ['PixCmXY ' num2str(Param.Civ1.pxcmx) ' ' num2str(Param.Civ1.pxcmy)'\n' ]);4060 fprintf(fid, ['Dt_TO ' num2str(Param.Civ1.Dt) ' ' num2str(Param.Civ1.Time) '\n' ]); 4061 fprintf(fid, ['PixCmXY ' '1' ' ' '1' '\n' ]); 4075 4062 fprintf(fid, ['XX 1' '\n' ]); 4076 4063 fprintf(fid, ['ShiftXY ' num2str(Param.Civ1.Shiftx) ' ' num2str(Param.Civ1.Shifty) '\n' ]); 4077 if isfield(Param.Civ1,'Grid Name')4064 if isfield(Param.Civ1,'Grid') 4078 4065 fprintf(fid, ['Grid ' 'y' '\n' ]); 4079 fprintf(fid, ['GridName ' regexprep(Param.Civ1.Grid Name,'\\','\\\\') '\n' ]);4066 fprintf(fid, ['GridName ' regexprep(Param.Civ1.Grid,'\\','\\\\') '\n' ]); 4080 4067 else 4081 4068 fprintf(fid, ['Grid ' 'n' '\n' ]); … … 4095 4082 else% Image threshold activated 4096 4083 if isempty(Param.Civ1.MaxIma)||isnan(Param.Civ1.MaxIma) 4097 Param.Civ1.MaxIma=2^Param.Civ1.Image Info.BitDepth;%take the max image value as upper bound by default4084 Param.Civ1.MaxIma=2^Param.Civ1.ImageBitDepth;%take the max image value as upper bound by default 4098 4085 end 4099 4086 fprintf(fid, ['SeuilImage y' '\n' ]); … … 4176 4163 Param.Civ2.Dt='1' ;%case of 'displacement' mode 4177 4164 end 4178 Param.Civ2. filename_ima_a=regexprep(Param.Civ2.filename_ima_a,'.png','');4179 Param.Civ2. filename_ima_b=regexprep(Param.Civ2.filename_ima_b,'.png','');% bug : .png appears two times ?4165 Param.Civ2.ImageA=regexprep(Param.Civ2.ImageA,'.png',''); 4166 Param.Civ2.ImageB=regexprep(Param.Civ2.ImageB,'.png','');% bug : .png appears two times ? 4180 4167 [fid,errormsg]=fopen([filename '.civ2.cmx'],'w'); 4181 4168 if isequal(fid,-1) … … 4185 4172 end 4186 4173 fprintf(fid,['############## CMX file' '\n' ]); 4187 fprintf(fid, ['FirstImage ' regexprep(Param.Civ2. filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility4188 fprintf(fid, ['LastImage ' regexprep(Param.Civ2. filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility4174 fprintf(fid, ['FirstImage ' regexprep(Param.Civ2.ImageA,'\\','\\\\') '\n' ]);% for windows compatibility 4175 fprintf(fid, ['LastImage ' regexprep(Param.Civ2.ImageB,'\\','\\\\') '\n' ]);% for windows compatibility 4189 4176 fprintf(fid, ['XX' '\n' ]); 4190 fprintf(fid, ['Mask ' Param.Civ2.MaskFlag '\n' ]); 4191 fprintf(fid, ['MaskName ' regexprep(Param.Civ2.MaskName,'\\','\\\\') '\n' ]);% for windows compatibility 4192 fprintf(fid, ['ImageSize ' num2str(Param.Civ2.ImageInfo.Width) ' ' num2str(Param.Civ2.ImageInfo.Height) '\n' ]); 4177 if isfield(Param.Civ2,'Mask') 4178 fprintf(fid, ['Mask ' 'y' '\n' ]); 4179 fprintf(fid, ['MaskName ' regexprep(Param.Civ2.Mask,'\\','\\\\') '\n' ]); 4180 else 4181 fprintf(fid, ['Mask ' 'n' '\n' ]); 4182 fprintf(fid, ['MaskName ' 'noFile use default' '\n' ]); 4183 end 4184 % fprintf(fid, ['Mask ' Param.Civ2.MaskFlag '\n' ]); 4185 % fprintf(fid, ['MaskName ' regexprep(Param.Civ2.MaskName,'\\','\\\\') '\n' ]);% for windows compatibility 4186 fprintf(fid, ['ImageSize ' num2str(Param.Civ2.ImageWidth) ' ' num2str(Param.Civ2.ImageHeight) '\n' ]); 4193 4187 % fprintf(fid, ['ImageSize ' num2str(Param.Civ2.npx) ' ' num2str(Param.Civ2.npy) '\n' ]); %VERIFIER CAS GENERAL ? 4194 4188 fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ2.Bx) ' ' num2str(Param.Civ2.By) '\n' ]); 4195 4189 fprintf(fid, ['SearchBoxeSize ' num2str(Param.Civ2.Bx) ' ' num2str(Param.Civ2.By) '\n']); 4196 4190 fprintf(fid, ['RO ' num2str(Param.Civ2.Rho) '\n']); 4197 if isfield(Param.Civ2,'Grid Name')4191 if isfield(Param.Civ2,'Grid') 4198 4192 fprintf(fid, ['GridSpacing ' '25' ' ' '25' '\n' ]); 4199 4193 else … … 4202 4196 % fprintf(fid, ['GridSpacing ' num2str(Param.Civ2.Dx) ' ' num2str(Param.Civ2.Dy) '\n']); 4203 4197 fprintf(fid, ['XX 1.0' '\n' ]); 4204 fprintf(fid, ['Dt_TO ' num2str(Param.Civ2.Dt) ' ' num2str(Param.Civ2.T 0) '\n' ]);4205 fprintf(fid, ['PixCmXY ' num2str(Param.Civ2.pxcmx) ' ' num2str(Param.Civ2.pxcmy)'\n' ]);4198 fprintf(fid, ['Dt_TO ' num2str(Param.Civ2.Dt) ' ' num2str(Param.Civ2.Time) '\n' ]); 4199 fprintf(fid, ['PixCmXY ' '1' ' ' '1' '\n' ]); 4206 4200 fprintf(fid, ['XX 1' '\n' ]); 4207 4201 fprintf(fid, 'ShiftXY 0 0\n'); 4208 if isfield(Param.Civ2,'Grid Name')4202 if isfield(Param.Civ2,'Grid') 4209 4203 fprintf(fid, ['Grid ' 'y' '\n' ]); 4210 fprintf(fid, ['GridName ' regexprep(Param.Civ2.Grid Name,'\\','\\\\') '\n' ]);4204 fprintf(fid, ['GridName ' regexprep(Param.Civ2.Grid,'\\','\\\\') '\n' ]); 4211 4205 else 4212 4206 fprintf(fid, ['Grid ' 'n' '\n' ]); … … 4229 4223 else% Image threshold activated 4230 4224 if isempty(Param.Civ2.MaxIma)||isnan(Param.Civ2.MaxIma) 4231 Param.Civ2.MaxIma=2^Param.Civ2.Image Info.BitDepth;%take the max image value as upper bound by default4225 Param.Civ2.MaxIma=2^Param.Civ2.ImageBitDepth;%take the max image value as upper bound by default 4232 4226 end 4233 4227 fprintf(fid, ['SeuilImage y' '\n' ]); … … 4250 4244 4251 4245 %------------------------------------------------------------------------ 4252 % --- Executes on button press in CheckThreshold.4253 function CheckThreshold_Callback(hObject, eventdata, handles)4254 %------------------------------------------------------------------------4255 huipanel=get(hObject,'parent');4256 obj(1)=findobj(huipanel,'Tag','num_MinIma');4257 obj(2)=findobj(huipanel,'Tag','num_MaxIma');4258 obj(3)=findobj(huipanel,'Tag','title_Threshold');4259 if get(hObject,'Value')4260 set(obj,'Visible','on')4261 else4262 set(obj,'Visible','off')4263 end4264 4265 %------------------------------------------------------------------------4266 4246 % --- CheckCiv1 Unified: TO ABADON 4267 4247 function xml_civ1_parameters=CIV1_CMD_Unified(filename,namelog,par) … … 4270 4250 %global CivBin%name of the executable for checkciv1 calculation 4271 4251 4272 civ1.image1=par. filename_ima_a;4273 civ1.image2=par. filename_ima_b;4252 civ1.image1=par.ImageA; 4253 civ1.image2=par.ImageB; 4274 4254 civ1.imageSize_X=par.npx; 4275 4255 civ1.imageSize_Y=par.npy; … … 4295 4275 civ1.dt=par.Dt; 4296 4276 civ1.unit='pixel'; 4297 civ1.absolut_time_T0=par.T 0;4298 civ1.pixcmx= par.pxcmx;4299 civ1.pixcmy= par.pxcmy;4277 civ1.absolut_time_T0=par.Time; 4278 civ1.pixcmx='1'; 4279 civ1.pixcmy='1'; 4300 4280 civ1.convectFlow='n'; 4301 4281 … … 4311 4291 filename=regexprep(filename,'.nc',''); 4312 4292 4313 civ2.image1=par. filename_ima_a;4314 civ2.image2=par. filename_ima_b;4293 civ2.image1=par.ImageA; 4294 civ2.image2=par.ImageB; 4315 4295 civ2.imageSize_X=par.npx; 4316 4296 civ2.imageSize_Y=par.npy; … … 4348 4328 civ2.dt=par.Dt; 4349 4329 civ2.unit='pixel'; 4350 civ2.absolut_time_T0=par.T 0;4351 civ2.pixcmx= par.pxcmx;4352 civ2.pixcmy= par.pxcmy;4330 civ2.absolut_time_T0=par.Time; 4331 civ2.pixcmx='1'; 4332 civ2.pixcmy='1'; 4353 4333 civ2.convectFlow='n'; 4354 civ2.pixcmx=par.pxcmx;4355 civ2.pixcmy=par.pxcmy;4356 civ2.convectFlow='n'; -
trunk/src/mouse_motion.m
r309 r315 218 218 % case of PIV correlation display 219 219 if test_piv 220 %par=civ('read_param_civ1',hhciv);221 220 par=read_GUI(hhciv.Civ1); 222 221 [dd,ind_pt]=min(abs(Field.X-xy(1,1))+abs(Field.Y-xy(1,2))); 223 222 xround=Field.X(ind_pt); 224 223 yround=Field.Y(ind_pt); 225 par. PointCoord=[xround size(Field.A,1)-yround+1];224 par.Grid=[xround size(Field.A,1)-yround+1]; 226 225 % mark the correlation box with a rectangle 227 par.filename_ima_a=Field.A; 228 par.filename_ima_b=Field.B; 226 par.ImageA=Field.A; 227 par.ImageB=Field.B; 228 [par.ImageHeight,par.ImageWidth]=size(par.ImageA); 229 229 Param.Civ1=par; 230 230 ibx2=floor((par.Bx-1)/2); … … 249 249 set(hhhh,'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2]) 250 250 end 251 %[xtable, ytable, utable, vtable, ctable, typevector, result_conv] = ... 252 % pivlab (Field.A,Field.B,ibx2,iby2,isx2,isy2,shiftx,shifty,[xround size(Field.A,1)-yround+1], 1, []); 253 [Data,errormsg,result_conv]= civ_matlab(Param) 251 [Data,errormsg,result_conv]= civ_matlab(Param); 254 252 rangx(1)=-(isx2-ibx2)+shiftx; 255 253 rangx(2)=isx2-ibx2+shiftx; … … 268 266 set(0,'CurrentFigure',corrfig(1)) 269 267 AxeData.CurrentCorrImage=imagesc(rangx,-rangy,result_conv,[0 1]); 270 AxeData.CurrentVector=line([0 Data.Civ1_U],[0 -Data.Civ1_V],'Tag','vector'); 271 268 AxeData.CurrentVector=line([0 Data.Civ1_U],[0 Data.Civ1_V],'Tag','vector'); 272 269 colorbar 273 270 set(haxes,'UserData',AxeData) … … 278 275 set(AxeData.CurrentCorrImage,'XData',rangx) 279 276 set(AxeData.CurrentCorrImage,'YData',-rangy) 280 set(AxeData.CurrentVector,'XData',[0 Data.Civ1_U],'YData',[0 -Data.Civ1_V])277 set(AxeData.CurrentVector,'XData',[0 Data.Civ1_U],'YData',[0 Data.Civ1_V]) 281 278 end 282 279 end -
trunk/src/set_col_vec.m
r313 r315 10 10 % colcode.CName: 'ima_cor','black','white',... 11 11 % colcode.ListColorCode ='black', 'white', 'rgb','brg', '64 colors' 12 % colcode. FixedCbounds=0; thresholds scaling relative to min and max, =1 fixed thresholds13 % colcode.Min C; min14 % colcode.Max C; max12 % colcode.CheckFixVecColor =0; thresholds scaling relative to min and max, =1 fixed thresholds 13 % colcode.MinVec; min 14 % colcode.MaxVec; max 15 15 % colcode.ColCode1: first threshold for rgb, relative to min (0) and max (1) 16 16 % colcode.ColCode2: second threshold for rgb, relative to min (0) and max (1), … … 19 19 % vec_C: matlab vector representing the scalar setting the color 20 20 function [colorlist,col_vec,colcode_out]=set_col_vec(colcode,vec_C) 21 22 21 col_vec=[]; 23 22 colcode_out=colcode;%default … … 61 60 col_vec=ones(size(vec_C));%all vectors at color#1 62 61 elseif strcmp(colcode.ListColorCode,'rgb')|| strcmp(colcode.ListColorCode,'bgr')% 3 color representation 63 ind1=find(vec_C < ColCode1); % =1 for red vectors62 % ind1=find(vec_C < ColCode1); % =1 for red vectors 64 63 ind_green=find((vec_C >= ColCode1) & (vec_C < ColCode2));% =1 for green vectors 65 ind3=find(vec_C >= ColCode2);% =1 for blue vectors64 % ind3=find(vec_C >= ColCode2);% =1 for blue vectors 66 65 colorlist(2,:)=[0 1 0];%green 67 col_vec( ind1)=1;66 col_vec(vec_C < ColCode1)=1; 68 67 col_vec(ind_green)=2; 69 col_vec( ind3)=3;68 col_vec(vec_C >= ColCode2)=3; 70 69 if strcmp(colcode.ListColorCode,'rgb') 71 70 colorlist(1,:)=[1 0 0];%red -
trunk/src/set_grid.m
r84 r315 32 32 'gui_LayoutFcn', [] , ... 33 33 'gui_Callback', []); 34 if nargin & isstr(varargin{1}) 34 % if nargin & isstr(varargin{1}) 35 % gui_State.gui_Callback = str2func(varargin{1}); 36 % end 37 if nargin && ischar(varargin{1}) 35 38 gui_State.gui_Callback = str2func(varargin{1}); 36 39 end 37 38 40 if nargout 39 41 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); -
trunk/src/uvmat.m
r309 r315 932 932 %% view the field 933 933 run0_Callback(hObject, eventdata, handles); %view field 934 mask_test=get(handles. mask_test,'value');934 mask_test=get(handles.CheckMask,'value'); 935 935 if mask_test 936 MaskData=get(handles. mask_test,'UserData');936 MaskData=get(handles.CheckMask,'UserData'); 937 937 if isfield(MaskData,'maskhandle') && ishandle(MaskData.maskhandle) 938 938 delete(MaskData.maskhandle) %delete old mask 939 939 end 940 mask_test_Callback(hObject, eventdata, handles)940 CheckMask_Callback(hObject, eventdata, handles) 941 941 end 942 942 … … 1453 1453 1454 1454 %------------------------------------------------------------------------ 1455 % --- Executes on button press in mask_test.1456 function mask_test_Callback(hObject, eventdata, handles)1455 % --- Executes on button press in CheckMask. 1456 function CheckMask_Callback(hObject, eventdata, handles) 1457 1457 %------------------------------------------------------------------------ 1458 1458 %case of view mask selection 1459 if isequal(get(handles. mask_test,'Value'),1)1459 if isequal(get(handles.CheckMask,'Value'),1) 1460 1460 [FF,RootPath,FileBase]=read_file_boxes(handles); 1461 1461 num_i1=stra2num(get(handles.i1,'String')); … … 1499 1499 set(handles.nb_slice,'String',Name(i+1:ind_mask-1)); 1500 1500 set(handles.nb_slice,'BackgroundColor',[1 1 0]) 1501 set(handles. mask_test,'UserData',Mask);1502 set(handles. mask_test,'BackgroundColor',[1 1 0])1501 set(handles.CheckMask,'UserData',Mask); 1502 set(handles.CheckMask,'BackgroundColor',[1 1 0]) 1503 1503 if nbslice > 1 1504 1504 set(handles.slices,'value',1) … … 1522 1522 Mask.Base=fullfile(RootDir,RootFile); 1523 1523 Mask.NbSlice=1; 1524 set(handles. mask_test,'UserData',Mask);1525 set(handles. mask_test,'BackgroundColor',[1 1 0])1524 set(handles.CheckMask,'UserData',Mask); 1525 set(handles.CheckMask,'BackgroundColor',[1 1 0]) 1526 1526 end 1527 1527 if isempty(errormsg) … … 1529 1529 end 1530 1530 if ~isempty(errormsg) 1531 set(handles. mask_test,'Value',0)1532 set(handles. mask_test,'BackgroundColor',[0.7 0.7 0.7])1531 set(handles.CheckMask,'Value',0) 1532 set(handles.CheckMask,'BackgroundColor',[0.7 0.7 0.7]) 1533 1533 end 1534 else 1535 MaskData=get(handles. mask_test,'UserData');1534 else % desactivate mask display 1535 MaskData=get(handles.CheckMask,'UserData'); 1536 1536 if isfield(MaskData,'maskhandle') && ishandle(MaskData.maskhandle) 1537 1537 delete(MaskData.maskhandle) 1538 1538 end 1539 set(handles. mask_test,'UserData',[])1539 set(handles.CheckMask,'UserData',[]) 1540 1540 UvData=get(handles.uvmat,'UserData'); 1541 1541 if isfield(UvData,'MaskName') … … 1543 1543 set(handles.uvmat,'UserData',UvData) 1544 1544 end 1545 set(handles. mask_test,'BackgroundColor',[0.7 0.7 0.7])1545 set(handles.CheckMask,'BackgroundColor',[0.7 0.7 0.7]) 1546 1546 end 1547 1547 … … 1550 1550 %------------------------------------------------------------------------ 1551 1551 errormsg=[];%default 1552 MaskData=get(handles. mask_test,'UserData');1552 MaskData=get(handles.CheckMask,'UserData'); 1553 1553 if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle) 1554 1554 uistack(MaskData.maskhandle,'top'); … … 1556 1556 num_i1_mask=mod(num_i1-1,MaskData.NbSlice)+1; 1557 1557 MaskName=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType); 1558 huvmat=get(handles. mask_test,'parent');1558 huvmat=get(handles.CheckMask,'parent'); 1559 1559 UvData=get(huvmat,'UserData'); 1560 1560 … … 1623 1623 MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask); 1624 1624 % set(MaskData.maskhandle,'AlphaData',0.6*flagmask) 1625 set(handles. mask_test,'UserData',MaskData)1625 set(handles.CheckMask,'UserData',MaskData) 1626 1626 end 1627 1627 end … … 2556 2556 2557 2557 % second projection object (view_field display) 2558 % IndexObj_2=get(handles.list_object_2,'Value');%selected projection object for the second view 2559 % if IndexObj_2==0 2560 % IndexObj_2=1; 2561 % end 2562 %if isequal(get(handles.list_object_2,'Visible'),'on') && IndexObj_2 <= numel(UvData.Object)&& ~isempty(UvData.Object{IndexObj_2}) 2563 if length( IndexObj)>=2 2564 % IndexObj(2)=IndexObj_2; 2558 if length( IndexObj)>=2 2565 2559 view_field_handle=findobj(allchild(0),'tag','view_field');%handles of the view_field GUI 2566 2560 if ~isempty(view_field_handle) … … 2579 2573 [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj});% project field on the object 2580 2574 if testnewseries && isfield(ObjectData,'CoordUnit')&& isfield(PlotParam{imap},'Coordinates') 2581 PlotParam{imap} =rmfield(PlotParam{imap}.Coordinates,'CheckFixEqual'); %set FixEqual to depend on the field (=1 if Data.CoordUnit=1 in plot_field)2575 PlotParam{imap}.Coordinates=rmfield(PlotParam{imap}.Coordinates,'CheckFixEqual'); %set FixEqual to depend on the field (=1 if Data.CoordUnit=1 in plot_field) 2582 2576 end 2583 2577 if ~isempty(errormsg) … … 2651 2645 2652 2646 %% update the mask 2653 if isequal(get(handles. mask_test,'Value'),1)%if the mask option is on2647 if isequal(get(handles.CheckMask,'Value'),1)%if the mask option is on 2654 2648 update_mask(handles,num_i1,num_i2); 2655 2649 end … … 3818 3812 UvData.Object=UvData.Object(1); 3819 3813 end 3820 list_object=get(handles.ListObject,'String');3814 %list_object=get(handles.ListObject,'String'); 3821 3815 set(handles.ListObject,'Value',1) 3822 3816 set(handles.ListObject,'String',{''}) … … 3826 3820 3827 3821 %delete mask if it is displayed 3828 if isequal(get(handles. mask_test,'Value'),1)%if the mask option is on3822 if isequal(get(handles.CheckMask,'Value'),1)%if the mask option is on 3829 3823 UvData=rmfield(UvData,'MaskName'); %will impose mask refresh 3830 3824 end … … 3832 3826 run0_Callback(hObject, eventdata, handles) 3833 3827 3834 %-------------------------------------------- 3828 %------------------------------------------------------------------------ 3835 3829 function histo1_menu_Callback(hObject, eventdata, handles) 3836 3830 %-------------------------------------------- … … 3842 3836 update_histo(handles.histo_u,huvmat,FieldName) 3843 3837 3844 %---------------------------------------------- 3838 %------------------------------------------------------------------------ 3845 3839 function histo2_menu_Callback(hObject, eventdata, handles) 3846 %---------------------------------------------- 3840 %------------------------------------------------------------------------ 3847 3841 %plot second histo 3848 3842 huvmat=get(handles.histo2_menu,'parent'); … … 3852 3846 update_histo(handles.histo_v,huvmat,FieldName) 3853 3847 3854 3855 %-------------------------------------------- 3848 %------------------------------------------------------------------------ 3856 3849 %read the field .Fieldname stored in UvData and plot its histogram 3857 3850 function update_histo(haxes,huvmat,FieldName) 3851 %------------------------------------------------------------------------ 3858 3852 UvData=get(huvmat,'UserData'); 3859 3853 if ~isfield(UvData.Field,FieldName) … … 4108 4102 list=get(handles.ListColorCode,'String'); 4109 4103 ichoice=get(handles.ListColorCode,'Value'); 4110 colcode. ColorCode=list{ichoice};4111 colcode.Min C=str2num(get(handles.num_MinVec,'String'));4112 colcode.Max C=str2num(get(handles.num_MaxVec,'String'));4113 test3color=strcmp(colcode. ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');4104 colcode.ListColorCode=list{ichoice}; 4105 colcode.MinVec=str2num(get(handles.num_MinVec,'String')); 4106 colcode.MaxVec=str2num(get(handles.num_MaxVec,'String')); 4107 test3color=strcmp(colcode.ListColorCode,'rgb') || strcmp(colcode.ListColorCode,'bgr'); 4114 4108 if test3color 4115 colcode. colcode1=str2num(get(handles.num_ColCode1,'String'));4116 colcode. colcode2=str2num(get(handles.num_ColCode2,'String'));4117 end 4118 colcode.FixedCbounds=0;4119 colcode.FixedCbounds=1;4120 vec_C=colcode.Min C+(colcode.MaxC-colcode.MinC)*(0.5:width-0.5)/width;%sample of vec_C values from min to max4109 colcode.ColCode1=str2num(get(handles.num_ColCode1,'String')); 4110 colcode.ColCode2=str2num(get(handles.num_ColCode2,'String')); 4111 end 4112 % colcode.FixedCbounds=0; 4113 %colcode.CheckFixVecColor=1; 4114 vec_C=colcode.MinVec+(colcode.MaxVec-colcode.MinVec)*(0.5:width-0.5)/width;%sample of vec_C values from min to max 4121 4115 [colorlist,col_vec]=set_col_vec(colcode,vec_C); 4122 4116 oneheight=ones(1,height); … … 4138 4132 write_plot_param(handles,PlotParamOut); %update the auto plot parameters 4139 4133 4140 % -------------------------------------------------------------------4141 % --- Executes on button press in grid.4142 function grid_Callback(hObject, eventdata, handles)4134 % %------------------------------------------------------------------- 4135 % % --- Executes on button press in grid. 4136 % function grid_Callback(hObject, eventdata, handles) 4143 4137 4144 4138 -
trunk/src/view_field.m
r302 r315 280 280 % --- Executes on button press in FixEqual. 281 281 function CheckFixEqual_Callback(hObject, eventdata, handles) 282 test=get(handles. FixEqual,'Value');282 test=get(handles.CheckFixEqual,'Value'); 283 283 if test 284 284 set(handles.CheckFixEqual,'BackgroundColor',[1 1 0])
Note: See TracChangeset
for help on using the changeset viewer.