Ignore:
Timestamp:
Nov 18, 2017, 5:55:26 PM (6 years ago)
Author:
sommeria
Message:

mode displacement repaired

File:
1 edited

Legend:

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

    r1018 r1020  
    6060set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display)
    6161set(hObject,'WindowKeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
    62 %set(hObject,'KeyPressFcn',{@KeyPressFcn,handles})%set keyboard action function
    6362set(handles.ref_i,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function
    6463set(handles.ref_j,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function
    65 %set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function
    6664hseries=findobj(allchild(0),'Tag','series');% find the parent GUI 'series'
    6765hhseries=guidata(hseries); %handles of the elements in 'series'
     
    220218if isfield(Param.IndexRange,'TimeUnit')&&~isempty(Param.IndexRange.TimeUnit)
    221219    TimeUnit=Param.IndexRange.TimeUnit;
    222 end
    223 % if isfield(SeriesData,'TimeSource')
    224 %     set(handles.TimeSource,'String',SeriesData.TimeSource)
    225 % end 
     220end
    226221if isfield(SeriesData,'GeometryCalib')
    227222    tsai=SeriesData.GeometryCalib;
     
    317312end
    318313
     314       if strcmp(Param.ActionInput.ListCompareMode,'displacement')
     315            set(handles.PairIndices,'Visible','off')
     316        end
     317
    319318%% set the menu and default choice of civ pairs
    320319if ~isfield(Param.IndexRange,'first_j')||isequal(MaxIndex_j,MinIndex_j)% no possibility of j pairs
     
    668667OriginIndex='off';
    669668PairIndices='off';
    670 DoubleInputSeries='off';
    671669switch option
    672670    case 'PIV'
    673         PairIndices='on';% needs to define index pairs for PIV
    674        
     671        PairIndices='on';% needs to define index pairs for PIV       
    675672    case 'PIV volume'
    676673        PairIndices='on';% needs to define index pairs for PIV
     
    680677    case 'displacement'
    681678        OriginIndex='on';%define a frame origin for displacement
    682 %     case 'shift'
    683 %         if numel(ImageType)==1
    684 %             fileinput=uigetfile_uvmat('pick a second file series for synchronous shift',InputTable{check_nc+1});
    685 %             if ~isempty(fileinput)
    686 %                 series( 'display_file_name',hhseries,fileinput,'append')
    687 %             end
    688 %             
    689 %             
    690 %         end
    691679end
    692680set(handles.num_OriginIndex,'Visible',OriginIndex)
    693681set(handles.OriginIndex_title,'Visible',OriginIndex)
     682set(handles.CheckRefFile,'Visible',OriginIndex)
     683set(handles.RefFile,'Visible',OriginIndex)
    694684set(handles.PairIndices,'Visible',PairIndices)
    695 ListPairMode_Callback(hObject, eventdata, handles)
     685ListPairMode_Callback(hObject,eventdata,handles)
     686if strcmp(OriginIndex,'on')
     687    set(handles.CheckRefFile,'Value',1)
     688    CheckRefFile_Callback(hObject,eventdata,handles)
     689end
    696690       
    697691
     
    708702compare=compare_list{val};
    709703if strcmp(compare,'displacement')||strcmp(compare,'shift')
    710     mode='displacement';
     704    mode_selected='displacement';
    711705else
    712706    mode_list=get(handles.ListPairMode,'String');
     
    718712        mode_value=1;
    719713    end
    720     mode=mode_list{mode_value};
     714    mode_selected=mode_list{mode_value};
    721715end
    722716% displ_num=[];%default
     
    734728% in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices
    735729% are relative to the reference indices ref_i and ref_j respectively.
    736 if isequal(mode,'pair j1-j2')
     730if isequal(mode_selected,'pair j1-j2')
    737731    dt=1;
    738732    displ='';
     
    764758    displ_num(4,:)=0;
    765759    enable_j(handles, 'off')
    766 elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)')
     760elseif isequal(mode_selected,'series(Dj)') %| isequal(mode,'st_series(Dj)')
    767761    index=1:200;
    768762    displ_num(1,index)=-floor(index/2);
     
    770764    displ_num(3:4,index)=zeros(2,200);
    771765    enable_j(handles, 'on')
    772 elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)')
     766elseif isequal(mode_selected,'series(Di)') %| isequal(mode,'st_series(Di)')
    773767%     index=1:200;
    774768%     displ_num(1:2,index)=zeros(2,200);
     
    781775        enable_j(handles, 'off')
    782776    end
    783 elseif isequal(mode,'displacement')%the pairs have the same indices
     777elseif isequal(mode_selected,'displacement')%the pairs have the same indices
    784778    displ_num(1,1)=0;
    785779    displ_num(2,1)=0;
     
    855849mode_list=get(handles.ListPairMode,'String');
    856850mode_value=get(handles.ListPairMode,'Value');
    857 mode=mode_list{mode_value};
     851mode_selected=mode_list{mode_value};
    858852errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files
    859 if isequal(mode,'series(Di)') || ...% we do patch2 only
     853if isequal(mode_selected,'series(Di)') || ...% we do patch2 only
    860854        (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
    861855    errormsg=find_netcpair_civ( handles,2);
     
    872866       
    873867% %------------------------------------------------------------------------
    874 % function ref_j_Callback(hObject, eventdata, handles)
    875 % %------------------------------------------------------------------------
    876 % mode_list=get(handles.ListPairMode,'String');
    877 % mode_value=get(handles.ListPairMode,'Value');
    878 % mode=mode_list{mode_value};
    879 % errormsg='';
    880 % if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)')
    881 %     errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files
    882 % end
    883 % if isequal(mode,'series(Dj)') || ...
    884 %         (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
    885 %     errormsg=find_netcpair_civ(handles,2);
    886 % end
    887 % if ~isempty(errormsg)
    888 %     msgbox_uvmat('ERROR',errormsg)
    889 % end
    890 %
    891 % function ref_j_KeyPressFcn(hObject, eventdata, handles)
    892 % set(handles.ref_j,'BackgroundColor',[1 0 1])
    893 %------------------------------------------------------------------------
    894 % determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of
    895 % the field series set by MinIndex_i, incr, last_i
    896 % index=1: look for pairs for civ1
    897 % index=2: look for pairs for civ2
     868
    898869function errormsg=find_netcpair_civ(handles,index)
    899870%------------------------------------------------------------------------
     
    907878val=get(handles.ListCompareMode,'Value');
    908879compare=compare_list{val};
     880mode_selected='displacement';
    909881if ~strcmp(compare,'displacement')%||strcmp(compare,'shift')
    910882 
     
    917889        return
    918890    end
    919     mode=mode_list{mode_value};
     891    mode_selected=mode_list{mode_value};
    920892end
    921893nom_type_ima=CivInputData.NomTypeIma;
     
    935907ref_i=str2double(get(handles.ref_i,'String'));
    936908ref_j=[];
    937 if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')
     909if isequal(mode_selected,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')
    938910    ref_j=0;
    939911elseif strcmp(get(handles.ref_j,'Visible'),'on')
     
    955927
    956928%% determine the menu display in .ListPairCiv1
    957 switch mode
     929switch mode_selected
    958930    case 'series(Di)'
    959931        for ipair=1:nbpair
     
    995967        end
    996968    case 'pair j1-j2'%case of pairs
    997 %         MinIndex_j=CivInputData.MinIndex_j;
    998 %         MaxIndex_j=min(CivInputData.MaxIndex_j,10);%limitate the number of pairs to 10x10
    999969        MinIndex_j=str2num(get(handles.MinIndex_j,'String'));
    1000970        MaxIndex_j=str2num(get(handles.MaxIndex_j,'String'));
     
    11311101end   
    11321102if ~(isempty(umin)||isempty(umax)||isempty(vmin)||isempty(vmax))
    1133 %     list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs
    1134 %     index=get(handles.ListPairCiv1,'Value');
    1135 %     pair_string=list_pair{index};
    1136 %     time=get(handles.TimeSource,'UserData'); %get the set of times
    1137 %     pxcm=get(handles.SearchRange,'UserData');
    1138 %     mode_list=get(handles.ListPairMode,'String');
    1139 %     mode_value=get(handles.ListPairMode,'Value');
    1140 %     mode=mode_list{mode_value};     
    1141 %     if isequal (mode, 'series(Di)' )
    1142 %         ref_i=str2double(get(handles.ref_i,'String'));
    1143 %         num1=ref_i-floor(index/2);%  first image numbers
    1144 %         num2=ref_i+ceil(index/2);
    1145 %         num_a=1;
    1146 %         num_b=1;
    1147 %     elseif isequal (mode, 'series(Dj)')
    1148 %         num1=1;
    1149 %         num2=1;
    1150 %         ref_j=str2double(get(handles.ref_j,'String'));
    1151 %         num_a=ref_j-floor(index/2);%  first image numbers
    1152 %         num_b=ref_j+ceil(index/2);
    1153 %     elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)     
    1154 %         ref_i=str2double(get(handles.ref_i,'String'));
    1155 %         num1=ref_i;
    1156 %         num2=ref_i;
    1157 %                 r=regexp(pair_string,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');
    1158 %         if isempty(r)
    1159 %             r=regexp(pair_string,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');
    1160 %         end 
    1161 %         num_a=str2num(r.num1);
    1162 %         num_b=str2num(r.num2);
    1163 %     end
    1164 %     dt=time(num2+1,num_b+1)-time(num1+1,num_a+1);
    1165 %     ibx=str2double(get(handles.num_CorrBoxSize_1,'String'));
    1166 %     iby=str2double(get(handles.num_CorrBoxSize_2,'String'));
    1167 %     umin=dt*pxcm*umin;
    1168 %     umax=dt*pxcm*umax;
    1169 %     vmin=dt*pxcm*vmin;
    1170 %     vmax=dt*pxcm*vmax;
    11711103    shiftx=round((umin+umax)/2);
    11721104    shifty=round((vmin+vmax)/2);
     
    15551487        ind_A=2;
    15561488    end
    1557 %     [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name
    1558 %     if isequal(flag_mask,1)
    1559 %         filemask=[num2str(nbslice) 'mask'];
    1560 %         testmask=1;
    1561 %     else % browse for a mask
     1489 % browse for a mask
    15621490        filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image');
    15631491        [FilePath,FileName,Ext]=fileparts(filemask);   
     
    15701498        if ~isempty(filemask)
    15711499            testmask=1;
    1572          end
    1573 %     end
     1500        end
    15741501end
    15751502if testmask
     
    21942121%'nomtype2pair': creates nomencalture for index pairs knowing the image nomenclature
    21952122%---------------------------------------------------------------------
    2196 function NomTypeNc=nomtype2pair(NomTypeIma,mode)
     2123function NomTypeNc=nomtype2pair(NomTypeIma,mode_selected)
    21972124%---------------------------------------------------------------------           
    21982125% OUTPUT:
     
    22032130
    22042131NomTypeNc=NomTypeIma;%default
    2205 switch mode
     2132switch mode_selected
    22062133    case 'pair j1-j2'     
    22072134    if ~isempty(regexp(NomTypeIma,'a$'))
     
    22322159%------------------------------------------------------------------------
    22332160% --- determine the list of index pairs of processing file
    2234 function [ind1,ind2,mode]=...
     2161function [ind1,ind2,mode_selected]=...
    22352162    find_pair_indices(str_civ,i_series,j_series,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j)
    22362163%------------------------------------------------------------------------
     
    22392166r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names');
    22402167if ~isempty(r)
    2241     mode=['D' r.ind];
     2168    mode_selected=['D' r.ind];
    22422169    ind1=stra2num(r.num1);
    22432170    ind2=stra2num(r.num2);
    22442171else
    2245     mode='burst';
     2172    mode_selected='burst';
    22462173    r=regexp(str_civ,'^j= (?<num1>[a-z])-(?<num2>[a-z])','names');
    22472174    if ~isempty(r)
     
    24022329function CheckCiv3_Callback(hObject, eventdata, handles)
    24032330
     2331% --- Executes on button press in CheckRefFile.
     2332function CheckRefFile_Callback(hObject, eventdata, handles)
     2333
     2334    hseries=findobj(allchild(0),'Tag','series');
     2335    hhseries=guidata(hseries);
     2336    InputTable=get(hhseries.InputTable,'Data');
     2337    InputFile=fullfile(InputTable{1,1},InputTable{1,2},[InputTable{1,3} InputTable{1,5}]);
     2338 % browse for a reference file for displacement
     2339    fileref= uigetfile_uvmat('pick a reference image file:',InputFile);
     2340        if ~isempty(fileref)
     2341    set(handles.RefFile,'String',fileref)
     2342    set(handles.ConfigSource,'String','NEW')
     2343    set(handles.ConfigSource,'BackgroundColor',[1 0 1])
     2344        end
    24042345
    24052346%------------------------------------------------------------------------
     
    24142355    drawnow
    24152356end
    2416 
    2417 
    2418 
    2419 function num_NbSlice_Callback(hObject, eventdata, handles)
    2420 % hObject    handle to num_NbSlice (see GCBO)
    2421 % eventdata  reserved - to be defined in a future version of MATLAB
    2422 % handles    structure with handles and user data (see GUIDATA)
    2423 
    2424 % Hints: get(hObject,'String') returns contents of num_NbSlice as text
    2425 %        str2double(get(hObject,'String')) returns contents of num_NbSlice as a double
    2426 
    2427 
    2428 % --- Executes during object creation, after setting all properties.
    2429 function num_NbSlice_CreateFcn(hObject, eventdata, handles)
    2430 % hObject    handle to num_NbSlice (see GCBO)
    2431 % eventdata  reserved - to be defined in a future version of MATLAB
    2432 % handles    empty - handles not created until after all CreateFcns called
    2433 
    2434 % Hint: edit controls usually have a white background on Windows.
    2435 %       See ISPC and COMPUTER.
    2436 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    2437     set(hObject,'BackgroundColor','white');
    2438 end
Note: See TracChangeset for help on using the changeset viewer.