Changeset 57 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 18, 2010, 11:32:05 AM (11 years ago)
Author:
sommeria
Message:

small bug repaired in civ (spurious call to first_i)
image pair movie improved in uvmat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r56 r57  
    15861586set(handles.RunMovie,'BusyAction','queue')
    15871587testavi=0;
    1588 huvmat=get(handles.RunMovie,'parent');
    1589 UvData=get(huvmat,'UserData');
     1588UvData=get(handles.uvmat,'UserData');
    15901589
    15911590while get(handles.speed,'Value')~=0 & isequal(get(handles.RunMovie,'BusyAction'),'queue') % enable STOP command
     
    15951594if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj),
    15961595    UvData.aviobj=close(UvData.aviobj);
    1597    set(huvmat,'UserData',UvData);
     1596   set(handles.uvmat,'UserData',UvData);
    15981597end
    15991598set(handles.RunMovie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
     
    16021601function STOP_Callback(hObject, eventdata, handles)
    16031602%-------------------------------------------------------------------
    1604 set(handles.run0,'BusyAction','Cancel')
     1603set(handles.movie_pair,'BusyAction','Cancel')
     1604set(handles.movie_pair,'value',0)
    16051605set(handles.RunMovie,'BusyAction','Cancel')
    16061606set(handles.MenuExportMovie,'BusyAction','Cancel')
     
    16101610function runpm(hObject,eventdata,handles,increment)
    16111611%------------------------------------------------------------------
     1612%check for mùovie pair status
     1613movie_status=get(handles.movie_pair,'Value');
     1614if isequal(movie_status,1)
     1615    STOP_Callback(hObject, eventdata, handles)
     1616end
    16121617%read the data on the current input rootfile(s)
    16131618
     
    16761681end
    16771682
     1683if isequal(movie_status,1)
     1684    set(handles.movie_pair,'Value',1)
     1685    movie_pair_Callback(hObject, eventdata, handles); %run
     1686else
    16781687% refresh plots
    1679 run0_Callback(hObject, eventdata, handles); %run
     1688    run0_Callback(hObject, eventdata, handles); %run
     1689end
    16801690
    16811691
    16821692%-------------------------------------------------------
    1683 % --- Executes on button press in movie_pair.
     1693% --- Executes on button press in movie_pair: create an alternating movie with two view
    16841694%-------------------------------------------------------
    16851695function movie_pair_Callback(hObject, eventdata, handles)
     1696status=get(handles.movie_pair,'value');
     1697if isequal(status,0)
     1698    set(handles.movie_pair,'BusyAction','Cancel')
     1699    return
     1700else
     1701    set(handles.movie_pair,'BusyAction','queue')
     1702end
    16861703%initialisation
    16871704set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow
     
    16901707index_fields=get(handles.Fields,'Value');% selected string index
    16911708FieldName=list_fields{index_fields}; % selected field
    1692 %huvmat=get(handles.movie_pair,'parent');
    16931709if isequal(FieldName,'image')
    16941710    run0_Callback(hObject, eventdata, handles)%display the first image
     
    17001716[ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes(handles);
    17011717NomType=get(handles.FileIndex,'UserData');
    1702 num_i2=str2num(get(handles.i2,'String'));
    1703 num_j2=str2num(get(handles.j2,'String'));
    1704 if ~isempty(num_j2)
    1705     num_i1=str2num(get(handles.i1,'String'));
    1706     [imaname_1,idetect]=name_generator(filebase,num_i1,num_j2,Ext,NomType);
    1707     if idetect==0
    1708         msgbox_uvmat('ERROR',['second input open (-)  ' imaname_1 ' not found']);
     1718num_i1=stra2num(get(handles.i1,'String'));
     1719num_j1=stra2num(get(handles.j1,'String'));
     1720num_i2=stra2num(get(handles.i2,'String'));
     1721num_j2=stra2num(get(handles.j2,'String'));
     1722if isempty(num_j2)
     1723    if isempty(num_i2)   
     1724        msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')
    17091725        return
    1710     end
    1711     set(handles.i2,'String',''); % indicates that the second index i2 is not used
    1712 elseif ~isempty(num_i2)
    1713     num_j1=str2num(get(handles.j1,'String'));
    1714     [imaname_1,idetect]=name_generator(filebase,num_i2,num_j1,Ext,NomType);
    1715     if idetect==0
    1716         msgbox_uvmat('ERROR',['second input open (-)  ' imaname_1 ' not found']);
    1717         return
    1718     end
    1719 else   
    1720     msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')
    1721     return
    1722 end
     1726    else
     1727        num_j2=num_j1;%repeat the index i1 by default
     1728    end
     1729end
     1730if isempty(num_i2)
     1731    num_i2=num_i1;%repeat the index i1 by default
     1732end
     1733imaname_1=name_generator(filebase,num_i2,num_j2,Ext,NomType);
     1734if ~exist(imaname_1,'file')
     1735      msgbox_uvmat('ERROR',['second input open (-)  ' imaname_1 ' not found']);
     1736      return
     1737end
     1738% set(handles.i2,'String',''); % indicates that the second index i2 is not used
     1739% set(handles.j2,'String',''); % indicates that the second index i2 is not used
    17231740
    17241741%read the second image
     
    17261743Field.AX=UvData.Field.AX;
    17271744Field.AY=UvData.Field.AY;
     1745% z index
     1746nbslice=str2double(get(handles.nb_slice,'String'));
     1747if ~isempty(nbslice)
     1748    Field.ZIndex=mod(num_i2-1,nbslice)+1;
     1749end
    17281750Field.CoordType='px';
    17291751%determine the input file type
     
    17751797set(handles.speed,'Visible','on')
    17761798set(handles.speed_txt,'Visible','on')
    1777 while get(handles.speed,'Value')~=0 && isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command
     1799while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue')%isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command
    17781800    % read and plot the series of images in non erase mode
    17791801    set(hima,'CData',Field.A);
     
    17951817abstime_1=[];
    17961818dt=[];
    1797 % CalibCell={};%default
    17981819Field={};
    1799 %huvmat=get(handles.run0,'parent');
    18001820UvData=get(handles.uvmat,'UserData');
    18011821if isfield(UvData,'Txt')
    18021822    UvData=rmfield(UvData,'Txt');%erase previous error message
    18031823end
    1804 set(handles.run0,'BusyAction','queue');
     1824%set(handles.run0,'BusyAction','queue');
    18051825if ishandle(handles.UVMAT_title) %remove title panel on uvmat
    18061826    delete(handles.UVMAT_title)
     
    18261846    NomType=get(handles.FileIndex,'UserData');
    18271847    %update the z position index
    1828 %     if isequal(get(handles.nb_slice,'String'),'vol.')%case of volume
    1829 %         set(handles.z_index,'String',get(handles.j1,'String'));
    1830 %     else
    18311848    nbslice=str2double(get(handles.nb_slice,'String'));
    1832 %     z_index=mod(num_i1-1,nbslice)+1;
    1833     if ~isempty(nbslice)
     1849    if ~isnan(nbslice)
    18341850        z_index=mod(num_i1-1,nbslice)+1;
    18351851        set(handles.z_index,'String',num2str(z_index))
     
    18851901FieldName_1=[];
    18861902scal_color=[];
    1887 % testvel=0;
    1888 % testX=0;%default
    18891903VelType_1=setfield_1(handles);
    18901904sub_value=get(handles.SubField,'Value');
     
    19511965
    19521966%read the input field(s)
    1953 % testima_1=isequal(FieldName_1,'image');
    19541967
    19551968%read images
     
    20072020    Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
    20082021    Rangy=[npxy(1)-0.5 0.5]; %
    2009 %     npx=str2num(get(handles.npx,'String'));
    2010 %     npy=str2num(get(handles.npy,'String'));
    2011 %     if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time')
    2012 %         abs_time=UvData.XmlData_1.Time;
    2013 %     end
    20142022    Field{2}.AName='image';
    20152023    Field{2}.ListVarName={'AY','AX','A'}; %
     
    20442052    if isequal(FileType,'netcdf')  %read the first nc field
    20452053        if isequal(FieldName,'get_field...')% read the field names on the interface get_field.
    2046 %             test_detect=0;%default
    20472054            VelType=get(handles.Fields,'UserData');
    20482055            hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI
     
    20502057                hget_field= get_field(filename);%open the get_field GUI   
    20512058            end
    2052 %             test_detect=1;
    20532059            hhget_field=guidata(hget_field);
    20542060            set(hhget_field.inputfile,'String',filename)% update the list of input fields in get_field
     
    20742080    if ~isempty(filename_1) && isequal(FileType_1,'netcdf') %read the second file
    20752081        if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field.
    2076 %             test_detect=0;%default
    20772082            hget_field=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI
    20782083             if isempty(hget_field)
     
    20812086%                 enable_transform(handles,'off')% no field transform (possible transform in the GUI get_field)
    20822087             end
    2083 %             test_detect=1;
    20842088            hhget_field=guidata(hget_field);%handles of GUI elements in get_field
    20852089            SubField=get_field('read_var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI
    20862090            [Field{2},var_detect]=nc2struct(filename_1,SubField.ListVarName); %read the corresponding input data               
    20872091            Field{2}.VarAttribute=SubField.VarAttribute;
    2088 %             if isequal(get(hhget_field.transform_fct,'Visible'),'on')
    2089 %                 list_transform=get(hhget_field.transform_fct,'String');
    2090 %                 val_list=get(hhget_field.transform_fct,'Value');
    2091 %                 transf=list_transform{val_list};
    2092 %                 if ~isempty(transf)
    2093 %                     Field{2}=feval(transf,Field{2});
    2094 %                 end
    2095 %             end
    20962092            %update the display on get_field
    20972093            set(hhget_field.inputfile,'String',filename_1)
     
    31883184end
    31893185
    3190 
    3191 %-----------------------------------
    3192 %set the visibility of relevant velocity type menus:
    3193 %-----------------------------------
     3186%------------------------------------------------------------------------
     3187% --- set the visibility of relevant velocity type menus:
     3188function set_veltype_display(handles,Civ)
     3189%------------------------------------------------------------------------
    31943190%Civ=0; all states 'off'
    31953191%Civ=6; all states 'on'
    3196 function set_veltype_display(handles,Civ)
    31973192if isequal(Civ,0)
    31983193    imax=0;
     
    32013196%    set(handles(1),'String','civ1')
    32023197% end
    3203 elseif isequal(Civ,1)
     3198elseif isequal(Civ,1) || isequal(Civ,2)
    32043199   imax=1;
    3205 elseif isequal(Civ,2) | isequal(Civ,3)
     3200elseif isequal(Civ,3)
    32063201    imax=3;
    3207 elseif isequal(Civ,4) | isequal(Civ,5)
     3202elseif isequal(Civ,4) || isequal(Civ,5)
    32083203    imax=4;
    3209 elseif isequal(Civ,6)
     3204elseif isequal(Civ,6) %patch2
    32103205    imax=6;
    32113206end
Note: See TracChangeset for help on using the changeset viewer.