Changeset 645


Ignore:
Timestamp:
May 28, 2013, 11:30:28 PM (11 years ago)
Author:
sommeria
Message:

various improvements

Location:
trunk/src/series
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/civ_input.m

    r642 r645  
    2525
    2626
    27 % Last Modified by GUIDE v2.5 20-May-2013 09:55:30
     27% Last Modified by GUIDE v2.5 25-May-2013 12:37:21
    2828% Begin initialization code - DO NOT EDIT
    2929gui_Singleton = 1;
     
    288288%% list the possible index pairs, depending on the option set in ListPairMode
    289289ListPairMode_Callback([], [], handles)
    290 
     290ListPairCiv1_Callback(hObject, eventdata, handles)
    291291% for movies don't modify except if the current ref is outside index bounds
    292292%if strcmp(ExtInput,'.nc')|| ~(strcmp(FileType,'mmreader')||strcmp(FileType,'VideoReader') && num_ref_i<=MaxIndex_i && num_ref_j<=MaxIndex_j)
     
    426426%% update i and j index range if a nc file has been opened or pb withmin max image indices:
    427427% then set first and last to the inputfile index by default
    428 first_i=str2num(get(handles.first_i,'String'));
     428first_i=str2num(get(handles.MinIndex_i,'String'));
    429429last_i=str2num(get(handles.last_i,'String'));
    430430if isempty(first_i) || isempty(last_i)||isempty(MinIndex_i)||isempty(MaxIndex_i)||ind_opening~=0 || isempty(first_i) || isempty(last_i)|| first_i<MinIndex_i || last_i>MaxIndex_i
    431431    first_i=num_ref_i;
    432432    last_i=num_ref_i;
    433     set(handles.first_i,'String',num2str(first_i));
     433    set(handles.MinIndex_i,'String',num2str(first_i));
    434434    set(handles.last_i,'String',num2str(last_i));%
    435435end
    436436
    437437%j index range
    438 first_j=str2num(get(handles.first_j,'String'));
     438first_j=str2num(get(handles.MinIndex_j,'String'));
    439439last_j=str2num(get(handles.last_j,'String'));
    440440if isempty(first_j) || isempty(last_j)||isempty(MinIndex_j)||isempty(MaxIndex_j)||ind_opening~=0 || first_j<MinIndex_j || last_j>MaxIndex_j
    441441    first_j=num_ref_j;
    442442    last_j=num_ref_j;
    443     set(handles.first_j,'String',num2str(first_j));
     443    set(handles.MinIndex_j,'String',num2str(first_j));
    444444    set(handles.last_j,'String',num2str(last_j));%
    445445end
     
    618618guidata(hObject, handles);% Update handles structure
    619619uiresume(handles.civ_input);
    620 drawnow
    621 
    622 return
    623 
    624 
    625 set(handles.OK, 'Enable','Off')
    626 set(handles.OK,'BackgroundColor',[0.831 0.816 0.784])
    627 set(handles.OK,'UserData',now)% record the time of launch
    628 
    629 errormsg=launch_jobs(hObject, eventdata, handles);
    630 set(handles.OK, 'Enable','On')
    631 set(handles.OK,'BackgroundColor',[1 0 0])
    632 
    633 % display errors or start status callback to visualise results
    634 if ~isempty(errormsg)
    635     display(errormsg)
    636     msgbox_uvmat('ERROR',errormsg)
    637 elseif  isfield(handles,'status') %&& ~isequal(get(handles.ListPairMode,'Value'),3)
    638     set(handles.status,'Value',1);%suppress status display
    639     status_Callback(hObject, eventdata, handles)
    640 end
    641 
    642 
    643 
    644 %------------------------------------------------------------------------
    645 % --- determine the list of index pairs of processing file
    646 function [i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2]=...
    647     find_pair_indices(handles,ref_i,ref_j,mode)
    648 %------------------------------------------------------------------------
    649 
    650 list_civ1=get(handles.ListPairCiv1,'String');
    651 index_civ1=get(handles.ListPairCiv1,'Value');
    652 str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1
    653 if isempty(str_civ1)||isequal(str_civ1,'')
    654     msgbox_uvmat('ERROR','no image pair selected for civ1')
    655     return
    656 end
    657 list_civ2=get(handles.ListPairCiv2,'String');
    658 index_civ2=get(handles.ListPairCiv2,'Value');
    659 if index_civ2>length(list_civ2)
    660     list_civ2=list_civ1;
    661     index_civ2=index_civ1;
    662 end
    663 str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2
    664 
    665 if isequal (mode,'series(Di)')
    666     lastfield=str2double(get(handles.nb_field,'String'));
    667     i1_civ1=ref_i-floor(index_civ1/2)*ones(size(ref_i));% set of first image numbers
    668     i2_civ1=ref_i+ceil(index_civ1/2)*ones(size(ref_i));
    669     j1_civ1=ref_j;
    670     j2_civ1=ref_j;
    671     i1_civ2=ref_i-floor(index_civ2/2)*ones(size(ref_i));
    672     i2_civ2=ref_i+ceil(index_civ2/2)*ones(size(ref_i));
    673     j1_civ2=ref_j;
    674     j2_civ2=ref_j;
    675    
    676     % adjust the first and last field number
    677     lastfield=str2double(get(handles.nb_field,'String'));
    678     if isnan(lastfield)
    679         indsel=find((i1_civ1 >= 1)&(i1_civ2 >= 1));
    680     else
    681         indsel=find((i2_civ1 <= lastfield)&(i2_civ2 <= lastfield)&(i1_civ1 >= 1)&(i1_civ2 >= 1));
    682     end
    683     if length(indsel)>=1
    684         firstind=indsel(1);
    685         lastind=indsel(end);
    686         set(handles.first_i,'String',num2str(ref_i(firstind)))%update the display of first and last fields
    687         set(handles.last_i,'String',num2str(ref_i(lastind)))
    688         ref_i=ref_i(indsel);
    689         i1_civ1=i1_civ1(indsel);
    690         i1_civ2=i1_civ2(indsel);
    691         i2_civ1=i2_civ1(indsel);
    692         i2_civ2=i2_civ2(indsel);
    693     end
    694 elseif isequal (mode,'series(Dj)')
    695     lastfield_j=str2double(get(handles.nb_field2,'String'));
    696     i1_civ1=ref_i;% set of first image numbers
    697     i2_civ1=ref_i;
    698     j1_civ1=ref_j-floor(index_civ1/2)*ones(size(ref_j));
    699     j2_civ1=ref_j+ceil(index_civ1/2)*ones(size(ref_j));
    700     i1_civ2=ref_i;
    701     i2_civ2=ref_i;
    702     j1_civ2=ref_j-floor(index_civ2/2)*ones(size(ref_j));
    703     j2_civ2=ref_j+ceil(index_civ2/2)*ones(size(ref_j));
    704     % adjust the first and last field number
    705     if isnan(lastfield_j)
    706         indsel=find((j1_civ1 >= 1)&(j1_civ2 >= 1));
    707     else
    708         indsel=find((j2_civ1 <= lastfield_j)&(j2_civ2 <= lastfield_j)&(j1_civ1 >= 1)&(j1_civ2 >= 1));
    709     end
    710     if length(indsel)>=1
    711         firstind=indsel(1);
    712         lastind=indsel(end);
    713         set(handles.first_j,'String',num2str(ref_j(firstind)))%update the display of first and last fields
    714         set(handles.last_j,'String',num2str(ref_j(lastind)))
    715         ref_j=ref_j(indsel);
    716         j1_civ1=j1_civ1(indsel);
    717         j2_civ1=j2_civ1(indsel);
    718         j1_civ2=j1_civ2(indsel);
    719         j2_civ2=j2_civ2(indsel);
    720     end
    721 elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)
    722     displ_num=get(handles.ListPairCiv1,'UserData');
    723     i1_civ1=ref_i;
    724     i2_civ1=ref_i;
    725     j1_civ1=displ_num(1,index_civ1);
    726     j2_civ1=displ_num(2,index_civ1);
    727     i1_civ2=ref_i;
    728     i2_civ2=ref_i;
    729     j1_civ2=displ_num(1,index_civ2);
    730     j2_civ2=displ_num(2,index_civ2);
    731 elseif isequal(mode,'displacement')
    732     i1_civ1=ref_i;
    733     i2_civ1=ref_i;
    734     j1_civ1=ref_j;
    735     j2_civ1=ref_j;
    736     i1_civ2=ref_i;
    737     i2_civ2=ref_i;
    738     j1_civ2=ref_j;
    739     j2_civ2=ref_j;
    740 end
     620
     621% %------------------------------------------------------------------------
     622% % --- determine the list of index pairs of processing file
     623% function [i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2]=...
     624%     find_pair_indices(handles,ref_i,ref_j,mode)
     625% %------------------------------------------------------------------------
     626%
     627% list_civ1=get(handles.ListPairCiv1,'String');
     628% index_civ1=get(handles.ListPairCiv1,'Value');
     629% str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1
     630% if isempty(str_civ1)||isequal(str_civ1,'')
     631%     msgbox_uvmat('ERROR','no image pair selected for civ1')
     632%     return
     633% end
     634% list_civ2=get(handles.ListPairCiv2,'String');
     635% index_civ2=get(handles.ListPairCiv2,'Value');
     636% if index_civ2>length(list_civ2)
     637%     list_civ2=list_civ1;
     638%     index_civ2=index_civ1;
     639% end
     640% str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2
     641%
     642% if isequal (mode,'series(Di)')
     643%     lastfield=str2double(get(handles.MaxIndex_i,'String'));
     644%     i1_civ1=ref_i-floor(index_civ1/2)*ones(size(ref_i));% set of first image numbers
     645%     i2_civ1=ref_i+ceil(index_civ1/2)*ones(size(ref_i));
     646%     j1_civ1=ref_j;
     647%     j2_civ1=ref_j;
     648%     i1_civ2=ref_i-floor(index_civ2/2)*ones(size(ref_i));
     649%     i2_civ2=ref_i+ceil(index_civ2/2)*ones(size(ref_i));
     650%     j1_civ2=ref_j;
     651%     j2_civ2=ref_j;
     652%     
     653%     % adjust the first and last field number
     654%     lastfield=str2double(get(handles.MaxIndex_i,'String'));
     655%     if isnan(lastfield)
     656%         indsel=find((i1_civ1 >= 1)&(i1_civ2 >= 1));
     657%     else
     658%         indsel=find((i2_civ1 <= lastfield)&(i2_civ2 <= lastfield)&(i1_civ1 >= 1)&(i1_civ2 >= 1));
     659%     end
     660%     if length(indsel)>=1
     661%         firstind=indsel(1);
     662%         lastind=indsel(end);
     663%         set(handles.MinIndex_i,'String',num2str(ref_i(firstind)))%update the display of first and last fields
     664%         set(handles.last_i,'String',num2str(ref_i(lastind)))
     665%         ref_i=ref_i(indsel);
     666%         i1_civ1=i1_civ1(indsel);
     667%         i1_civ2=i1_civ2(indsel);
     668%         i2_civ1=i2_civ1(indsel);
     669%         i2_civ2=i2_civ2(indsel);
     670%     end
     671% elseif isequal (mode,'series(Dj)')
     672%     lastfield_j=str2double(get(handles.MaxIndex_j,'String'));
     673%     i1_civ1=ref_i;% set of first image numbers
     674%     i2_civ1=ref_i;
     675%     j1_civ1=ref_j-floor(index_civ1/2)*ones(size(ref_j));
     676%     j2_civ1=ref_j+ceil(index_civ1/2)*ones(size(ref_j));
     677%     i1_civ2=ref_i;
     678%     i2_civ2=ref_i;
     679%     j1_civ2=ref_j-floor(index_civ2/2)*ones(size(ref_j));
     680%     j2_civ2=ref_j+ceil(index_civ2/2)*ones(size(ref_j));
     681%     % adjust the first and last field number
     682%     if isnan(lastfield_j)
     683%         indsel=find((j1_civ1 >= 1)&(j1_civ2 >= 1));
     684%     else
     685%         indsel=find((j2_civ1 <= lastfield_j)&(j2_civ2 <= lastfield_j)&(j1_civ1 >= 1)&(j1_civ2 >= 1));
     686%     end
     687%     if length(indsel)>=1
     688%         firstind=indsel(1);
     689%         lastind=indsel(end);
     690%         set(handles.MinIndex_j,'String',num2str(ref_j(firstind)))%update the display of first and last fields
     691%         set(handles.last_j,'String',num2str(ref_j(lastind)))
     692%         ref_j=ref_j(indsel);
     693%         j1_civ1=j1_civ1(indsel);
     694%         j2_civ1=j2_civ1(indsel);
     695%         j1_civ2=j1_civ2(indsel);
     696%         j2_civ2=j2_civ2(indsel);
     697%     end
     698% elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)
     699%     displ_num=get(handles.ListPairCiv1,'UserData');
     700%     i1_civ1=ref_i;
     701%     i2_civ1=ref_i;
     702%     j1_civ1=displ_num(1,index_civ1);
     703%     j2_civ1=displ_num(2,index_civ1);
     704%     i1_civ2=ref_i;
     705%     i2_civ2=ref_i;
     706%     j1_civ2=displ_num(1,index_civ2);
     707%     j2_civ2=displ_num(2,index_civ2);
     708% elseif isequal(mode,'displacement')
     709%     i1_civ1=ref_i;
     710%     i2_civ1=ref_i;
     711%     j1_civ1=ref_j;
     712%     j2_civ1=ref_j;
     713%     i1_civ2=ref_i;
     714%     i2_civ2=ref_i;
     715%     j1_civ2=ref_j;
     716%     j2_civ2=ref_j;
     717% end
    741718
    742719%------------------------------------------------------------------------
     
    746723ListCompareMode=get(handles.ListCompareMode,'String');
    747724option=ListCompareMode{get(handles.ListCompareMode,'Value')};
     725hseries=findobj(allchild(0),'Tag','series');
     726SeriesData=get(hseries,'UserData');
     727check_nc=strcmp(SeriesData.FileType{1},'.nc');
     728ImageType=SeriesData.FileType(2:end);
     729if check_nc
     730    ImageType=SeriesData.FileType(2:end);
     731else
     732    ImageType=SeriesData.FileType;
     733end
     734hhseries=guidata(hseries);
     735InputTable=get(hhseries.InputTable,'Data');
     736OriginIndex='off';
     737PairIndices='off';
     738DoubleInputSeries='off';
    748739switch option
    749740    case 'PIV'
    750         set(handles.RootFile_1,'Visible','Off');
    751         set(handles.sub_txt,'Visible','off')
    752         set(handles.RootFile_1,'String',[]);
    753         mode_store=get(handles.ListCompareMode,'UserData');
    754         set(handles.ListPairMode,'Visible','on')
    755         set(handles.ListPairMode,'Value',1)
    756         set(handles.ListPairMode,'String',mode_store)
    757         set(handles.CheckStereo,'Value',0)     
    758     case 'PIV volume'     
    759         set(handles.RootFile_1,'Visible','Off');
    760         set(handles.sub_txt,'Visible','off')
    761         set(handles.RootFile_1,'String',[]);
    762         mode_store=get(handles.ListCompareMode,'UserData');
    763         set(handles.ListPairMode,'Visible','on')
     741        PairIndices='on';% needs to define index pairs for PIV
     742       
     743    case 'PIV volume'
     744        PairIndices='on';% needs to define index pairs for PIV
    764745        set(handles.ListPairMode,'Value',1)
    765746        set(handles.ListPairMode,'String',{'series(Di)'})
    766         set(handles.CheckStereo,'Value',0)
    767         set(handles.last_j,'String',get(handles.nb_field2,'String'))% select the whole volume scan by default
    768         set(handles.incr_i,'String',num2str(2))%
    769     otherwise
    770         filebase=get(handles.RootPath,'String');
    771         set(handles.sub_txt,'Visible','on')
    772         set(handles.RootFile_1,'Visible','On');%mkes the second file input window visible
    773         mode_store=get(handles.ListPairMode,'String');%get the present 'mode'
    774         set(handles.ListCompareMode,'UserData',mode_store);%store the mode display
    775         set(handles.ListPairMode,'Visible','off')
     747        ListPairMode_Callback(hObject, eventdata, handles)
     748        %         set(handles.RootFile_1,'Visible','Off');
     749        %         set(handles.sub_txt,'Visible','off')
     750        %         set(handles.RootFile_1,'String',[]);
     751        %         mode_store=get(handles.ListCompareMode,'UserData');
     752        %         set(handles.ListPairMode,'Visible','on')
     753        %         set(handles.ListPairMode,'Value',1)
     754        %         set(handles.ListPairMode,'String',{'series(Di)'})
     755        %         set(handles.CheckStereo,'Value',0)
     756        %         set(handles.last_j,'String',get(handles.MaxIndex_j,'String'))% select the whole volume scan by default
     757        %         set(handles.incr_i,'String',num2str(2))%
     758    case 'displacement'
     759        OriginIndex='on';%define a frame origin for displacement
     760    case 'shift'
     761        if numel(ImageType)==1
     762            fileinput=uigetfile_uvmat('pick a second file series for synchronous shift',InputTable{check_nc+1});
     763            if ~isempty(fileinput)
     764                series( 'display_file_name',hhseries,fileinput,'append')
     765            end
     766           
     767           
     768        end
     769end
     770set(handles.num_OriginIndex,'Visible',OriginIndex)
     771set(handles.OriginIndex_title,'Visible',OriginIndex)
     772set(handles.PairIndices,'Visible',PairIndices)
     773ListPairMode_Callback(hObject, eventdata, handles)
    776774       
    777         %% open an image file with the browser
    778         ind_opening=1;%default
    779         browse.incr_pair=[0 0]; %default
    780         oldfile=get(handles.RootPath,'String');
    781         menu={'*.png;*.jpg;*.tif;*.avi;*.AVI;', ' (*.png,*.jpg ,.tif, *.avi,*.AVI)';
    782             '*.png','.png image files'; ...
    783             '*.jpg',' jpeg image files'; ...
    784             '*.tif','.tif image files'; ...
    785             '*.avi;*.AVI','.avi movie files'; ...
    786             '*.*',  'All Files (*.*)'};
    787         if strcmp(option,'displacement')
    788             comment='Pick the reference file for displacements';
    789         else
    790             comment='Pick a file of the second series';
    791         end
    792         [FileName, PathName] = uigetfile( menu, comment,oldfile);
    793         fileinput=[PathName FileName];%complete file name
    794         sizf=size(fileinput);
    795         if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
    796         [path,name,ext]=fileparts(fileinput);
    797         [path1]=fileparts(filebase);
    798         if isunix
    799             [status,path]=system(['readlink ' path]);
    800             [status,path1]=system(['readlink ' path1]);% look for the true path in case of symbolic paths
    801         end
    802         if ~strcmp(path1,path)
    803             msgbox_uvmat('ERROR','The second image or series must be in the same directory as the first one')
    804             return
    805         end
    806         if strcmp(option,'displacement')
    807             [tild,RootFile_1]=fileparts(name);
    808         else
    809             [FilePath,FileName,Ext]=fileparts(fileinput);
    810             % detect the file type, get the movie object if relevant, and look for the corresponding file series:
    811             % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
    812             [RootPath,SubDir,RootFile_1,i1_series,i2_series,j1_series,j2_series,nom_type_1,FileType,FileInfo,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName Ext]);
    813            
    814             %check image nom type
    815             if ~strcmp(nom_type_1,get(handles.NomType,'String'))
    816                 msgbox_uvmat('ERROR','The second image series must have the same indexing type as the first one, or use the option displacement for a fixed image')
    817                 return
    818             end
    819         end
    820         %check image  extension
    821         if ~strcmp(ext,get(handles.ImaExt,'String'))
    822             msgbox_uvmat('ERROR','The second image series must have the same extension name as the first one')
    823             return
    824         end
    825         set(handles.RootFile_1,'String',RootFile_1);
    826        
    827 end
    828 ListPairMode_Callback(hObject, eventdata, handles)
    829775
    830776
     
    935881function enable_i(handles, state)
    936882set(handles.itext,'Visible',state)
    937 % set(handles.first_i,'Visible',state)
     883% set(handles.MinIndex_i,'Visible',state)
    938884% set(handles.last_i,'Visible',state)
    939885% set(handles.incr_i,'Visible',state)
    940 set(handles.nb_field,'Visible',state)
     886set(handles.MaxIndex_i,'Visible',state)
    941887set(handles.ref_i,'Visible',state)
    942888
    943889function enable_j(handles, state)
    944890set(handles.jtext,'Visible',state)
    945 % set(handles.first_j,'Visible',state)
     891% set(handles.MinIndex_j,'Visible',state)
    946892% set(handles.last_j,'Visible',state)
    947893% set(handles.incr_j,'Visible',state)
    948 set(handles.nb_field2,'Visible',state)
     894set(handles.MinIndex_j,'Visible',state)
     895set(handles.MaxIndex_j,'Visible',state)
    949896set(handles.ref_j,'Visible',state)
     897%hseries=findobj(allchild(0),'Tag','series');
     898%hhseries=guidata(hseries);
     899%series('enable_j',hhseries,state); %file input with xml reading  in uvmat, show the image in phys coordinates
     900
    950901
    951902
     
    956907%reproduce by default the chosen pair in the checkciv2 menu
    957908list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs
    958 index_pair=get(handles.ListPairCiv1,'Value');
    959 displ_num=get(handles.ListPairCiv1,'UserData');
    960 list_pair2=get(handles.ListPairCiv2,'String');%get the menu of image pairs
    961 if index_pair<=length(list_pair2)
    962     set(handles.ListPairCiv2,'Value',index_pair);
    963 end
    964 
    965 %update first_i and last_i according to the chosen image pairs
     909PairString=list_pair{get(handles.ListPairCiv1,'Value')};
     910
     911[ind1,ind2]=...
     912    find_pair_indices(PairString);
     913hseries=findobj(allchild(0),'Tag','series');
     914%SeriesData=get(hseries,'UserData');
     915hhseries=guidata(hseries);
     916set(hhseries.num_first_j,'String',num2str(ind1));
     917set(hhseries.num_last_j,'String',num2str(ind2));
     918set(hhseries.num_incr_j,'String',num2str(ind2-ind1));
     919
     920% displ_num=get(handles.ListPairCiv1,'UserData');
     921% list_pair2=get(handles.ListPairCiv2,'String');%get the menu of image pairs
     922% if index_pair<=length(list_pair2)
     923%     set(handles.ListPairCiv2,'Value',index_pair);
     924% end
     925
     926
     927%update MinIndex_i and last_i according to the chosen image pairs
    966928% mode_list=get(handles.ListPairMode,'String');
    967929% mode_value=get(handles.ListPairMode,'Value');
    968930% mode=mode_list{mode_value};
    969931% if isequal(mode,'series(Di)')
    970 %     first_i=str2double(get(handles.first_i,'String'));
     932%     MinIndex_i=str2double(get(handles.MinIndex_i,'String'));
    971933%     last_i=str2double(get(handles.last_i,'String'));
    972934%     incr_i=str2double(get(handles.incr_i,'String'));
    973 %     num_i=first_i:incr_i:last_i;
    974 %     lastfield=str2double(get(handles.nb_field,'String'));
     935%     num_i=MinIndex_i:incr_i:last_i;
     936%     lastfield=str2double(get(handles.MaxIndex_i,'String'));
    975937%     if ~isnan(lastfield)
    976938%         test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ...
     
    978940%         num_i=num_i(test_find);
    979941%     end
    980 %     set(handles.first_i,'String',num2str(num_i(1)));
     942%     set(handles.MinIndex_i,'String',num2str(num_i(1)));
    981943%     set(handles.last_i,'String',num2str(num_i(end)));
    982944% elseif isequal(mode,'series(Dj)')
    983 %     first_j=str2double(get(handles.first_j,'String'));
     945%     MinIndex_j=str2double(get(handles.MinIndex_j,'String'));
    984946%     last_j=str2double(get(handles.last_j,'String'));
    985947%     incr_j=str2double(get(handles.incr_j,'String'));
    986 %     num_j=first_j:incr_j:last_j;
    987 %     lastfield2=str2double(get(handles.nb_field2,'String'));
     948%     num_j=MinIndex_j:incr_j:last_j;
     949%     lastfield2=str2double(get(handles.MaxIndex_j,'String'));
    988950%     if ~isnan(lastfield2)
    989951%         test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...
     
    991953%         num_j=num_j(test_find);
    992954%     end
    993 %     set(handles.first_j,'String',num2str(num_j(1)));
     955%     set(handles.MinIndex_j,'String',num2str(num_j(1)));
    994956%     set(handles.last_j,'String',num2str(num_j(end)));
    995957% end
     
    1001963index_pair=get(handles.ListPairCiv2,'Value');%get the selected position index in the menu
    1002964
    1003 %update first_i and last_i according to the chosen image pairs
     965%update MinIndex_i and last_i according to the chosen image pairs
    1004966mode_list=get(handles.ListPairMode,'String');
    1005967mode_value=get(handles.ListPairMode,'Value');
    1006968mode=mode_list{mode_value};
    1007969if isequal(mode,'series(Di)')
    1008     first_i=str2double(get(handles.first_i,'String'));
     970    first_i=str2double(get(handles.MinIndex_i,'String'));
    1009971    last_i=str2double(get(handles.last_i,'String'));
    1010972    incr_i=str2double(get(handles.incr_i,'String'));
    1011973    num_i=first_i:incr_i:last_i;
    1012     lastfield=str2double(get(handles.nb_field,'String'));
     974    lastfield=str2double(get(handles.MaxIndex_i,'String'));
    1013975    if ~isnan(lastfield)
    1014976        test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ...
     
    1016978        num_i=num_i(test_find);
    1017979    end
    1018     set(handles.first_i,'String',num2str(num_i(1)));
     980    set(handles.MinIndex_i,'String',num2str(num_i(1)));
    1019981    set(handles.last_i,'String',num2str(num_i(end)));
    1020982elseif isequal(mode,'series(Dj)')
    1021     first_j=str2double(get(handles.first_j,'String'));
     983    first_j=str2double(get(handles.MinIndex_j,'String'));
    1022984    last_j=str2double(get(handles.last_j,'String'));
    1023985    incr_j=str2double(get(handles.incr_j,'String'));
    1024986    num_j=first_j:incr_j:last_j;
    1025     lastfield2=str2double(get(handles.nb_field2,'String'));
     987    lastfield2=str2double(get(handles.MaxIndex_j,'String'));
    1026988    if ~isnan(lastfield2)
    1027989        test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...
     
    1029991        num_j=num_j(test_find);
    1030992    end
    1031     set(handles.first_j,'String',num2str(num_j(1)));
     993    set(handles.MinIndex_j,'String',num2str(num_j(1)));
    1032994    set(handles.last_j,'String',num2str(num_j(end)));
    1033995end
     
    10671029%------------------------------------------------------------------------
    10681030% determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of
    1069 % the field series set by first_i, incr, last_i
     1031% the field series set by MinIndex_i, incr, last_i
    10701032% index=1: look for pairs for civ1
    10711033% index=2: look for pairs for civ2
     
    13051267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    13061268%------------------------------------------------------------------------
    1307 function first_i_Callback(hObject, eventdata, handles)
    1308 %------------------------------------------------------------------------
    1309 first_i=str2double(get(handles.first_i,'String'));
     1269function MinIndex_i_Callback(hObject, eventdata, handles)
     1270%------------------------------------------------------------------------
     1271first_i=str2double(get(handles.MinIndex_i,'String'));
    13101272set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index
    13111273ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt)
    13121274
    13131275%------------------------------------------------------------------------
    1314 function first_j_Callback(hObject, eventdata, handles)
    1315 %------------------------------------------------------------------------
    1316 first_j=str2num(get(handles.first_j,'String'));
     1276function MinIndex_j_Callback(hObject, eventdata, handles)
     1277%------------------------------------------------------------------------
     1278first_j=str2num(get(handles.MinIndex_j,'String'));
    13171279set(handles.ref_j,'String', num2str(first_j))% reference index for pair dt = first index
    13181280ref_j_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt)
     
    21402102        Data.Civ1_U_Diff=Data.Civ1_U_Diff(Data.Civ1_FF==0);
    21412103        Data.Civ1_V_Diff=Data.Civ1_V_Diff(Data.Civ1_FF==0);
    2142         DiffVel(irho)=sqrt(mean(Data.Civ1_U_Diff.*Data.Civ1_U_Diff+Data.Civ1_V_Diff.*Data.Civ1_V_Diff))
     2104        DiffVel(irho)=sqrt(mean(Data.Civ1_U_Diff.*Data.Civ1_U_Diff+Data.Civ1_V_Diff.*Data.Civ1_V_Diff));
    21432105        NbSites(irho,:)=Data.Civ1_NbSites*numel(Data.Civ1_NbSites)/numel(Data.Civ1_U_Diff);
    21442106        Param.Patch1.SmoothingParam=2*Param.Patch1.FieldSmooth;
     
    21612123% --- Executes on button press in TestCiv2.
    21622124function TestCiv2_Callback(hObject, eventdata, handles)
     2125
     2126
     2127
     2128function num_OriginIndex_Callback(hObject, eventdata, handles)
     2129% hObject    handle to num_OriginIndex (see GCBO)
     2130% eventdata  reserved - to be defined in a future version of MATLAB
     2131% handles    structure with handles and user data (see GUIDATA)
     2132
     2133% Hints: get(hObject,'String') returns contents of num_OriginIndex as text
     2134%        str2double(get(hObject,'String')) returns contents of num_OriginIndex as a double
     2135
     2136
     2137% --- Executes during object creation, after setting all properties.
     2138function num_OriginIndex_CreateFcn(hObject, eventdata, handles)
     2139% hObject    handle to num_OriginIndex (see GCBO)
     2140% eventdata  reserved - to be defined in a future version of MATLAB
     2141% handles    empty - handles not created until after all CreateFcns called
     2142
     2143% Hint: edit controls usually have a white background on Windows.
     2144%       See ISPC and COMPUTER.
     2145if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     2146    set(hObject,'BackgroundColor','white');
     2147end
     2148
     2149%------------------------------------------------------------------------
     2150% --- determine the list of index pairs of processing file
     2151function [ind1,ind2]=...
     2152    find_pair_indices(str_civ,i_series,j_series,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j)
     2153%------------------------------------------------------------------------
     2154% i1_series=i_series;% set of first image indexes
     2155% i2_series=i_series;
     2156% j1_series=ones(size(i_series));% set of first image numbers
     2157% j2_series=ones(size(i_series));
     2158% check_bounds=false(size(i_series));
     2159ind1='';
     2160ind2='';
     2161r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names');
     2162if ~isempty(r)
     2163    mode=['D' r.ind];
     2164    ind1=stra2num(r.num1);
     2165    ind2=stra2num(r.num2);
     2166else
     2167    mode='burst';
     2168    r=regexp(str_civ,'^j= (?<num1>[a-z])-(?<num2>[a-z])','names');
     2169    if ~isempty(r)
     2170        NomTypeNc='_1ab';
     2171    else
     2172        r=regexp(str_civ,'^j= (?<num1>[A-Z])-(?<num2>[A-Z])','names');
     2173        if ~isempty(r)
     2174            NomTypeNc='_1AB';
     2175        else
     2176            r=regexp(str_civ,'^j= (?<num1>\d+)-(?<num2>\d+)','names');
     2177            if ~isempty(r)
     2178                NomTypeNc='_1_1-2';
     2179            end           
     2180        end
     2181    end
     2182    if isempty(r)
     2183        display('wrong pair mode input option')
     2184    else
     2185    ind1=stra2num(r.num1);
     2186    ind2=stra2num(r.num2);
     2187    end
     2188end
     2189% if strcmp (mode,'Di')
     2190%     i1_series=i_series-ind1;% set of first image numbers
     2191%     i2_series=i_series+ind2;
     2192%      check_bounds=i1_series<MinIndex_i | i2_series>MaxIndex_i;
     2193%     if isempty(j_series)
     2194%         NomTypeNc='_1-2';
     2195%     else
     2196%         j1_series=j_series;
     2197%         j2_series=j_series;
     2198%         NomTypeNc='_1-2_1';
     2199%     end
     2200% elseif strcmp (mode,'Dj')
     2201%     j1_series=j_series-ind1;
     2202%     j2_series=j_series+ind2;
     2203%     check_bounds=j1_series<MinIndex_j | j2_series>MaxIndex_j;
     2204%     NomTypeNc='_1_1-2';
     2205% else  %bursts
     2206%     j1_series=ind1*ones(size(i_series));
     2207%     j2_series=ind2*ones(size(i_series));
     2208% end
  • trunk/src/series/civ_series.m

    r637 r645  
    5555    Data.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
    5656    Data.OutputDirExt='.civ';%set the output dir extension
     57    Data.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar)
    5758    filecell=get_file_series(Param);%check existence of the first input file
    5859    if ~exist(filecell{1,1},'file')
     
    8990    [filecell,i_series,tild,j_series]=get_file_series(Param);
    9091    if ~exist(filecell{1,1},'file')
    91         displ('ERROR: the first input file does not exist')
     92        displ_uvmat('ERROR',' the first input file does not exist')
    9293        return
    9394    else
     
    10031004end
    10041005
    1005 %     if length(indsel)>=1
    1006 %         firstind=indsel(1);
    1007 %         lastind=indsel(end);
    1008 %         set(handles.first_j,'String',num2str(ref_j(firstind)))%update the display of first and last fields
    1009 %         set(handles.last_j,'String',num2str(ref_j(lastind)))
    1010 %         ref_j=ref_j(indsel);
    1011 %         j1_civ1=j1_civ1(indsel);
    1012 %         j2_civ1=j2_civ1(indsel);
    1013 %         j1_civ2=j1_civ2(indsel);
    1014 %         j2_civ2=j2_civ2(indsel);
    1015 %     end
    1016 % elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)
    1017 %     displ_num=get(handles.ListPairCiv1,'UserData');
    1018 %     i1_civ1=ref_i;
    1019 %     i2_civ1=ref_i;
    1020 %     j1_civ1=displ_num(1,index_civ1);
    1021 %     j2_civ1=displ_num(2,index_civ1);
    1022 %     i1_civ2=ref_i;
    1023 %     i2_civ2=ref_i;
    1024 %     j1_civ2=displ_num(1,index_civ2);
    1025 %     j2_civ2=displ_num(2,index_civ2);
    1026 % elseif isequal(mode,'displacement')
    1027 %     i1_civ1=ref_i;
    1028 %     i2_civ1=ref_i;
    1029 %     j1_civ1=ref_j;
    1030 %     j2_civ1=ref_j;
    1031 %     i1_civ2=ref_i;
    1032 %     i2_civ2=ref_i;
    1033 %     j1_civ2=ref_j;
    1034 %     j2_civ2=ref_j;
    1035 % end
    1036 
    1037 
    1038 
    1039 
     1006
     1007
     1008
  • trunk/src/series/time_series.m

    r635 r645  
    350350                VarInit=DataOut.(VarName);
    351351                if isempty(errormsg) && ~isequal(VarVal,VarInit)
    352                     displ_uvmat('ERROR',['time series requires constant coordinates ' VarName],checkrun)
     352                    displ_uvmat('ERROR',['time series requires constant coordinates ' VarName ': use projection mode interp'],checkrun)
    353353                    return
    354354                end
     
    414414test_time=diff(DataOut.Time)>0;% test that the readed time is increasing (not constant)
    415415if ~test_time
    416     DataOut.Time=1:filecounter;
     416    DataOut.Time=1:nbfield;
    417417end
    418418
Note: See TracChangeset for help on using the changeset viewer.