- Timestamp:
- Jun 8, 2010, 5:43:33 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plot_field.m
r94 r99 141 141 if testnewfig% create a new figure and axes if the plotting axes does not exist 142 142 hfig=figure; 143 if isfield(Data,'IndexObj') && isfield(Data,'Style') && isfield(Data,'ProjMode')144 figname=[num2str(Data.IndexObj) '-' Data.Style];145 set(hfig,'Name',figname)146 end143 % if isfield(Data,'IndexObj') && isfield(Data,'Style') && isfield(Data,'ProjMode') 144 % figname=[num2str(Data.IndexObj) '-' Data.Style]; 145 % set(hfig,'Name',figname) 146 % end 147 147 % testhandle=0; 148 148 if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1) -
trunk/src/update_obj.m
r82 r99 76 76 % [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles); 77 77 Object_out.plotaxes=plotaxes; 78 plotfig=get(plotaxes,'parent');79 name_str=get(plotfig,'Name');80 if ~isequal(name_str,'uvmat')81 set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]);82 end78 % plotfig=get(plotaxes,'parent'); 79 % name_str=get(plotfig,'Name'); 80 % if ~isequal(name_str,'uvmat') 81 % set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]); 82 % end 83 83 end 84 84 -
trunk/src/uvmat.m
r98 r99 173 173 function varargout = uvmat(varargin) 174 174 175 176 175 % Begin initialization code - DO NOT EDIT 177 176 gui_Singleton = 1; … … 4339 4338 end 4340 4339 hset_object=set_object(ObjectData,PlotHandles,ZBounds);% call the set_object interface, 4341 set(hset_object,'name',ObjectName)4340 %set(hset_object,'name',ObjectName) 4342 4341 4343 4342 % %project the current field on the object and plot it … … 4956 4955 [pp,data.Name]=fileparts(FileName); 4957 4956 %PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters 4958 hset_object=findobj(allchild(0),' Name','set_object');4957 hset_object=findobj(allchild(0),'tag','set_object'); 4959 4958 if ~isempty(hset_object) 4960 4959 delete(hset_object)% delete existing version of set_object … … 5052 5051 delete(hh) 5053 5052 end 5054 hh=findobj(allchild(0),' name','geometry_calib');5053 hh=findobj(allchild(0),'tag','geometry_calib'); 5055 5054 if ~isempty(hh) 5056 5055 delete(hh) -
trunk/src/view_field.m
r87 r99 250 250 set(handles.RunMovie,'BackgroundColor',[1 0 0])%paint the command buttonback to red 251 251 252 %-------------------------------------------------------------------253 function STOP_Callback(hObject, eventdata, handles)254 %-------------------------------------------------------------------255 set(handles.movie_pair,'BusyAction','Cancel')256 set(handles.movie_pair,'value',0)257 set(handles.RunMovie,'BusyAction','Cancel')258 set(handles.MenuExportMovie,'BusyAction','Cancel')259 260 261 %------------------------------------------------------------------262 function runpm(hObject,eventdata,handles,increment)263 %------------------------------------------------------------------264 %check for mùovie pair status265 movie_status=get(handles.movie_pair,'Value');266 if isequal(movie_status,1)267 STOP_Callback(hObject, eventdata, handles)268 end269 %read the data on the current input rootfile(s)270 271 [FileName,RootPath,filebase,FileIndices,FileExt,subdir]=read_file_boxes(handles);272 NomType=get(handles.FileIndex,'UserData');273 274 num1=stra2num(get(handles.i1,'String'));275 num2=stra2num(get(handles.i2,'String'));276 num_a=stra2num(get(handles.j1,'String'));277 num_b=stra2num(get(handles.j2,'String'));278 279 sub_value= get(handles.SubField,'Value');280 if sub_value ==1281 [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);282 end283 284 comp_input=get(handles.fix_pair,'Value');285 if isequal(NomType,'_i1-i2')|isequal(NomType,'_i1-i2_j')286 comp_input=1; %impose a fixed pair interval287 set(handles.fix_pair,'Value',1)288 end289 290 %case of scanning along the first direction (rootfile numbers)291 if get(handles.scan_i,'Value')==1% case of scanning along field numbers292 num1=num1+increment;293 num2=num2+increment;294 if comp_input==0% find a free pair295 [filename,num_i1_out,num_j1_out,num_i2_out,num_j2_out]=...296 name_generator(filebase,num1,num_a,FileExt,NomType,0,num2,num_b,subdir);297 if exist(filename,'file')298 num_a=num_j1_out;299 num_b=num_j2_out;300 end301 end302 if sub_value>=2303 num_i1=num_i1+increment;304 num_i2=num_i2+increment;305 end306 else % case of scanning along the second direction (burst numbers)307 lastfield_cell=get(handles.last_j,'String'); % get the last field number308 lastfield=str2num(lastfield_cell{1});309 num_a=num_a+increment;310 num_b=num_b+increment;311 if sub_value >=2312 num_j1=num_j1+increment;313 num_j2=num_j2+increment;314 elseif ~isempty(lastfield) && num_a>lastfield315 num_a=1;316 num1=num1+1;317 num2=num2+1;318 end319 end320 321 % display the new open numbers322 set(handles.i1,'String',num2stra(num1,NomType,1));323 set(handles.i2,'String',num2stra(num2,NomType,1));324 set(handles.j1,'String',num2stra(num_a,NomType,2));325 set(handles.j2,'String',num2stra(num_b,NomType,2));326 [indices]=name_generator('',num1,num_a,'',NomType,1,num2,num_b,'');327 set(handles.FileIndex,'String',indices);328 if sub_value ==1329 NomType_1=get(handles.FileIndex_1,'UserData');330 [indices]=...331 name_generator('',num1,num_a,'',NomType_1,1,num2,num_b,'');332 set(handles.FileIndex_1,'String',indices);333 end334 335 if isequal(movie_status,1)336 set(handles.movie_pair,'Value',1)337 movie_pair_Callback(hObject, eventdata, handles); %run338 else339 % refresh plots340 run0_Callback(hObject, eventdata, handles); %run341 end342 343 344 %-------------------------------------------------------345 % --- Executes on button press in movie_pair: create an alternating movie with two view346 %-------------------------------------------------------347 function movie_pair_Callback(hObject, eventdata, handles)348 status=get(handles.movie_pair,'value');349 if isequal(status,0)350 set(handles.movie_pair,'BusyAction','Cancel')351 return352 else353 set(handles.movie_pair,'BusyAction','queue')354 end355 %initialisation356 set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow357 drawnow358 list_fields=get(handles.Fields,'String');% list menu fields359 index_fields=get(handles.Fields,'Value');% selected string index360 FieldName=list_fields{index_fields}; % selected field361 if isequal(FieldName,'image')362 run0_Callback(hObject, eventdata, handles)%display the first image363 UvData=get(handles.view_field,'UserData');364 else365 msgbox_view_field('ERROR','an image or movie must be first introduced as input')366 return367 end368 [ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes(handles);369 NomType=get(handles.FileIndex,'UserData');370 num_i1=stra2num(get(handles.i1,'String'));371 num_j1=stra2num(get(handles.j1,'String'));372 num_i2=stra2num(get(handles.i2,'String'));373 num_j2=stra2num(get(handles.j2,'String'));374 if isempty(num_j2)375 if isempty(num_i2)376 msgbox_view_field('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')377 return378 else379 num_j2=num_j1;%repeat the index i1 by default380 end381 end382 if isempty(num_i2)383 num_i2=num_i1;%repeat the index i1 by default384 end385 imaname_1=name_generator(filebase,num_i2,num_j2,Ext,NomType);386 if ~exist(imaname_1,'file')387 msgbox_view_field('ERROR',['second input open (-) ' imaname_1 ' not found']);388 return389 end390 % set(handles.i2,'String',''); % indicates that the second index i2 is not used391 % set(handles.j2,'String',''); % indicates that the second index i2 is not used392 393 %read the second image394 Field.AName='image';395 Field.AX=UvData.Field.AX;396 Field.AY=UvData.Field.AY;397 % z index398 nbslice=str2double(get(handles.nb_slice,'String'));399 if ~isempty(nbslice)400 Field.ZIndex=mod(num_i2-1,nbslice)+1;401 end402 Field.CoordType='px';403 %determine the input file type404 if isfield(UvData,'MovieObject')405 FileType='movie';406 elseif isequal(lower(Ext),'.avi')407 FileType='avi';408 elseif isequal(lower(Ext),'.vol')409 FileType='vol';410 else411 form=imformats(Ext([2:end]));412 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab413 if isequal(NomType,'*');414 FileType='multimage';415 else416 FileType='image';417 end418 end419 end420 switch FileType421 case 'movie'422 Field.A=read(UvData.MovieObject,num_i2);423 case 'avi'424 mov=aviread(imaname_1,num_i2);425 Field.A=frame2im(mov(1));426 case 'vol'427 Field.A=imread(imaname_1);428 case 'multimage'429 Field.A=imread(imaname_1,num_i2);430 case 'image'431 Field.A=imread(imaname_1);432 end433 434 %px to phys or other transform on field435 menu_transform=get(handles.transform_fct,'String');436 choice_value=get(handles.transform_fct,'Value');437 transform_name=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct'438 transform_list=get(handles.transform_fct,'UserData');439 transform=transform_list{choice_value};440 if ~isequal(transform_name,'') && ~isequal(transform_name,'px')441 if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority442 Field=transform(Field,UvData.XmlData);443 end444 end445 446 % make movie until movie speed is set to 0 or STOP is activated447 hima=findobj(handles.axes3,'Tag','ima');% %handles.axes3 =main plotting window (A GENERALISER)448 set(handles.STOP,'Visible','on')449 set(handles.speed,'Visible','on')450 set(handles.speed_txt,'Visible','on')451 while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue')%isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command452 % read and plot the series of images in non erase mode453 set(hima,'CData',Field.A);454 pause(1.02-get(handles.speed,'Value'));% wait for next image455 set(hima,'CData',UvData.Field.A);456 pause(1.02-get(handles.speed,'Value'));% wait for next image457 end458 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red459 460 %-------------------------------------------------------461 % --- Executes on button press in run0.462 %-------------------------------------------------463 function run0_Callback(hObject, eventdata, handles)464 465 %initialisation466 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow467 drawnow468 abstime=[];469 abstime_1=[];470 dt=[];471 Field={};472 UvData=get(handles.view_field,'UserData');473 if isfield(UvData,'Txt')474 UvData=rmfield(UvData,'Txt');%erase previous error message475 end476 %set(handles.run0,'BusyAction','queue');477 if ishandle(handles.VIEW_FIELD_title) %remove title panel on view_field478 delete(handles.VIEW_FIELD_title)479 end480 481 % determine the main input file information for action482 TestInputFile=1;%default483 if isfield(UvData,'TestInputFile')&& isequal(UvData.TestInputFile,0),484 TestInputFile=0;485 end486 num_i1=[];%default487 FileType=[];%default488 if TestInputFile489 [filename,RootPath,filebase,xx,Ext]=read_file_boxes(handles);490 if ~exist(filename,'file')491 msgbox_view_field('ERROR',['input file ' filename ' does not exist'])492 return493 end494 num_i1=stra2num(get(handles.i1,'String'));495 num_i2=stra2num(get(handles.i2,'String'));496 num_j1=stra2num(get(handles.j1,'String'));497 num_j2=stra2num(get(handles.j2,'String'));498 NomType=get(handles.FileIndex,'UserData');499 %update the z position index500 nbslice=str2double(get(handles.nb_slice,'String'));501 if ~isnan(nbslice)502 z_index=mod(num_i1-1,nbslice)+1;503 set(handles.z_index,'String',num2str(z_index))504 % refresh menu for save_mask if relevant505 masknumber=get(handles.masklevel,'String');506 if length(masknumber)>=z_index507 set(handles.masklevel,'Value',z_index)508 end509 end510 % determine the input file type511 if isequal(Ext,'.nc')||isequal(Ext,'.cdf')512 FileType='netcdf';513 elseif isfield(UvData,'MovieObject')514 FileType='movie';515 FieldName='image';516 elseif isequal(lower(Ext),'.avi')517 FileType='avi';518 FieldName='image';519 elseif isequal(lower(Ext),'.vol')520 FileType='vol';521 FieldName='image';522 else523 form=imformats(Ext([2:end]));524 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab525 if isequal(NomType,'*');526 FileType='multimage';527 else528 FileType='image';529 end530 FieldName='image';531 end532 end533 else534 filename=[];535 FileType='netcdf';536 FieldName='get_field...';537 end538 VelType=[];%default539 if isequal(FileType,'netcdf')540 list_fields=get(handles.Fields,'String');% list menu fields541 index_fields=get(handles.Fields,'Value');% selected string index542 FieldName= list_fields{index_fields}; % selected field543 if isequal(FieldName,'get_field...')% read the field names on the interface get_field...544 VelType=get(handles.Fields,'UserData');545 Field{1}=get(handles.Fields,'UserData');546 else547 VelType=setfield(handles);548 end549 end550 551 % choose a second field if Subfield option is 'on'552 filename_1=[];553 FieldName_1=[];554 scal_color=[];555 VelType_1=setfield_1(handles);556 sub_value=get(handles.SubField,'Value');557 FileType_1='none';%default558 if sub_value==1559 filename_1=read_file_boxes_1(handles);560 if ~exist(filename_1,'file')561 msgbox_view_field('ERROR',['second file ' filename_1 ' does not exist'])562 return563 end564 NomType_1=get(handles.FileIndex_1,'UserData');565 Ext_1=get(handles.FileExt_1,'String');566 % determine the input file type567 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')568 FileType_1='netcdf';569 elseif isfield(UvData,'MovieObject_1')570 FileType_1='movie';571 FieldName_1='image';572 elseif isequal(lower(Ext_1),'.avi')573 FileType='avi';574 FieldName_1='image';575 elseif isequal(lower(Ext_1),'.vol')576 FileType_1='vol';577 FieldName_1='image';578 else579 form=imformats(Ext([2:end]));580 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab581 if isequal(NomType_1,'*');582 FileType_1='multimage';583 else584 FileType_1='image';585 end586 FieldName_1='image';587 end588 end589 if ~isequal(FieldName_1,'image')590 list_fields=get(handles.Fields_1,'String');% list menu fields591 index_fields=get(handles.Fields_1,'Value');% selected string index592 FieldName_1= list_fields{index_fields}; % selected field593 if isequal(VelType_1,'*')% free veltype choice594 VelType_1=[];595 elseif isequal(VelType_1,'"')% veltype the same as for the first field596 if isempty(VelType)597 VelType_1=[];598 else599 VelType_1=VelType;600 end601 end602 end603 end604 605 % test for keeping the previous stored data if the input files are unchanged606 test_keepdata_1=0;%defautl607 test_keepdata=0;608 if sub_value>=2609 if ~isequal(NomType_1,'*')%in cas of a series of files (not avi movie)610 if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1')611 test_keepdata_1= isequal(filename_1,UvData.filename_1)&&...612 isequal(VelType_1,UvData.filename_1) && isequal(FieldName_1,UvData.FieldName_1);613 614 end615 end616 end617 618 %read the input field(s)619 620 %read images621 if ~isempty(filename) && isequal(FieldName,'image')622 switch FileType623 case 'movie'624 A=read(UvData.MovieObject,num_i1);625 case 'avi'626 mov=aviread(filename,num_i1);627 A=frame2im(mov(1));628 case 'vol'629 A=imread(filename);630 case 'multimage'631 A=imread(filename,num_i1);632 case 'image'633 A=imread(filename);634 end635 npxy=size(A);636 set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface637 set(handles.npy,'String',num2str(npxy(1)));638 Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers639 Rangy=[npxy(1)-0.5 0.5]; %640 Field{1}.AName='image';641 Field{1}.ListVarName={'AY','AX','A'}; %642 if size(A,3)==3;%color643 Field{1}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %644 else645 Field{1}.VarDimName={'AY','AX',{'AY','AX'}}; %646 end647 Field{1}.AY=Rangy;648 Field{1}.AX=Rangx;649 Field{1}.A=A;650 Field{1}.CoordType='px'; %used for mouse_motion651 Field{1}.CoordUnit='pixel'; %used for mouse_motion652 end653 654 %read a second image655 if ~isfield(UvData,'Txt')&& ~isempty(filename_1) && isequal(FieldName_1,'image')656 switch FileType_1657 case 'movie'658 A=read(UvData.MovieObject_1,num_i1);659 case 'avi'660 mov=aviread(filename,num_i1);661 A=frame2im(mov(1));662 case 'vol'663 A=imread(filename);664 case 'multimage'665 A=imread(filename,num_i1);666 case 'image'667 A=imread(filename);668 end669 npxy=size(A);670 set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface671 set(handles.npy,'String',num2str(npxy(1)));672 Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers673 Rangy=[npxy(1)-0.5 0.5]; %674 Field{2}.AName='image';675 Field{2}.ListVarName={'AY','AX','A'}; %676 if size(A,3)==3;%color677 Field{2}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %678 else679 Field{2}.VarDimName={'AY','AX',{'AY','AX'}}; %680 end681 Field{2}.AY=Rangy;682 Field{2}.AX=Rangx;683 Field{2}.A=A;684 Field{2}.CoordType='px'; %used for mouse_motion685 Field{2}.CoordUnit='px'; %used for move_mou686 end687 688 %read ncfile(s)689 CivStage_1=0;%default690 VelType_out_1=[];691 InputField={FieldName};692 InputField_1={FieldName_1};693 if ~isfield(UvData,'Txt') && ((~isempty(filename)&& isequal(FileType,'netcdf')) || (~isempty(filename_1)&& isequal(FileType,'netcdf'))) ;694 %read the velocity field(s) from netcdf rootfile(s)695 list_code=get(handles.col_vec,'String');% list menu fields696 index_code=get(handles.col_vec,'Value');% selected string index697 scal_color= list_code{index_code(1)}; % selected field698 if isequal(FieldName,'velocity')&& ~isequal(scal_color,'black') && ~isequal(scal_color,'white')699 InputField=[InputField scal_color];700 end701 if isequal(FieldName_1,'velocity') && ~isequal(scal_color,'black') && ~isequal(scal_color,'white')702 InputField_1=[InputField_1 scal_color];703 end704 if isequal(FileType,'netcdf') %read the first nc field705 if isequal(FieldName,'get_field...')% read the field names on the interface get_field.706 VelType=get(handles.Fields,'UserData');707 hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI708 if isempty(hget_field)709 hget_field= get_field(filename);%open the get_field GUI710 end711 hhget_field=guidata(hget_field);712 set(hhget_field.inputfile,'String',filename)% update the list of input fields in get_field713 set(hhget_field.ACTION,'Value',1)% PLOT option selected714 set(hhget_field.list_fig,'Value',2)% plotting axes =view_field selected715 [Field{1},errormsg]=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI716 if ~isempty(errormsg)717 msgbox_view_field('ERROR',['error in view_field/run0_Callback/read_get_field: ' errormsg])718 return719 end720 CivStage=0;721 VelType_out=[];722 else723 [Field{1},VelType_out]=read_civxdata(filename,InputField,VelType);724 if isfield(Field{1},'Txt')725 msgbox_view_field('ERROR',Field{1}.Txt)726 return727 end728 CivStage=Field{1}.CivStage;729 UvData.NbDim=Field{1}.nb_dim;730 end731 end732 if ~isempty(filename_1) && isequal(FileType_1,'netcdf') %read the second file733 if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field.734 hget_field=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI735 if isempty(hget_field)736 hget_field= get_field(filename_1);%open the get_field GUI737 set(hget_field,'name','get_field_1')738 % enable_transform(handles,'off')% no field transform (possible transform in the GUI get_field)739 end740 hhget_field=guidata(hget_field);%handles of GUI elements in get_field741 SubField=get_field('read_var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI742 [Field{2},var_detect]=nc2struct(filename_1,SubField.ListVarName); %read the corresponding input data743 Field{2}.VarAttribute=SubField.VarAttribute;744 %update the display on get_field745 set(hhget_field.inputfile,'String',filename_1)746 set(hhget_field.variables,'Value',1)747 Tabchar={''};%default748 Tabcell=[];749 if isfield(Field{2},'ListGlobalAttribute')& ~isempty(Field{2}.ListGlobalAttribute)750 for iline=1:length(Field{2}.ListGlobalAttribute)751 Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline};752 if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline})753 eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';'])754 if ischar(val);755 Tabcell{iline,2}=val;756 else757 Tabcell{iline,2}=num2str(val);758 end759 end760 end761 if ~isempty(Tabcell)762 Tabchar=cell2tab(Tabcell,'=');763 Tabchar=[{''};Tabchar];764 end765 end766 set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field767 else768 [Field{2},VelType_out_1]=read_civxdata(filename_1,[],VelType_1);769 CivStage_1=Field{2}.CivStage;770 end771 if ~isequal(FileType,'netcdf')772 VelType_out=VelType_out_1;773 end774 end775 end776 777 %update the display buttons for the first velocity type (first menuline)778 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];779 if ~isequal(FileType,'netcdf')780 reset_vel_type(veltype_handles)781 elseif isempty(VelType)782 set_veltype_display(veltype_handles,CivStage)%update the display of available velocity types for the first field783 if isempty(VelType_out)784 reset_vel_type(veltype_handles)785 else786 handle1=eval(['handles.' VelType_out]);787 reset_vel_type(veltype_handles,handle1)788 end789 end790 791 %update the display buttons for the second velocity type (second menuline)792 veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];793 if ~isequal(FileType_1,'netcdf')794 reset_vel_type(veltype_handles_1)795 elseif isempty(VelType_1)796 set_veltype_display(veltype_handles_1,CivStage_1)%update the display of available velocity types for the first field797 if isempty(VelType_out_1)798 reset_vel_type(veltype_handles_1)799 else800 handle1=eval(['handles.' VelType_out_1 '_1']);801 reset_vel_type(veltype_handles_1,handle1)802 end803 end804 805 %introduce w as background image by default for a new series (only for nbdim=2)806 if ~isfield(UvData,'NewSeries')807 UvData.NewSeries=1;808 end809 %put W as background image by default if NbDim=2:810 if ~isfield(UvData,'NbDim')||isempty(UvData.NbDim)||~isequal(UvData.NbDim,3)811 if UvData.NewSeries && isequal(get(handles.SubField,'Value'),0) && isfield(Field{1},'W') && ~isempty(Field{1}.W);812 set(handles.SubField,'Value',1);813 %menu=update_menu(handles.Fields_1,'w');%update the menu for the background scalar nd set the choice to 'w'814 set(handles.RootPath_1,'String','"')815 set(handles.RootFile_1,'String','"')816 set(handles.SubDir_1,'String','"');817 [indices]=name_generator('',num_i1,num_j1,'',NomType,1,num_i2,num_j2,'');818 set(handles.FileIndex_1,'String',indices)819 set(handles.FileExt_1,'String','"');820 set(handles.Fields_1,'Visible','on');821 set(handles.Fields_1,'Visible','on');822 set(handles.RootPath_1,'Visible','on')823 set(handles.RootFile_1,'Visible','on')824 set(handles.SubDir_1,'Visible','on');825 set(handles.FileIndex_1,'Visible','on');826 set(handles.FileExt_1,'Visible','on');827 set(handles.Fields_1,'Visible','on');828 Field{1}.AName='w';829 testscal=1;830 end831 end832 833 %multislice case834 if TestInputFile &&(~isfield(UvData,'NbDim') || isequal(UvData.NbDim,2))&&...%2D case835 isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')&& isfield(UvData.XmlData.GeometryCalib,'SliceCoord')836 % nbfield2=str2num(get(handles.last_j,'String'));837 siz=size(UvData.XmlData.GeometryCalib.SliceCoord);838 if siz(1)>1839 NbSlice=siz(1);840 set(handles.slices,'Visible','on')841 set(handles.slices,'Value',1)842 else843 NbSlice=1;844 end845 set(handles.nb_slice,'String',num2str(NbSlice))846 slices_Callback(hObject, eventdata, handles)847 % Coord=UvData.XmlData.GeometryCalib.SliceCoord;848 % ZIndex=num_i1-NbSlice*(floor((num_i1-1)/NbSlice));849 % Field{1}.Z=ZIndex;850 end851 852 %store the current open names, fields and vel types in view_field interface853 UvData.filename=filename;854 UvData.filename_1=filename_1;855 UvData.VelType=VelType;856 UvData.VelType_1=VelType_1;857 UvData.FieldName=FieldName;858 UvData.FieldName_1=FieldName_1;859 if ~isempty(scal_color)860 UvData.CName=scal_color;861 end862 863 %coordinate transform or user fct864 XmlData=[];%default865 if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority866 XmlData=UvData.XmlData;867 end868 XmlData_1=[];%default869 if isfield(UvData,'XmlData_1')870 XmlData_1=UvData.XmlData_1;871 end872 menu_transform=get(handles.transform_fct,'String');873 choice_value=get(handles.transform_fct,'Value');874 %transform=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct'875 transform_list=get(handles.transform_fct,'UserData');876 transform=transform_list{choice_value};%selected function handles877 878 % z index879 if TestInputFile880 Field{1}.ZIndex=mod(num_i1-1,nbslice)+1;881 end882 %px to phys or other transform on field883 if ~isempty(transform)884 if length(Field)>=2885 Field{2}.ZIndex=mod(num_i1-1,nbslice)+1;886 [Field{1},Field{2}]=transform(Field{1},XmlData,Field{2},XmlData_1);887 if isempty(Field{2})888 Field(2)=[];889 end890 else891 Field{1}=transform(Field{1},XmlData);892 end893 end894 895 %calculate scalar896 if isequal(FileType,'netcdf') && ~isequal(FieldName,'get_field...')%897 Field{1}=calc_field(InputField,Field{1});898 end899 if length(Field)==2 && isequal(FileType_1,'netcdf') && ~isequal(FieldName_1,'get_field...')900 Field{2}=calc_field(InputField_1,Field{2});901 end902 903 % combine the two input fields (e.g. substract velocity fields)904 if numel(Field)==2905 if ~(isequal(get(handles.movie_pair,'Value'),1) && isequal(FieldName,'image') && isequal(FieldName_1,'image')) %combine fields if not viewing image pairs906 UvData.Field=sub_field(Field{1},Field{2}); %TO UPDATE FOR MORE GENERAL INPUT907 end908 else909 UvData.Field=Field{1};910 end911 UvData.NewSeries=0;% put to 0 the test for a new field series (set by RootPath_callback)912 % test 3D , default projection menuplane and typical mesh (needed to menuopen set_object)913 test_x=0;914 test_z=0;% test for unstructured z coordinate915 UvData.ZMax=0;916 UvData.ZMin=0;%default917 UvData.Mesh=1; %default918 [UvData.Field,errormsg]=check_field_structure(UvData.Field);919 if ~isempty(errormsg)920 msgbox_view_field('ERROR',['error in view_field/run0_Callback/check_field_structure: ' errormsg])921 return922 end923 [CellVarIndex,NbDim,VarType]=find_field_indices(UvData.Field);924 [NbDim,imax]=max(NbDim);925 if isempty(imax)926 % DimVarIndex=0;927 coord_x=[];928 else929 % VarIndex=CellVarIndex{imax};930 coord_x=VarType{imax}.coord_x;931 end932 if isfield(UvData,'NbDim') && ~isempty(UvData.NbDim)933 NbDim=UvData.NbDim;934 else935 UvData.NbDim=NbDim;936 end937 if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) %unstructured coordinate z938 XName=UvData.Field.ListVarName{VarType{imax}.coord_x};939 YName=UvData.Field.ListVarName{VarType{imax}.coord_y};940 test_x=1;941 elseif isfield(UvData.Field,'X') && isfield(UvData.Field,'Y')942 XName='X';943 YName='Y';944 test_x=1;945 end946 if test_x947 eval(['UvData.XMax=max(UvData.Field.' XName ');'])948 eval(['UvData.XMin=min(UvData.Field.' XName ');'])949 eval(['UvData.YMax=max(UvData.Field.' YName ');'])950 eval(['UvData.YMin=min(UvData.Field.' YName ');'])951 eval(['nbvec=length(UvData.Field.' XName ');'])952 if NbDim==3%953 if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_z)%unstructured coordinate z954 ZName=UvData.Field.ListVarName{VarType{imax}.coord_z};955 eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])956 eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])957 test_z=1;958 elseif isfield(UvData,'Z')% usual civ data959 UvData.ZMax=max(UvData.Z);960 UvData.ZMin=min(UvData.Z);961 test_z=1;962 end963 end964 if isequal(UvData.ZMin,UvData.ZMax)%no z dependency965 NbDim=2;966 test_z=0;967 end968 if test_z969 UvData.Mesh=((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)*(UvData.ZMax-UvData.ZMin))/nbvec;% volume per vector970 UvData.Mesh=(UvData.Mesh)^(1/3);971 else972 UvData.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/nbvec);%2D973 end974 end975 %case of structured coordinates976 if isfield(UvData.Field,'AX') & isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')977 UvData.XMax=max(UvData.Field.AX);978 UvData.XMin=min(UvData.Field.AX);979 UvData.YMax=max(UvData.Field.AY);980 UvData.YMin=min(UvData.Field.AY);981 np_A=size(UvData.Field.A);982 UvData.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/((np_A(1)-1) * (np_A(2)-1))) ;983 end984 if isempty(coord_x)&~isempty(CellVarIndex)985 VarIndex=CellVarIndex{imax}; % list of variable indices986 DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable987 if NbDim==3988 nbpoints=UvData.Field.DimValue(DimIndex(1));989 %Zvar=DimVarIndex(DimIndex(1));990 %Zvar=DimVarIndex(1);991 Zvar=VarType{imax}.coord_3;992 if Zvar~=0 % z is a dimension variable993 ZName=UvData.Field.ListVarName{Zvar};994 eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])995 eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])996 else997 testcoord_z=0;998 if length(UvData.Field.VarAttribute)>=VarIndex(1)999 if isfield(UvData.Field.VarAttribute{VarIndex(1)},'Coord_1')%regular grid1000 Coord_z=UvData.Field.VarAttribute{VarIndex(1)}.Coord_1;1001 UvData.ZMax=max(Coord_z);1002 UvData.ZMin=min(Coord_z);1003 testcoord_z=1;1004 end1005 end1006 if ~testcoord_z1007 UvData.ZMin=1;1008 UvData.ZMax=UvData.Field.DimValue(DimIndex(1));1009 end1010 end1011 UvData.Mesh=(UvData.ZMax-UvData.ZMin)/(nbpoints-1);1012 elseif NbDim==21013 nbpoints_y=UvData.Field.DimValue(DimIndex(1));1014 Yvar=VarType{imax}.coord_y;1015 if Yvar~=0 % x is a dimension variable1016 YName=UvData.Field.ListVarName{Yvar};1017 eval(['UvData.YMax=max(UvData.Field.' YName ');'])1018 eval(['UvData.YMin=min(UvData.Field.' YName ');'])1019 else1020 testcoord_y=0;1021 if ~testcoord_y1022 UvData.YMin=1;1023 UvData.YMax=UvData.Field.DimValue(DimIndex(1));1024 end1025 end1026 DY=(UvData.YMax-UvData.YMin)/(nbpoints_y-1);1027 nbpoints_x=UvData.Field.DimValue(DimIndex(2));1028 Xvar=VarType{imax}.coord_x;1029 if Xvar~=0 % x is a dimension variable1030 XName=UvData.Field.ListVarName{Xvar};1031 eval(['UvData.XMax=max(UvData.Field.' XName ');'])1032 eval(['UvData.XMin=min(UvData.Field.' XName ');'])1033 else1034 testcoord_x=0;1035 if ~testcoord_x1036 UvData.XMin=1;1037 UvData.XMax=UvData.Field.DimValue(DimIndex(2));1038 end1039 end1040 DX=(UvData.XMax-UvData.XMin)/(nbpoints_x-1);1041 UvData.Mesh= sqrt(DX*DY);1042 end1043 end1044 1045 %create a default projection menuplane1046 UvData.Object{1}.Style='plane';%main plotting plane1047 UvData.Object{1}.ProjMode='projection';%main plotting plane1048 if ~isfield(UvData.Object{1},'plotaxes')1049 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis1050 set(handles.list_object,'String',{'1-PLANE';'...'});1051 set(handles.list_object,'Value',1);1052 end1053 1054 %3D case (menuvolume)1055 if NbDim==31056 UvData.Object{1}.NbDim=UvData.NbDim;%test for 3D objects1057 UvData.Object{1}.RangeZ=UvData.Mesh;%main plotting plane1058 UvData.Object{1}.Coord(1,3)=(UvData.ZMin+UvData.ZMax)/2;%section at a middle plane chosen1059 UvData.Object{1}.Phi=0;1060 UvData.Object{1}.Theta=0;1061 UvData.Object{1}.Psi=0;1062 UvData.Object{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR1063 PlotHandles=get_plot_handles(handles);1064 ZBounds(1)=UvData.ZMin; %minimum for the Z slider1065 ZBounds(2)=UvData.ZMax;%maximum for the Z slider1066 set_object(UvData.Object{1},PlotHandles,ZBounds);1067 set(handles.list_object,'Value',1);1068 %multilevel case (single menuplane in a 3D space)1069 elseif isfield(UvData,'Z')1070 if isfield(UvData,'CoordType')& isequal(UvData.CoordType,'phys') & isfield(UvData,'XmlData')1071 XmlData=UvData.XmlData;1072 if isfield(XmlData,'PlanePos')1073 UvData.Object{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:);1074 end1075 if isfield(XmlData,'PlaneAngle')1076 siz=size(XmlData.PlaneAngle);1077 indangle=min(siz(1),UvData.ZIndex);%take first angle if a single angle is defined (translating scanning)1078 UvData.Object{1}.Phi=XmlData.PlaneAngle(indangle,1);1079 UvData.Object{1}.Theta=XmlData.PlaneAngle(indangle,2);1080 UvData.Object{1}.Psi=XmlData.PlaneAngle(indangle,3);1081 end1082 elseif isfield(UvData,'ZIndex')1083 UvData.Object{1}.ZObject=UvData.ZIndex;1084 end1085 end1086 1087 %Plot the projections on all existing projection objects1088 keeplim=get(handles.FixedLimits,'Value');1089 %reset the min and max of scalar if only the mask is displayed1090 if isfield(UvData,'Mask')&~isfield(UvData,'A')1091 set(handles.MinA,'String','0')1092 set(handles.MaxA,'String','255')1093 end1094 1095 Object=UvData.Object;1096 for iobj=1:length(Object)1097 if ~isempty(Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes)1098 %Projeter les champs sur l'objet:*1099 ObjectData=proj_field(UvData.Field,Object{iobj},iobj);1100 1101 %use of mask1102 if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2)1103 if isfield(ObjectData,'Mask') & isfield(ObjectData,'A')1104 flag_mask=double(ObjectData.Mask>200);%=0 for masked regions1105 AX=ObjectData.AX;1106 AY=ObjectData.AY;1107 MaskX=ObjectData.MaskX;1108 MaskY=ObjectData.MaskY;1109 if ~isequal(MaskX,AX)|~isequal(MaskY,AY)1110 nxy=size(flag_mask);1111 sizpx=(ObjectData.MaskX(end)-ObjectData.MaskX(1))/(nxy(2)-1);%size of a mask pixel1112 sizpy=(ObjectData.MaskY(1)-ObjectData.MaskY(end))/(nxy(1)-1);1113 x_mask=[ObjectData.MaskX(1):sizpx:ObjectData.MaskX(end)]; % pixel x coordinates for image display1114 y_mask=[ObjectData.MaskY(1):-sizpy:ObjectData.MaskY(end)];% pixel x coordinates for image display1115 %project on the positions of the scalar1116 npxy=size(ObjectData.A);1117 dxy(1)=(ObjectData.AY(end)-ObjectData.AY(1))/(npxy(1)-1);%grid mesh in y1118 dxy(2)=(ObjectData.AX(end)-ObjectData.AX(1))/(npxy(2)-1);%grid mesh in x1119 xi=[ObjectData.AX(1):dxy(2):ObjectData.AX(end)];1120 yi=[ObjectData.AY(1):dxy(1):ObjectData.AY(end)];1121 [XI,YI]=meshgrid(xi,yi);% creates the matrix of regular coordinates1122 flag_mask = interp2(x_mask,y_mask,flag_mask,XI,YI);1123 end1124 AClass=class(ObjectData.A);1125 ObjectData.A=flag_mask.*double(ObjectData.A);1126 ObjectData.A=feval(AClass,ObjectData.A);1127 ind_off=[];1128 if isfield(ObjectData,'ListVarName')1129 for ilist=1:length(ObjectData.ListVarName)1130 if isequal(ObjectData.ListVarName{ilist},'Mask')|isequal(ObjectData.ListVarName{ilist},'MaskX')|isequal(ObjectData.ListVarName{ilist},'MaskY')1131 ind_off=[ind_off ilist];1132 end1133 end1134 ObjectData.ListVarName(ind_off)=[];1135 ObjectData.VarDimIndex(ind_off)=[];1136 ind_off=[];1137 for ilist=1:length(ObjectData.ListDimName)1138 if isequal(ObjectData.ListDimName{ilist},'MaskX')|isequal(ObjectData.ListDimName{ilist},'MaskY')1139 ind_off=[ind_off ilist];1140 end1141 end1142 ObjectData.ListDimName(ind_off)=[];1143 ObjectData.DimValue(ind_off)=[];1144 end1145 end1146 end1147 if ~isempty(ObjectData)1148 haxes=[];%default1149 if isfield(Object{iobj},'plotaxes')1150 haxes=Object{iobj}.plotaxes;%axes used for representing the projection on the object1151 end1152 PosColorbar=[];%default: no colorbar1153 if ishandle(haxes) & isequal(get(haxes,'Tag'),'axes3')& isfield(UvData,'PosColorbar')1154 PosColorbar=UvData.PosColorbar;%prescribe the colorbar position on the view_field interface1155 else1156 PosColorbar='*';%default position1157 end1158 PlotParam=read_plot_param(handles);%read plotting parameters on the view_field interface1159 [PlotType,ScalOut,UvData.Object{iobj}.plotaxes]=plot_field(ObjectData,haxes,PlotParam,keeplim,PosColorbar);1160 if isequal(PlotType,'none')1161 hget_field=findobj(allchild(0),'name','get_field');1162 if isempty(hget_field)1163 get_field([],ObjectData)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field)1164 else1165 msgbox_view_field('ERROR','The field defined by get_field cannot be plotted')1166 end1167 end1168 UvData.Object{iobj}.PlotParam=ScalOut; %record the plotting parameters1169 end1170 1171 end1172 end1173 1174 %display the updated plotting parameters for the base menuplane1175 write_plot_param(handles,UvData.Object{1}.PlotParam);% update the display of the plotting parameters1176 set(handles.view_field,'UserData',UvData)1177 1178 %update the mask1179 if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on1180 update_mask(handles,num_i1,num_i2);1181 end1182 1183 %prepare the menus of histograms (for the whole menuvolume in 3D case)1184 menu_histo=(UvData.Field.ListVarName)';1185 ind_bad=[];1186 nb_histo=1;1187 for ivar=1:numel(menu_histo)1188 if isfield(UvData.Field,'VarAttribute') && numel(UvData.Field.VarAttribute)>=ivar && isfield(UvData.Field.VarAttribute{ivar},'Role')1189 Role=UvData.Field.VarAttribute{ivar}.Role;1190 switch Role1191 case {'coord_x','coord_y','coord_z','dimvar'}1192 ind_bad=[ind_bad ivar];1193 case {'vector_y'}1194 nb_histo=nb_histo+1;1195 end1196 end1197 DimCell=UvData.Field.VarDimName{ivar};1198 DimName='';1199 if ischar(DimCell)1200 DimName=DimCell;1201 elseif iscell(DimCell)&& numel(DimCell)==11202 DimName=DimCell{1};1203 end1204 if strcmp(DimName,menu_histo{ivar})1205 ind_bad=[ind_bad ivar];1206 end1207 end1208 menu_histo(ind_bad)=[];1209 test_v=0;1210 if ~isempty(menu_histo)1211 set(handles.histo1_menu,'Value',1)1212 set(handles.histo1_menu,'String',menu_histo)1213 histo1_menu_Callback(hObject, eventdata, handles)1214 if nb_histo > 11215 test_v=1;1216 set(handles.histo2_menu,'Visible','on')1217 set(handles.histo_v,'Visible','on')1218 set(handles.histo2_menu,'String',menu_histo)1219 set(handles.histo2_menu,'Value',2)1220 histo2_menu_Callback(hObject, eventdata, handles)1221 end1222 end1223 if ~test_v1224 set(handles.histo2_menu,'Visible','off')1225 set(handles.histo_v,'Visible','off')1226 cla(handles.histo_v)1227 set(handles.histo2_menu,'Value',1)1228 end1229 1230 %display time1231 testimedoc=0;1232 if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'Time')1233 if isempty(num_i2)1234 num_i2=num_i1;1235 end1236 if isempty(num_j1)1237 num_j1=1;1238 end1239 if isempty(num_j2)1240 num_j2=num_j1;1241 end1242 siz=size(UvData.XmlData.Time);1243 if siz(1)>=max(num_i1,num_i2) & siz(2)>=max(num_j1,num_j2)1244 abstime=(UvData.XmlData.Time(num_i1,num_j1)+UvData.XmlData.Time(num_i2,num_j2))/2;%overset the time read from files1245 dt=(UvData.XmlData.Time(num_i2,num_j2)-UvData.XmlData.Time(num_i1,num_j1));1246 testimedoc=1;1247 end1248 end1249 if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time')1250 [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);1251 num_i2=str2num(str2);1252 if isempty(num_i2)1253 num_i2=num_i1;1254 end1255 num_j1=str2num(str_a);1256 if isempty(num_j1)1257 num_j1=1;1258 end1259 num_j2=str2num(str_b);1260 if isempty(num_j2)1261 num_j2=num_j1;1262 end1263 num_i1=str2num(str1);1264 siz=size(UvData.XmlData_1.Time);1265 if siz(1)>=max(num_i1,num_i2) & siz(2)>=max(num_j1,num_j2)1266 abstime_1=(UvData.XmlData_1.Time(num_i1,num_j1)+UvData.XmlData_1.Time(num_i2,num_j2))/2;%overset the time read from files1267 end1268 end1269 set(handles.abs_time,'String',num2str(abstime,4))1270 set(handles.abs_time_1,'String',num2str(abstime_1,4))1271 if testimedoc && isfield(UvData,'dt')1272 dt=UvData.dt;1273 end1274 if isequal(dt,0)1275 set(handles.Dt_txt,'String','')1276 else1277 if ~(isfield(UvData,'TimeUnit') && ~isempty(UvData.TimeUnit))1278 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' 10^(-3)'] )1279 else1280 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' UvData.TimeUnit] )1281 end1282 end1283 set(handles.run0,'BackgroundColor',[1 0 0])1284 1285 252 1286 253 … … 1390 357 1391 358 %------------------------------------------------------------------- 1392 %determines the fields to read from the interface 359 %------------------------------------------------------------------- 360 % - FUNCTIONS FOR SETTING PLOTTING PARAMETERS 361 1393 362 %------------------------------------------------------------------ 1394 function [VelType,civ]=setfield(handles)1395 1396 VelType=[]; %default1397 if (get(handles.civ1,'Value') == 1);1398 VelType='civ1';1399 % interp11400 elseif (get(handles.interp1,'Value') == 1);1401 VelType='interp1';1402 % filter11403 elseif (get(handles.filter1,'Value') == 1);1404 VelType='filter1';1405 % CIV21406 elseif (get(handles.civ2,'Value') == 1);1407 VelType='civ2';1408 % interp21409 elseif (get(handles.interp2,'Value') == 1);1410 VelType='interp2';1411 % filter21412 elseif (get(handles.filter2,'Value') == 1);1413 VelType='filter2';1414 end1415 1416 if isequal(get(handles.filter2,'Visible'),'on');1417 civ=6;1418 % interp11419 elseif isequal(get(handles.interp2,'Visible'),'on');1420 civ=5;1421 % filter11422 elseif isequal(get(handles.civ2,'Visible'),'on');1423 civ=4;1424 % CIV21425 elseif isequal(get(handles.filter1,'Visible'),'on');1426 civ=3;1427 % interp21428 elseif isequal(get(handles.interp1,'Visible'),'on');1429 civ=2;1430 % filter21431 elseif isequal(get(handles.civ1,'Visible'),'on');1432 civ=1;1433 else1434 civ=0;1435 end1436 1437 %-------------------------------------------------------------------1438 %determines the veltype of the second field to read from the iinterface1439 %------------------------------------------------------------------1440 function VelType=setfield_1(handles)1441 1442 VelType=[]; %default1443 if (get(handles.civ1_1,'Value') == 1);1444 VelType='civ1';1445 % interp11446 elseif (get(handles.interp1_1,'Value') == 1);1447 VelType='interp1';1448 % filter11449 elseif (get(handles.filter1_1,'Value') == 1);1450 VelType='filter1';1451 % CIV21452 elseif (get(handles.civ2_1,'Value') == 1);1453 VelType='civ2';1454 % interp21455 elseif (get(handles.interp2_1,'Value') == 1);1456 VelType='interp2';1457 % filter21458 elseif (get(handles.filter2_1,'Value') == 1);1459 VelType='filter2';1460 end1461 1462 1463 %---------------------------------------------------1464 % --- Executes on button press in SubField1465 function SubField_Callback(hObject, eventdata, handles)1466 huvmat=get(handles.run0,'parent');1467 UvData=get(huvmat,'UserData');1468 if get(handles.SubField,'Value')==0% if the subfield button is desactivated1469 set(handles.RootPath_1,'String','')1470 set(handles.RootFile_1,'String','')1471 set(handles.SubDir_1,'String','');1472 set(handles.FileIndex_1,'String','');1473 set(handles.FileExt_1,'String','');1474 set(handles.RootPath_1,'Visible','off')1475 set(handles.RootFile_1,'Visible','off')1476 set(handles.SubDir_1,'Visible','off');1477 set(handles.FileIndex_1,'Visible','off');1478 set(handles.FileExt_1,'Visible','off');1479 set(handles.Fields_1,'Value',1);%set to blank state1480 set_veltype_display([handles.civ1_1 handles.interp1_1 handles.filter1_1 ...1481 handles.civ2_1 handles.interp2_1 handles.filter2_1],0)1482 if isfield(UvData,'XmlData_1')1483 UvData=rmfield(UvData,'XmlData_1');1484 end1485 set(huvmat,'UserData',UvData);1486 run0_Callback(hObject, eventdata, handles); %run1487 else1488 MenuBrowse_1_Callback(hObject, eventdata, handles)1489 end1490 1491 % %----------------------------------------------1492 % %read the data displayed for the input rootfile windows (new)1493 % %-------------------------------------------------1494 function [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles)1495 RootPath=get(handles.RootPath,'String');1496 FileName=RootPath; %default1497 SubDir=get(handles.SubDir,'String');1498 if ~isempty(SubDir) && ~isequal(SubDir,'')1499 if (isequal(SubDir(1),'/')|| isequal(SubDir(1),'\'))1500 SubDir(1)=[]; %suppress possible / or \ separator1501 end1502 FileName=fullfile(RootPath,SubDir);1503 end1504 RootFile=get(handles.RootFile,'String');1505 if ~isempty(RootFile) && ~isequal(RootFile,'')1506 if (isequal(RootFile(1),'/')|| isequal(RootFile(1),'\'))1507 RootFile(1)=[]; %suppress possible / or \ separator1508 end1509 FileName=fullfile(FileName,RootFile);1510 end1511 FileBase=fullfile(RootPath,RootFile);1512 FileIndices=get(handles.FileIndex,'String');1513 FileExt=get(handles.FileExt,'String');1514 FileName=[FileName FileIndices FileExt];1515 1516 %----------------------------------------------1517 %read the data displayed for the second input rootfile windows1518 %-------------------------------------------------1519 function [FileName_1,RootPath_1,FileBase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles)1520 RootPath_1=get(handles.RootPath_1,'String'); % read the data from the file1_input window1521 if isequal(RootPath_1,'"'),RootPath_1=get(handles.RootPath,'String'); end;1522 FileName_1=RootPath_1; %default1523 SubDir_1=get(handles.SubDir_1,'String');1524 if isequal(SubDir_1,'"')1525 SubDir_1=get(handles.SubDir,'String');1526 end1527 if ~isempty(SubDir_1) && ~isequal(SubDir_1,'')1528 if (isequal(SubDir_1(1),'/')|| isequal(SubDir_1(1),'\'))1529 SubDir_1(1)=[]; %suppress possible / or \ separator1530 end1531 FileName_1=fullfile(RootPath_1,SubDir_1);1532 end1533 RootFile_1=get(handles.RootFile_1,'String');1534 if isequal(RootFile_1,'"'),RootFile_1=get(handles.RootFile,'String'); end;1535 if ~isempty(RootFile_1) && ~isequal(RootFile_1,'')1536 if ~(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))1537 RootFile_1(1)=[];%suppress possible / or \ separator1538 end1539 FileName_1=fullfile(FileName_1,RootFile_1);1540 end1541 FileBase_1=fullfile(RootPath_1,RootFile_1);1542 FileIndices_1=get(handles.FileIndex_1,'String');1543 FileExt_1=get(handles.FileExt_1,'String');1544 if isequal(FileExt_1,'"'),FileExt_1=get(handles.FileExt,'String'); end;1545 FileName_1=[FileName_1 FileIndices_1 FileExt_1];1546 1547 %---------------------------------------------------1548 % --- Executes on menu selection Fields1549 function Fields_Callback(hObject, eventdata, handles)1550 %-------------------------------------------------1551 huvmat=get(handles.Fields,'parent');1552 list_fields=get(handles.Fields,'String');% list menu fields1553 index_fields=get(handles.Fields,'Value');% selected string index1554 field= list_fields{index_fields(1)}; % selected string1555 if isequal(field,'get_field...')1556 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];1557 set_veltype_display(veltype_handles,0) % unvisible civ buttons1558 filename=read_file_boxes(handles);1559 hget_field=findobj(allchild(0),'name','get_field');1560 if ~isempty(hget_field)1561 delete(hget_field)1562 end1563 get_field(filename)1564 return %no action1565 end1566 list_fields=get(handles.Fields_1,'String');% list menu fields1567 index_fields=get(handles.Fields_1,'Value');% selected string index1568 field_1= list_fields{index_fields(1)}; % selected string1569 UvData=get(huvmat,'UserData');1570 1571 %read the rootfile input display1572 FileExt=get(handles.FileExt,'String');1573 [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]);1574 NomTypeNew=NomType;%default1575 if isequal(field,'image')1576 % transform netc type to the corresponding image type1577 if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')|| isequal(NomType,'#_ab')|| isequal(NomType,'_i1-i2')1578 UvData.SubDir=get(handles.SubDir,'String'); %preserve the subdir in memory1579 if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')||isequal(UvData.SubDir(1),'/'))1580 UvData.SubDir(1)=[];1581 end1582 set(handles.SubDir,'String','')1583 set(handles.FileExt,'String','.png');1584 if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')1585 NomTypeNew='_i_j';1586 elseif isequal(NomType,'#_ab')1587 NomTypeNew='#a';1588 elseif isequal(NomType,'_i1-i2')1589 NomTypeNew='_i';1590 end1591 end1592 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];1593 set_veltype_display(veltype_handles,0) % unvisible civ buttons1594 else1595 ext=get(handles.FileExt,'String');1596 if ~isequal(ext,'.nc') %find the new NomType if the previous display was not already a netcdf file1597 MenuBrowse_Callback(hObject, eventdata, handles)1598 end1599 if isequal(field,'vort') || isequal(field,'div') || isequal(field,'strain')1600 set(handles.civ1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey1601 set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702])1602 set(handles.interp1,'BackgroundColor',[0.702 0.702 0.702])1603 set(handles.interp2,'BackgroundColor',[0.702 0.702 0.702])1604 elseif isequal(field,'more...');1605 set(handles.civ1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey1606 set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702])1607 str=calc_field;%get the list of available scalars by the function calc_scal1608 [ind_answer] = listdlg('PromptString','Select a file:',...1609 'SelectionMode','single',...1610 'ListString',str);1611 % edit the choice in the field and action menu1612 scalar=cell2mat(str(ind_answer));1613 menu=update_menu(handles.Fields,scalar);1614 menu=[{''};menu];1615 set(handles.Fields_1,'String',menu);% store the selected scalar type1616 end1617 end1618 indices=name_generator('',str2double(str1),str2double(str_a),'',NomTypeNew,1,str2double(str2),str2double(str_b),'');1619 set(handles.FileIndex,'String',indices)1620 set(handles.FileIndex,'UserData',NomTypeNew)1621 %common to Fields_1_Callback1622 if isequal(field,'image')||isequal(field_1,'image')1623 set(handles.npx_title,'Visible','on')% visible npx,pxcm... buttons1624 set(handles.npy_title,'Visible','on')1625 set(handles.npx,'Visible','on')1626 set(handles.npy,'Visible','on')1627 set(handles.fix_pair,'Value',0)1628 else1629 set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons1630 set(handles.npy_title,'Visible','off')1631 set(handles.npx,'Visible','off')1632 set(handles.npy,'Visible','off')1633 set(handles.fix_pair,'Value',1)1634 end1635 % if isequal(field,'velocity')|isequal(field_1,'velocity');1636 % state_vect='on';1637 % else1638 % state_vect='off';1639 % end1640 % if ~isequal(field,'velocity')|(~isequal(field_1,'velocity'));1641 % state_scal='on';1642 % else1643 % state_scal='off';1644 % end1645 setfield(handles);% update the field structure ('civ1'....)1646 1647 if ~isfield(UvData,'NewSeries')||isequal(UvData.NewSeries,0)1648 run0_Callback(hObject, eventdata, handles)1649 end1650 1651 %---------------------------------------------------1652 % --- Executes on menu selection Fields1653 function Fields_1_Callback(hObject, eventdata, handles)1654 %-------------------------------------------------1655 huvmat=get(handles.Fields_1,'parent');1656 list_fields=get(handles.Fields,'String');% list menu fields1657 index_fields=get(handles.Fields,'Value');% selected string index1658 field= list_fields{index_fields(1)}; % selected string1659 list_fields=get(handles.Fields_1,'String');% list menu fields1660 index_fields=get(handles.Fields_1,'Value');% selected string index1661 field_1= list_fields{index_fields(1)}; % selected string for the second field1662 if isequal(field_1,'') %remove second field if 'blank' field is selected1663 set(handles.SubField,'Value',0)1664 SubField_Callback(hObject, eventdata, handles)1665 return1666 end1667 UvData=get(huvmat,'UserData');1668 1669 %read the rootfile input display1670 FileExt_prev=get(handles.FileExt_1,'String');1671 if isempty(FileExt_prev)|isequal(FileExt_prev,'')1672 FileExt_1=get(handles.FileExt,'String');1673 else1674 FileExt_1=FileExt_prev;1675 end1676 NomType_1=get(handles.FileIndex_1,'UserData');1677 if isempty(NomType_1)|isequal(NomType_1,'')1678 NomType_1=get(handles.FileIndex,'UserData');1679 end1680 NomTypeNew=NomType_1;%default1681 1682 set(handles.SubField,'Value',1)%introduce second field1683 if isfield(UvData,'XmlData')1684 UvData.XmlData_1=UvData.XmlData;1685 end1686 set(handles.FileIndex_1,'Visible','on')1687 set(handles.FileExt_1,'Visible','on')1688 RootPath_1=get(handles.RootPath_1,'String');1689 RootFile_1=get(handles.RootFile_1,'String');1690 if isempty(RootPath_1)|isequal(RootPath_1,'')1691 set(handles.RootPath_1,'String','"')1692 end1693 if isempty(RootFile_1) | isequal(RootFile_1,'')1694 set(handles.RootFile_1,'String','"')1695 end1696 if ~isempty(RootFile_1)&(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))1697 RootFile_1(1)=[];1698 end1699 1700 if isequal(field_1,'get_field...')1701 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];1702 set_veltype_display(veltype_handles,0) % unvisible civ buttons1703 filename=read_file_boxes_1(handles);1704 hget_field=findobj(allchild(0),'name','get_field_1');1705 if ~isempty(hget_field)1706 delete(hget_field)1707 end1708 hget_field=get_field(filename);1709 set(hget_field,'name','get_field_1')1710 return %no action1711 end1712 if isequal(field_1,'image')1713 % transform netc type to the corresponding image type1714 set(handles.FileExt_1,'String','.png');1715 if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')| isequal(NomType_1,'#_ab')| isequal(NomType_1,'_i1-i2')1716 UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the subdir in memory1717 set(handles.SubDir_1,'String','')1718 % set(handles.FileExt_1,'String','.png');1719 if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')1720 NomTypeNew='_i_j';1721 elseif isequal(NomType_1,'#_ab')1722 NomTypeNew='#a';1723 elseif isequal(NomType_1,'_i1-i2')1724 NomTypeNew='_i';1725 end1726 end1727 veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];1728 set_veltype_display(veltype_handles,0) % unvisible civ buttons1729 else1730 set(handles.SubDir_1,'Visible','on')1731 if ~isequal(FileExt_prev,'.nc') %find the new NomType if the previous display was not already a netcdf file1732 veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];1733 set_veltype_display(veltype_handles,6); % make all civ buttons visible1734 RootPath_1=get(handles.RootPath_1,'String');1735 RootFile_1=get(handles.RootFile_1,'String');1736 if isempty(RootPath_1)|isequal(RootPath_1,'')1737 set(handles.RootPath_1,'String','"')1738 end1739 if isempty(RootFile_1) | isequal(RootFile_1,'')1740 set(handles.RootFile_1,'String','"')1741 end1742 if ~isempty(RootFile_1)&(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))1743 RootFile_1(1)=[];1744 end1745 filebase_1=fullfile(RootPath_1,RootFile_1);1746 SubDir_1=get(handles.SubDir,'String');1747 if isempty(SubDir_1)|isequal(SubDir_1,'')1748 if isfield(UvData,'SubDir_1')1749 SubDir_1=UvData.SubDir_1;%retrieve previous subdir1750 else1751 SubDir_1='?';1752 end1753 end1754 if isequal(NomType_1,'#_ab')|isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')|isequal(NomType_1,'_i1-i2')1755 NomTypeNew=NomType_1;1756 elseif isequal(NomType_1,'#a')1757 [filename,idetect,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1, str2num(str1),str2num(str_a),'.nc','#_ab',0,[],[],SubDir_1);1758 NomTypeNew='#_ab';1759 elseif isequal(NomType_1,'_i_j')1760 [filename,idetect,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),str2num(str_a),'.nc','_i1-i2_j',0,str2num(str1),[],SubDir_1);1761 if idetect==11762 NomTypeNew='_i1-i2_j';1763 else1764 NomTypeNew='_i_j1-j2';1765 end1766 else %for instance avi files or any ima_num series1767 [filename,idetect,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),str2num(str_a),'.nc','_i1-i2',0,str2num(str1),[],SubDir_1);1768 NomTypeNew='_i1-i2';1769 end1770 [Path,Name]=fileparts(filebase_1);1771 set(handles.FileExt_1,'String','.nc');1772 if ~isempty(SubDir_1) & ~isequal(SubDir_1,'''')& ~isequal(SubDir_1,'"')1773 SubDir_1=['/' SubDir_1];1774 end1775 set(handles.SubDir_1,'String',SubDir_1);1776 end1777 if isequal(field,'vort') | isequal(field,'div') | isequal(field,'strain')1778 set(handles.civ1_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey1779 set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702])1780 set(handles.interp1_1,'BackgroundColor',[0.702 0.702 0.702])1781 set(handles.interp2_1,'BackgroundColor',[0.702 0.702 0.702])1782 elseif isequal(field_1,'more...'); %add new item to the menu1783 set(handles.civ1_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey1784 set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702])1785 str=calc_field;%get the list of available scalars by the function calc_scal1786 [ind_answer,v] = listdlg('PromptString','Select a file:',...1787 'SelectionMode','single',...1788 'ListString',str);1789 % edit the choice in the field and action menu1790 scalar=cell2mat(str(ind_answer));1791 menu=update_menu(handles.Fields_1,scalar);1792 set(handles.Fields_1,'String',menu);% store the selected scalar type1793 end1794 end1795 str1=get(handles.i1,'String');1796 str2=get(handles.i2,'String');1797 str_a=get(handles.j1,'String');1798 str_b=get(handles.j2,'String');1799 indices=name_generator('',str2num(str1),stra2num(str_a),'',NomTypeNew,1,str2num(str2),stra2num(str_b),'');1800 set(handles.FileIndex_1,'String',indices)1801 set(handles.FileIndex_1,'UserData',NomTypeNew)1802 1803 %common to Fields_Callback1804 if isequal(field,'image')|isequal(field_1,'image')1805 set(handles.npx_title,'Visible','on')% visible npx,pxcm... buttons1806 set(handles.npy_title,'Visible','on')1807 set(handles.npx,'Visible','on')1808 set(handles.npy,'Visible','on')1809 set(handles.fix_pair,'Value',0)1810 else1811 set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons1812 set(handles.npy_title,'Visible','off')1813 set(handles.npx,'Visible','off')1814 set(handles.npy,'Visible','off')1815 set(handles.fix_pair,'Value',1)1816 end1817 if isequal(field,'velocity')|isequal(field_1,'velocity');1818 state_vect='on';1819 else1820 state_vect='off';1821 end1822 if ~isequal(field,'velocity')|(~isequal(field_1,'velocity')&~isequal(field_1,''));1823 state_scal='on';1824 else1825 state_scal='off';1826 end1827 set(huvmat,'UserData',UvData)1828 setfield(handles);% update the field structure ('civ1'....)1829 if ~isfield(UvData,'NewSeries')|isequal(UvData.NewSeries,0)1830 run0_Callback(hObject, eventdata, handles)1831 end1832 1833 %------------------------------------------------------------------------1834 % --- set the visibility of relevant velocity type menus:1835 function set_veltype_display(handles,Civ)1836 %------------------------------------------------------------------------1837 %Civ=0; all states 'off'1838 %Civ=6; all states 'on'1839 if isequal(Civ,0)1840 imax=0;1841 % set(handles(1),'Visible','on') % unvisible civ buttons1842 % else1843 % set(handles(1),'String','civ1')1844 % end1845 elseif isequal(Civ,1) || isequal(Civ,2)1846 imax=1;1847 elseif isequal(Civ,3)1848 imax=3;1849 elseif isequal(Civ,4) || isequal(Civ,5)1850 imax=4;1851 elseif isequal(Civ,6) %patch21852 imax=6;1853 end1854 for ibutton=1:imax;1855 set(handles(ibutton),'Visible','on') % unvisible civ buttons1856 end1857 % for ibutton=max(imax+1,2):6;1858 for ibutton=imax+1:6;1859 set(handles(ibutton),'Visible','off') % unvisible civ buttons1860 set(handles(ibutton),'Value',0)%unactivate unvisible buttons1861 end1862 1863 %-------------------------------------------------------------------1864 % --- Executes on button press in civ1.1865 function civ1_Callback(hObject, eventdata, handles)1866 %-------------------------------------------------------------------1867 if get(handles.civ1,'Value')==11868 reset_vel_type([handles.interp1 handles.civ2 handles.filter1 handles.interp1 handles.interp2 handles.filter2],handles.civ1)1869 else1870 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])1871 end1872 run0_Callback(hObject, eventdata, handles)1873 1874 %-------------------------------------------------------------------1875 % --- Executes on button press in interp1.1876 function interp1_Callback(hObject, eventdata, handles)1877 %-------------------------------------------------------------------1878 if get(handles.interp1,'Value')==11879 reset_vel_type([handles.civ1 handles.civ2 handles.filter1 handles.interp2 handles.filter2],handles.interp1)1880 else1881 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])1882 end1883 run0_Callback(hObject, eventdata, handles)1884 1885 %-------------------------------------------------------------------1886 % --- Executes on button press in filter1.1887 function filter1_Callback(hObject, eventdata, handles)1888 %-------------------------------------------------------------------1889 if get(handles.filter1,'Value')==11890 reset_vel_type([handles.civ1 handles.civ2 handles.interp1 handles.interp2 handles.filter2],handles.filter1)1891 else1892 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])1893 end1894 run0_Callback(hObject, eventdata, handles)1895 1896 %-------------------------------------------------------------------1897 % --- Executes on button press in civ2.1898 function civ2_Callback(hObject, eventdata, handles)1899 %-------------------------------------------------------------------1900 if get(handles.civ2,'Value')==11901 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.interp2 handles.filter2],handles.civ2)1902 else1903 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])1904 end1905 run0_Callback(hObject, eventdata, handles)1906 1907 %-----------------------------------------1908 % --- Executes on button press in interp2.1909 %-------------------------------------------1910 function interp2_Callback(hObject, eventdata, handles)1911 if get(handles.interp2,'Value')==11912 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.filter2],handles.interp2)1913 else1914 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])1915 end1916 run0_Callback(hObject, eventdata, handles)1917 %---------------------------------------------1918 % --- Executes on button press in filter2.1919 %-------------------------------------------1920 function filter2_Callback(hObject, eventdata, handles)1921 if get(handles.filter2,'Value')==11922 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2],handles.filter2)1923 else1924 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])1925 end1926 run0_Callback(hObject, eventdata, handles)1927 1928 %---------------------------------------------1929 function civ1_1_Callback(hObject, eventdata, handles)1930 %---------------------------------------------1931 if get(handles.civ1_1,'Value')==11932 reset_vel_type([handles.interp1_1 handles.civ2_1 handles.filter1_1 handles.interp1_1 handles.interp2_1 handles.filter2_1],handles.civ1_1)1933 else1934 reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])1935 end1936 run0_Callback(hObject, eventdata, handles)1937 1938 %--------------------------------------------1939 function interp1_1_Callback(hObject, eventdata, handles)1940 %--------------------------------------------1941 if get(handles.interp1_1,'Value')==11942 reset_vel_type([handles.civ1_1 handles.civ2_1 handles.filter1_1 handles.interp2_1 handles.filter2_1],handles.interp1_1)1943 else1944 reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])1945 end1946 run0_Callback(hObject, eventdata, handles)1947 1948 %--------------------------------------------1949 function filter1_1_Callback(hObject, eventdata, handles)1950 %--------------------------------------------1951 if get(handles.filter1_1,'Value')==11952 reset_vel_type([handles.interp1_1 handles.civ2_1 handles.interp1_1 handles.interp2_1 handles.filter2_1],handles.filter1_1)1953 else1954 reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])1955 end1956 run0_Callback(hObject, eventdata, handles)1957 1958 %--------------------------------------------1959 function civ2_1_Callback(hObject, eventdata, handles)1960 %--------------------------------------------1961 if get(handles.civ2_1,'Value')==11962 reset_vel_type([handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.interp2_1 handles.filter2_1],handles.civ2_1)1963 else1964 reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])1965 end1966 run0_Callback(hObject, eventdata, handles)1967 1968 %--------------------------------------------1969 function interp2_1_Callback(hObject, eventdata, handles)1970 %--------------------------------------------1971 if get(handles.interp2_1,'Value')==11972 reset_vel_type([handles.civ1_1 handles.civ2_1 handles.filter1_1 handles.interp1_1 handles.filter2_1],handles.interp2_1)1973 else1974 reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])1975 end1976 run0_Callback(hObject, eventdata, handles)1977 1978 %--------------------------------------------1979 function filter2_1_Callback(hObject, eventdata, handles)1980 %--------------------------------------------1981 if get(handles.filter2_1,'Value')==11982 reset_vel_type([handles.civ1_1 handles.interp1_1 handles.civ2_1 handles.filter1_1 handles.interp1_1 handles.interp2_1],handles.filter2_1)1983 else1984 reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])1985 end1986 run0_Callback(hObject, eventdata, handles)1987 1988 %-----------------------------------------------1989 % --- reset civ buttons1990 function reset_vel_type(handles_civ0,handle1)1991 for ibutton=1:length(handles_civ0)1992 set(handles_civ0(ibutton),'BackgroundColor',[0.831 0.816 0.784])1993 set(handles_civ0(ibutton),'Value',0)1994 end1995 if exist('handle1','var')%handles of selected button1996 set(handle1,'BackgroundColor',[1 1 0])1997 end1998 1999 2000 %-------------------------------------------------------------------2001 %-------------------------------------------------------------------2002 % - FUNCTIONS FOR SETTING PLOTTING PARAMETERS2003 2004 %------------------------------------------------------------------2005 2006 363 2007 364
Note: See TracChangeset
for help on using the changeset viewer.