Changeset 81 for trunk/src


Ignore:
Timestamp:
Apr 13, 2010, 10:37:08 AM (15 years ago)
Author:
sommeria
Message:

several bug repairs:
option movie backward introduced for uvmat

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r73 r81  
    631631   
    632632% no image documentation file found: look for a series of existing images or .nc files
    633 if isempty(time) && ~isequal(ext,'.nc')
     633if isempty(time) && ~isequal(ext,'.nc') && ~strcmp(nom_type_ima,'none') && ~strcmp(nom_type_ima,'') && ~strcmp(nom_type_ima,'*')
    634634    subdir=get(handles.subdir_civ1,'String');
    635635    incr_pair=[0 0];%default
     
    637637            incr_pair=browse.incr_pair;
    638638    end
    639     nbdetect=0;%test of detected images
     639%     nbdetect=0;%test of detected images
    640640    field_i=field_count;
    641641    idetect=1;
    642     while idetect==1 %look for the maximum file number in the series
     642    while idetect==1 %look for the maximum file number in the series     
     643        imagename=name_generator(filebase,field_i+1,1,ext_ima,nom_type_ima);
     644        idetect=(exist(imagename,'file')==2);
     645        if idetect
    643646            field_i=field_i+1;
    644             imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima);
    645             if strcmp(nom_type_ima,'none')||strcmp(nom_type_ima,'')
    646                idetect=0; %stop if the same image is repeated (if nom_type='none')
    647                nbdetect=1;
    648             else
    649                 idetect=(exist(imagename,'file')==2);
    650             end
     647        end
    651648            %SEE CASE OF NETCDF FILES
    652             nbdetect=nbdetect+(exist(imagename,'file')==2);
     649%             nbdetect=nbdetect+(exist(imagename,'file')==2);
    653650    end
    654651    nb_field=field_i;% last detected field number
     
    656653    idetect=1;
    657654    while idetect==1
    658                 field_i=field_i-1;
    659                 imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima);
    660                 if isequal(nom_type_ima,'none')||strcmp(nom_type_ima,'')
    661                     idetect=0; %stop if the same image is repeated (if nom_type='none')
    662                     nbdetect=1;
    663                 else
    664                     idetect=(exist(imagename,'file')==2);
    665                 end
    666                 nbdetect=nbdetect+idetect;
    667     end
    668     first_i=max(field_i+1,1);
     655        imagename=name_generator(filebase,field_i-1,1,ext_ima,nom_type_ima);
     656        idetect=(exist(imagename,'file')==2);
     657        if idetect
     658           field_i=field_i-1;
     659        end
     660    end
     661    first_i=max(field_i,1);
    669662        %determine the set of times and possible intervals for CIV
    670663 %   dt=(1/1000)*str2num(get(handles.dt,'String'));
     
    672665    set(handles.mode,'String',{'series(Di)'})
    673666end
    674 if isequal(nom_type_ima,'none')% no file numbering used
    675   first_i=1;
    676   last_i=1;
    677    first_j=1;
    678   last_j=1;
    679 end
     667% if isequal(nom_type_ima,'none')% no file numbering used
     668%   first_i=1;
     669%   last_i=1;
     670%    first_j=1;
     671%   last_j=1;
     672% end
    680673if exist('time','var')
    681674    if size(time,1)+size(time,2)>=3 % if there are at least two time values to define dt
  • trunk/src/imadoc2struct.m

    r71 r81  
    2121s.TimeUnit=[]; %default
    2222s.GeometryCalib=[];
    23 % nom_type_ima=[];%default
    24 % ext_ima=[];%default
    25 % abs_time=[];%initiation
    26 % GeometryCalib.CoordUnit='cm';%default
    27 % mode=[]; %default
    28 % NbSlice=1;%default
    29 % npx=[];%default
    30 % npy=[];%default
    31 % GeometryCalib.Pxcmx=1;
    32 % GeometryCalib.Pxcmy=1;
    33 % GeometryCalib=[];
    34 % NbDtj=1;
    3523tsai=[];%default
    36 % if ~exist('testime','var')
    37 %     testime=1;%default
    3824
    3925if exist(ImaDoc,'file')~=2, errormsg=[ ImaDoc ' does not exist']; return;end;%input file does not exist
     
    121107        end
    122108    end
    123     if size(s.Time,1)==1
    124         s.Time=(s.Time)'; %change vector into column
    125     end
     109%     if size(s.Time,1)==1
     110%         s.Time=(s.Time)'; %change vector into column
     111%     end
    126112end
    127113
  • trunk/src/mouse_up.m

    r78 r81  
    262262
    263263% editing calibration point
    264 if ~zoomstate strcmp(MouseAction,'calib')
     264if ~zoomstate && strcmp(MouseAction,'calib')
    265265    h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
    266266    hh_geometry_calib=guidata(h_geometry_calib);
  • trunk/src/read_get_field.m

    r80 r81  
    201201            SubVarAttribute{nbvar}.Role='coord_y';%abcissa with unstructured coordinates
    202202        end
    203         if isequal(dimname_y,dimname_x)
    204             errormsg='identical x and y coordinates selected in get_field';
    205             return
    206         end
     203%         if isequal(dimname_y,dimname_x)
     204%             errormsg='identical x and y coordinates selected in get_field';
     205%             return
     206%         end
    207207    end
    208208
     
    465465    end
    466466    ind_single=find(npxy==1);
    467     SingleCellA=[SingleCellA DimCellA(ind_single)];
     467    if ~isempty(ind_single)
     468    %SingleCellA=[SingleCellA DimCellA(ind_single)];TO CHECK
     469    end
    468470    ind_select=find(npxy~=1);%look for non singleton dimensions
    469471    DimCellA=DimCellA(ind_select);
     
    515517    dimextra(dimA)=[]; %list of unselected dimension indices
    516518    DimCellA=DimCellA([dimA dimextra]);
    517     eval(['SubField.' VarNameA '=permute(squeeze(SubField.' VarNameA '),[dimA dimextra]);'])
     519   % eval(['SubField.' VarNameA '=permute(squeeze(SubField.' VarNameA '),[dimA dimextra]);'])TO CHECK
    518520    SubField.VarDimName{VarSubIndexA}=DimCellA; 
    519521    %add default coord_x and/or coord_y if empty
  • trunk/src/set_object.m

    r79 r81  
    7676% Choose default command line output for set_object
    7777handles.output = hObject;
    78 
     78'TESTsetobj'
     79data
    7980% Update handles structure
    8081guidata(hObject, handles);
     
    138139            CoordCell=data.Coord;
    139140            data.Coord=zeros(numel(CoordCell),3);
     141            data.Coord(:,3)=zeros(numel(CoordCell),1); % z component set to 0 by default
    140142            for iline=1:numel(CoordCell)
    141                 data.Coord(iline,:)=str2num(CoordCell{iline});
     143                line_vec=str2num(CoordCell{iline});
     144                if numel(line_vec)==2
     145                    data.Coord(iline,1:2)=str2num(CoordCell{iline});
     146                else
     147                    data.Coord(iline,:)=str2num(CoordCell{iline});
     148                end
    142149            end
    143150        end
  • trunk/src/uvmat.m

    r77 r81  
    628628update_rootinfo(hObject,eventdata,handles)
    629629
    630 
    631 
    632 
    633 
     630%-------------------------------------------------------------------
     631%-- called by action in FileIndex edit box
     632%-------------------------------------------------------------------
     633function FileIndex_Callback(hObject, eventdata, handles)
     634FileIndices=get(handles.FileIndex,'String');
     635if isempty(str2num(FileIndices))
     636    [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices);
     637else
     638    str1=FileIndices;
     639    str2='';
     640    str_a='';
     641    str_b='';
     642end
     643set(handles.i1,'String',str1);
     644set(handles.i2,'String',str2);
     645set(handles.j1,'String',str_a);
     646set(handles.j2,'String',str_b);
     647run0_Callback(hObject, eventdata, handles)
     648
     649%-------------------------------------------------------------------
     650%-- called by action in FileIndex_1 edit box
     651%-------------------------------------------------------------------
     652function FileIndex_1_Callback(hObject, eventdata, handles)
     653% FileIndices=get(handles.FileIndex_1,'String');
     654% if isempty(str2num(FileIndices))
     655%     [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices)
     656% else
     657%     str1=FileIndices;
     658%     str2='';
     659%     str_a='';
     660%     str_b='';
     661% end
     662% set(handles.i1,'String',str1);
     663% set(handles.i2,'String',str2);
     664% set(handles.j1,'String',str_a);
     665% set(handles.j2,'String',str_b);
     666run0_Callback(hObject, eventdata, handles)
    634667
    635668%-------------------------------------------------------------------
     
    644677UvData.NewSeries=1; %flag for run0: begin a new series
    645678UvData.TestInputFile=1;
    646 set(handles.fix_pair,'Value',0) % desactivate by default the comp_input '-'input window
     679set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window
    647680%FileIndex_Callback(hObject, eventdata, handles)% update field counters
    648681
     
    860893function set_scan_options(hObject, eventdata, handles)
    861894
    862 %  set the corresponding index navigation options (TO CHECK WITH THE SECOND FIELD)
    863 NomType=get(handles.FileIndex,'UserData');
     895%  set the corresponding index navigation options
     896NomType=get(handles.FileIndex,'UserData');       
    864897NomType_1=get(handles.FileIndex_1,'UserData');
     898last_i_str=get(handles.last_i,'String');
     899nbfield=str2num(last_i_str{1});
     900if numel(last_i_str)==2
     901    nbfield=min(nbfield,str2num(last_i_str{2}));
     902end 
    865903state_j='off'; %default
    866 scan_option='i';
     904scan_option='i';%default
    867905switch NomType
    868906    case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab'},% two navigation indices
    869907        state_j='on';
    870         if exist('nbfield','var') && isequal(nbfield,1)
    871             scan_option='j';
    872         else
    873             scan_option='i';               
     908        if isequal(nbfield,1)
     909            scan_option='j';                 
    874910        end
    875911end
     
    878914        case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab'},% two navigation indices
    879915            state_j='on';
    880             if exist('nbfield','var') && isequal(nbfield,1)
    881                 scan_option='j';
    882             else
    883                 scan_option='i';               
    884             end
     916            if isequal(nbfield,1)
     917                scan_option='j';                 
     918            end           
    885919    end
    886920end
     
    10731107    end
    10741108end
    1075 set(handles.FileIndex,'UserData',NomType_1);
     1109set(handles.FileIndex_1,'UserData',NomType_1);
    10761110
    10771111% make visible and fill the second raw of edit boxes
     
    12901324    set(handles.scan_i,'BackgroundColor',[1 1 0])
    12911325    set(handles.scan_j,'Value',0)
    1292     set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])
     1326%     set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])
    12931327else
    12941328    set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
    12951329    set(handles.scan_j,'Value',1)
    1296     set(handles.scan_j,'BackgroundColor',[1 1 0])
    1297 end
     1330%     set(handles.scan_j,'BackgroundColor',[1 1 0])
     1331end
     1332scan_j_Callback(hObject, eventdata, handles)
    12981333
    12991334%-------------------------------------------------------------------
     
    13051340    set(handles.scan_i,'Value',0)
    13061341    set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
     1342    NomType=get(handles.FileIndex,'UserData');
     1343    switch NomType
     1344    case {'_i_j1-j2','#_ab','%3dab'},% pair with j index
     1345        set(handles.fix_pair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off')
     1346    otherwise
     1347        set(handles.fix_pair,'Visible','off')
     1348    end
    13071349else
    13081350    set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])
    13091351    set(handles.scan_i,'Value',1)
    13101352    set(handles.scan_i,'BackgroundColor',[1 1 0])
     1353    set(handles.fix_pair,'Visible','off')
    13111354end
    13121355
     
    15881631
    15891632%-------------------------------------------------------------------
    1590 %Executes on button press in runmin: make one step backward and call
    1591 %run0. The step backward is along the fields series 1 or 2 depending on
    1592 %the scan_i and scan_j check box (exclusive each other)
    1593 %-------------------------------------------------------------------
    1594 function RunMovie_Callback(hObject, eventdata, handles)
     1633% -- Executes on button press in Movie: make a series of +> steps
     1634function Movie_Callback(hObject, eventdata, handles)
    15951635%------------------------------------------------------------------
    1596 set(handles.RunMovie,'BackgroundColor',[1 1 0])%paint the command button in yellow
     1636set(handles.Movie,'BackgroundColor',[1 1 0])%paint the command button in yellow
    15971637drawnow
    15981638increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
     
    16001640set(handles.speed,'Visible','on')
    16011641set(handles.speed_txt,'Visible','on')
    1602 set(handles.RunMovie,'BusyAction','queue')
     1642set(handles.Movie,'BusyAction','queue')
    16031643testavi=0;
    16041644UvData=get(handles.uvmat,'UserData');
    16051645
    1606 while get(handles.speed,'Value')~=0 & isequal(get(handles.RunMovie,'BusyAction'),'queue') % enable STOP command
     1646while get(handles.speed,'Value')~=0 & isequal(get(handles.Movie,'BusyAction'),'queue') % enable STOP command
    16071647        errormsg=runpm(hObject,eventdata,handles,increment);
    16081648        if ~isempty(errormsg)
     
    16151655   set(handles.uvmat,'UserData',UvData);
    16161656end
    1617 set(handles.RunMovie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
     1657set(handles.Movie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
     1658
     1659%-------------------------------------------------------------------
     1660% -- Executes on button press in Movie: make a series of <- steps
     1661function MovieBackward_Callback(hObject, eventdata, handles)
     1662%------------------------------------------------------------------
     1663set(handles.MovieBackward,'BackgroundColor',[1 1 0])%paint the command button in yellow
     1664drawnow
     1665increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
     1666set(handles.STOP,'Visible','on')
     1667set(handles.speed,'Visible','on')
     1668set(handles.speed_txt,'Visible','on')
     1669set(handles.MovieBackward,'BusyAction','queue')
     1670testavi=0;
     1671UvData=get(handles.uvmat,'UserData');
     1672
     1673while get(handles.speed,'Value')~=0 & isequal(get(handles.MovieBackward,'BusyAction'),'queue') % enable STOP command
     1674        errormsg=runpm(hObject,eventdata,handles,increment);
     1675        if ~isempty(errormsg)
     1676            return
     1677        end
     1678        pause(1.02-get(handles.speed,'Value'))% wait for next image
     1679end
     1680if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj),
     1681    UvData.aviobj=close(UvData.aviobj);
     1682   set(handles.uvmat,'UserData',UvData);
     1683end
     1684set(handles.MovieBackward,'BackgroundColor',[1 0 0])%paint the command buttonback to red
    16181685
    16191686%-------------------------------------------------------------------
     
    16221689set(handles.movie_pair,'BusyAction','Cancel')
    16231690set(handles.movie_pair,'value',0)
    1624 set(handles.RunMovie,'BusyAction','Cancel')
     1691set(handles.Movie,'BusyAction','Cancel')
     1692set(handles.MovieBackward,'BusyAction','Cancel')
    16251693set(handles.MenuExportMovie,'BusyAction','Cancel')
    16261694
     
    16581726
    16591727comp_input=get(handles.fix_pair,'Value');
    1660 if isequal(NomType,'_i1-i2')||isequal(NomType,'_i1-i2_j')
    1661     comp_input=1; %impose a fixed pair
    1662     set(handles.fix_pair,'Value',1)
    1663 end
     1728% if isequal(NomType,'_i1-i2')||isequal(NomType,'_i1-i2_j')
     1729%     comp_input=1; %impose a fixed pair
     1730%     set(handles.fix_pair,'Value',1)
     1731% end
    16641732
    16651733%case of scanning along the first direction (rootfile numbers)
     
    17091777    [indices]=name_generator('',num1,num_a,'',NomType,1,num2,num_b,'');
    17101778    set(handles.FileIndex,'String',indices);
    1711     if sub_value
     1779    if ~isempty(filename_1)
    17121780         indices_1=name_generator('',num1_1,num_a_1,'',NomType_1,1,num2_1,num_b_1,'');
    17131781         set(handles.FileIndex_1,'String',indices_1);
     
    18971965function errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,Field)
    18981966%------------------------------------------------------------------------
     1967
    18991968%initialisation
    19001969set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
     
    19261995FileType=[];%default
    19271996if ~isempty(filename)
    1928 %     [filename,RootPath,filebase,xx,Ext]=read_file_boxes(handles);
    19291997    if ~exist(filename,'file')
    19301998        errormsg=['input file ' filename ' does not exist'];
     
    24212489    if NbDim==3
    24222490        nbpoints=UvData.Field.DimValue(DimIndex(1));
    2423         %Zvar=DimVarIndex(DimIndex(1));
    2424          %Zvar=DimVarIndex(1);
    2425 %          Zvar=VarType{imax}.coord_3;
    24262491        if isfield(VarType{imax},'coord_3')&& ~isequal(VarType{imax}.coord_3,0) % z is a dimension variable
    2427             ZName=UvData.Field.ListVarName{VarType{imax}.coord_3}
     2492            ZName=UvData.Field.ListVarName{VarType{imax}.coord_3};
    24282493            eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])
    24292494            eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])
     
    30753140    set(handles.npx,'Visible','on')
    30763141    set(handles.npy,'Visible','on')
    3077     set(handles.fix_pair,'Value',0)
     3142%     set(handles.fix_pair,'Value',0)
    30783143else
    30793144    set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons
     
    30813146    set(handles.npx,'Visible','off')
    30823147    set(handles.npy,'Visible','off')
    3083     set(handles.fix_pair,'Value',1)
     3148%     set(handles.fix_pair,'Value',1)
    30843149end
    30853150setfield(handles);% update the field structure ('civ1'....)
     
    32463311    set(handles.npx,'Visible','on')
    32473312    set(handles.npy,'Visible','on')
    3248     set(handles.fix_pair,'Value',0)
     3313%     set(handles.fix_pair,'Value',0)
    32493314else
    32503315    set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons
     
    32523317    set(handles.npx,'Visible','off')
    32533318    set(handles.npy,'Visible','off')
    3254     set(handles.fix_pair,'Value',1)
     3319%     set(handles.fix_pair,'Value',1)
    32553320end
    32563321if isequal(field,'velocity')|isequal(field_1,'velocity');
     
    44154480set(handles.speed,'Visible','on')
    44164481set(handles.speed_txt,'Visible','on')
    4417 set(handles.RunMovie,'BusyAction','queue')
     4482set(handles.Movie,'BusyAction','queue')
    44184483
    44194484imin=str2num(get(handles.i1,'String'));
     
    47594824end
    47604825UvData=get(handles.uvmat,'UserData');
    4761 % [hset_object,UvData.sethandles]=set_object(data);% call the set_object interface
     4826[hset_object,UvData.sethandles]=set_object(data);% call the set_object interface
    47624827% %position the set_object GUI with respect to uvmat
    47634828% pos_uvmat=get(handles.uvmat,'Position');
     
    48664931   
    48674932
     4933
     4934
     4935
     4936
Note: See TracChangeset for help on using the changeset viewer.