Changeset 851 for trunk/src/series


Ignore:
Timestamp:
Jan 19, 2015, 9:29:28 PM (9 years ago)
Author:
sommeria
Message:

various

Location:
trunk/src/series
Files:
5 edited

Legend:

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

    r850 r851  
    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
    6263set(handles.ref_i,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function
     64set(handles.ref_j,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function
    6365%set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function
    6466hseries=findobj(allchild(0),'Tag','series');% find the parent GUI 'series'
     
    106108ind_opening=0;%default
    107109NomTypeNc='';
     110NomTypeImaA=NomTypeInput;
     111iview_image=1;%line # for the input images
    108112switch FileType
    109113    case {'image','multimage','video','mmreader','netcdf'}
    110         NomTypeImaA=NomTypeInput;
    111         iview_image=1;%line # for the input images
     114%         NomTypeImaA=NomTypeInput;
     115%         iview_image=1;%line # for the input images
    112116    case 'civdata'
    113117        if ~strcmp(Param.Action.ActionName,'civ_series')
    114118            msgbox_uvmat('ERROR','bad input data file: open an image or a nc file from civ_series')
    115             %return
     119            return
    116120        end
    117121        NomTypeNc=NomTypeInput;
     
    122126            set(handles.ListCompareMode,'Value',1)
    123127        end
    124 %         FileInput=SeriesData.RefFile{1};
    125128        [Data,tild,tild,errormsg]=nc2struct(FileInfo.FileName,[]);
    126129        if ~isempty(errormsg)
     
    128131            return
    129132        end
    130         [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);
    131         [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);
     133        [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);%look for the source image A
     134        [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);%look for the source image B
    132135        if isfield(Data,'Civ2_ImageA')
    133136            [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA);
     
    147150        return
    148151end
    149 % if isfield(SeriesData,'FileType') && numel(SeriesData.FileType)>=2 && strcmp(SeriesData.FileType{end-1},'image') &&   strcmp(SeriesData.FileType{end},'image')
    150 %     set(handles.ListCompareMode,'Value',3)% we compare two image series term to term ('shift')
    151 %     set(handles.PairIndices,'Visible','off')
    152 % end
    153152
    154153%% reinitialise menus
     
    195194    end
    196195end
    197 % CivInputData.MaxIndex_i=MaxIndex_i;
    198 % CivInputData.MaxIndex_j=MaxIndex_j;
    199 % CivInputData.MinIndex_i=MinIndex_i;
    200 % CivInputData.MinIndex_j=MinIndex_j;
    201196if ~isfield(Param.IndexRange,'first_j')||isequal(MaxIndex_j,MinIndex_j)% no possibility of j pairs
    202197    set(handles.ListPairMode,'Value',1)
     
    227222    TimeUnit=Param.IndexRange.TimeUnit;
    228223end
    229 if isfield(SeriesData,'TimeSource')
    230     set(handles.ImaDoc,'String',SeriesData.TimeSource)
    231 end 
     224% if isfield(SeriesData,'TimeSource')
     225%     set(handles.TimeSource,'String',SeriesData.TimeSource)
     226% end 
    232227if isfield(SeriesData,'GeometryCalib')
    233228    tsai=SeriesData.GeometryCalib;
     
    250245    MaxIndex_i=min(size(time,1),MaxIndex_i);%possibly adjust the max index according to time data
    251246    MaxIndex_j=min(size(time,2),MaxIndex_j);
    252 else
    253     set(handles.ImaDoc,'String',''); %xml file not used for timing
     247    set(handles.TimeSource,'String',Param.IndexRange.TimeSource);
     248else
     249    set(handles.TimeSource,'String',''); %xml file not used for timing
    254250    TimeUnit='frame';
    255251    time=ones(MaxIndex_j-MinIndex_j+1,1)*(MinIndex_i:MaxIndex_i);
     
    264260set(handles.SearchRange,'UserData', pxcm_search);
    265261
     262% indicate the min and max indices i and j on the GUI
     263set(handles.MinIndex_i,'String',num2str(MinIndex_i))
     264set(handles.MaxIndex_i,'String',num2str(MaxIndex_i))
     265set(handles.MinIndex_j,'String',num2str(MinIndex_j))
     266set(handles.MaxIndex_j,'String',num2str(MaxIndex_j))
     267
     268
     269%% set the civ_input options, depending on the input file content if a nc file has been opened
     270ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'};
     271checkbox=zeros(size(ListOptions));%default
     272checkrefresh=0;
     273if ind_opening==0  %case of image opening, start with Civ1
     274    for index=1:numel(ListOptions)
     275        checkbox(index)=get(handles.(ListOptions{index}),'Value');
     276    end
     277    index_max=find(checkbox, 1, 'last' );
     278    if isempty(index_max),index_max=1;end
     279    for index=1:index_max
     280        set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1
     281    end
     282else  %case of netcdf file opening, start with the stage read in the file if the input file is being refreshed
     283    if isequal(get(hhseries.REFRESH,'BackgroundColor'),[1 1 0]) && ~isfield(Param.ActionInput,'ConfigSource')
     284        answer=msgbox_uvmat('INPUT_Y-N',['import the civ parameters from the netcdf file']);
     285        if strcmp(answer,'Yes')
     286            for index = 1:min(ind_opening,5)
     287                set(handles.(ListOptions{index}),'value',0)
     288                fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file
     289            end
     290            set(handles.ConfigSource,'String',FileInfo.FileName);
     291            set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)
     292            for index = ind_opening+2:6
     293                set(handles.(ListOptions{index}),'value',0)
     294            end
     295            checkrefresh=1;
     296        end
     297    end
     298    if ind_opening>=3
     299        set(handles.iterate,'Visible','on')% make visible the switch 'iterate/repet' for Civ2.
     300    else
     301        set(handles.iterate,'Visible','off')
     302    end
     303end
     304
    266305%% introduce the stored Civ parameters  if available (from previous input or ImportConfig in series)
    267 if isfield(Param,'ActionInput')&& strcmp(Param.ActionInput.Program,Param.Action.ActionName)% the program fits with the stored data
     306if ~checkrefresh && isfield(Param,'ActionInput')&& strcmp(Param.ActionInput.Program,Param.Action.ActionName)% the program fits with the stored data
    268307    fill_GUI(Param.ActionInput,hObject);%fill the GUI with the parameters retrieved from the input Param
    269308    hcheckgrid=findobj(handles.civ_input,'Tag','CheckGrid');
     
    283322    end
    284323end
    285 % indicate the min and max indices i and j on the GUI
    286 set(handles.MinIndex_i,'String',num2str(MinIndex_i))
    287 set(handles.MaxIndex_i,'String',num2str(MaxIndex_i))
    288 set(handles.MinIndex_j,'String',num2str(MinIndex_j))
    289 set(handles.MaxIndex_j,'String',num2str(MaxIndex_j))
    290 
    291 %% set the civ_input options, depending on the input file content if a nc file has been opened
    292 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'};
    293 checkbox=zeros(size(ListOptions));%default
    294 if ind_opening==0  %case of image opening, start with Civ1
    295     for index=1:numel(ListOptions)
    296         checkbox(index)=get(handles.(ListOptions{index}),'Value');
    297     end
    298     index_max=find(checkbox, 1, 'last' );
    299     if isempty(index_max),index_max=1;end
    300     for index=1:index_max
    301         set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1
    302     end
    303 else  %case of netcdf file opening, start with the stage read in the file
    304     for index = 1:min(ind_opening,5)
    305         set(handles.(ListOptions{index}),'value',0)     
    306         fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file
    307     end
    308     set(handles.ConfigSource,'String',FileInfo.FileName);
    309     set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)
    310     for index = ind_opening+2:6
    311         set(handles.(ListOptions{index}),'value',0)
    312     end
    313 end
    314324
    315325%% set the reference indices from the input file indices
     326if ~isfield(Param.ActionInput,'ConfigSource')
    316327update_CivOptions(handles,ind_opening)% fill the menu of possible pairs
     328end
    317329
    318330%% list the possible index pairs, depending on the option set in ListPairMode
     
    346358    delete(handles.civ_input);
    347359end
     360
     361%------------------------------------------------------------------------
     362% --- Executes on button press in SetDefaultParam.
     363%------------------------------------------------------------------------
     364function SetDefaultParam_Callback(hObject, eventdata, handles)
     365   
     366hseries=findobj(allchild(0),'Name','series');% look for the GUI series
     367hhseries=guidata(hseries);%handles of elements in the GUI series
     368SeriesData=get(hseries,'UserData');%read parameters on the GUI series
     369if isfield (SeriesData,'ActionInput')
     370    SeriesData=rmfield(SeriesData,'ActionInput');% remove recorded civ parameters
     371end
     372set(hseries,'UserData',SeriesData)
     373series('ActionName_Callback',hObject,eventdata,hhseries); %
    348374
    349375% -----------------------------------------------------------------------
     
    438464function update_CivOptions(handles,opening)
    439465%------------------------------------------------------------------------
     466if opening>0
     467    set(handles.CheckCiv2,'UserData',opening)% store the info on the current status of the civ processing
     468end
    440469checkbox=zeros(1,6);
    441470checkbox(1)=get(handles.CheckCiv1,'Value');
     
    445474checkbox(5)=get(handles.CheckFix2,'Value');
    446475checkbox(6)=get(handles.CheckPatch2,'Value');
    447 % ind_selected=find(checkbox,1);
    448 %set(handles.PairIndices,'Visible','on')% make the frame PaiIndices visible, choice of the index pairs fo civ
    449476if opening==0
    450477    errormsg=find_netcpair_civ(handles,1); % select the available netcdf files
     
    453480    end
    454481end
    455 if max(checkbox(4:6))% case of civ2 pair choice needed
     482if max(checkbox(4:6))>0% case of civ2 pair choice needed
    456483    set(handles.TitlePairCiv2,'Visible','on')
    457484    set(handles.ListPairCiv2,'Visible','on')
     
    465492    set(handles.ListPairCiv2,'Visible','off')
    466493end
     494if max(checkbox(1:3))==0 && get(handles.CheckCiv2,'UserData')==6,% no operation asked before Civ2 and input file ready for civ3
     495    set(handles.iterate,'Visible','on')
     496else
     497    set(handles.iterate,'Visible','off')
     498end
     499
     500%% set the visibility of the different panels
    467501options={'Civ1','Fix1','Patch1','Civ2','Fix2','Patch2'};
    468502for ilist=1:length(options)
     
    479513%------------------------------------------------------------------------
    480514
    481 handles.output.ActionInput=read_GUI(handles.civ_input);
     515ActionInput=read_GUI(handles.civ_input);
     516
     517%% correct inpput inconsistencies
     518if isfield(ActionInput,'Civ1')
     519    checkeven=(mod(ActionInput.Civ1.CorrBoxSize,2)==0);
     520    ActionInput.Civ1.CorrBoxSize(checkeven)=ActionInput.Civ1.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values
     521    ActionInput.Civ1.SearchBoxSize=max(ActionInput.Civ1.SearchBoxSize,ActionInput.Civ1.CorrBoxSize+10);% insure that the search box size is large enough
     522    checkeven=(mod(ActionInput.Civ1.SearchBoxSize,2)==0);
     523    ActionInput.Civ1.SearchBoxSize(checkeven)=ActionInput.Civ1.SearchBoxSize(checkeven)+1;% set search box sizes to odd values
     524end
     525if isfield(ActionInput,'Civ2')
     526    checkeven=(mod(ActionInput.Civ2.CorrBoxSize,2)==0);
     527    ActionInput.Civ2.CorrBoxSize(checkeven)=ActionInput.Civ2.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values
     528    ActionInput.Civ2.SearchBoxSize=max(ActionInput.Civ2.SearchBoxSize,ActionInput.Civ2.CorrBoxSize+10);
     529    checkeven=(mod(ActionInput.Civ2.SearchBoxSize,2)==0);
     530    ActionInput.Civ2.SearchBoxSize(checkeven)=ActionInput.Civ2.SearchBoxSize(checkeven)+1;% set search box sizes to odd values
     531end
     532
     533handles.output.ActionInput=ActionInput;
    482534% correct mask or grid name for Windows system (replace '\' by '/')
    483535if isfield(handles.output.ActionInput,'Civ1')
     
    500552uiresume(handles.civ_input);
    501553
    502 % %------------------------------------------------------------------------
    503 % % --- determine the list of index pairs of processing file
    504 % function [i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2]=...
    505 %     find_pair_indices(handles,ref_i,ref_j,mode)
    506 % %------------------------------------------------------------------------
    507 %
    508 % list_civ1=get(handles.ListPairCiv1,'String');
    509 % index_civ1=get(handles.ListPairCiv1,'Value');
    510 % str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1
    511 % if isempty(str_civ1)||isequal(str_civ1,'')
    512 %     msgbox_uvmat('ERROR','no image pair selected for civ1')
    513 %     return
    514 % end
    515 % list_civ2=get(handles.ListPairCiv2,'String');
    516 % index_civ2=get(handles.ListPairCiv2,'Value');
    517 % if index_civ2>length(list_civ2)
    518 %     list_civ2=list_civ1;
    519 %     index_civ2=index_civ1;
    520 % end
    521 % str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2
    522 %
    523 % if isequal (mode,'series(Di)')
    524 %     lastfield=str2double(get(handles.MaxIndex_i,'String'));
    525 %     i1_civ1=ref_i-floor(index_civ1/2)*ones(size(ref_i));% set of first image numbers
    526 %     i2_civ1=ref_i+ceil(index_civ1/2)*ones(size(ref_i));
    527 %     j1_civ1=ref_j;
    528 %     j2_civ1=ref_j;
    529 %     i1_civ2=ref_i-floor(index_civ2/2)*ones(size(ref_i));
    530 %     i2_civ2=ref_i+ceil(index_civ2/2)*ones(size(ref_i));
    531 %     j1_civ2=ref_j;
    532 %     j2_civ2=ref_j;
    533 %     
    534 %     % adjust the first and last field number
    535 %     lastfield=str2double(get(handles.MaxIndex_i,'String'));
    536 %     if isnan(lastfield)
    537 %         indsel=find((i1_civ1 >= 1)&(i1_civ2 >= 1));
    538 %     else
    539 %         indsel=find((i2_civ1 <= lastfield)&(i2_civ2 <= lastfield)&(i1_civ1 >= 1)&(i1_civ2 >= 1));
    540 %     end
    541 %     if length(indsel)>=1
    542 %         firstind=indsel(1);
    543 %         lastind=indsel(end);
    544 %         set(handles.MinIndex_i,'String',num2str(ref_i(firstind)))%update the display of first and last fields
    545 %         set(handles.last_i,'String',num2str(ref_i(lastind)))
    546 %         ref_i=ref_i(indsel);
    547 %         i1_civ1=i1_civ1(indsel);
    548 %         i1_civ2=i1_civ2(indsel);
    549 %         i2_civ1=i2_civ1(indsel);
    550 %         i2_civ2=i2_civ2(indsel);
    551 %     end
    552 % elseif isequal (mode,'series(Dj)')
    553 %     lastfield_j=str2double(get(handles.MaxIndex_j,'String'));
    554 %     i1_civ1=ref_i;% set of first image numbers
    555 %     i2_civ1=ref_i;
    556 %     j1_civ1=ref_j-floor(index_civ1/2)*ones(size(ref_j));
    557 %     j2_civ1=ref_j+ceil(index_civ1/2)*ones(size(ref_j));
    558 %     i1_civ2=ref_i;
    559 %     i2_civ2=ref_i;
    560 %     j1_civ2=ref_j-floor(index_civ2/2)*ones(size(ref_j));
    561 %     j2_civ2=ref_j+ceil(index_civ2/2)*ones(size(ref_j));
    562 %     % adjust the first and last field number
    563 %     if isnan(lastfield_j)
    564 %         indsel=find((j1_civ1 >= 1)&(j1_civ2 >= 1));
    565 %     else
    566 %         indsel=find((j2_civ1 <= lastfield_j)&(j2_civ2 <= lastfield_j)&(j1_civ1 >= 1)&(j1_civ2 >= 1));
    567 %     end
    568 %     if length(indsel)>=1
    569 %         firstind=indsel(1);
    570 %         lastind=indsel(end);
    571 %         set(handles.MinIndex_j,'String',num2str(ref_j(firstind)))%update the display of first and last fields
    572 %         set(handles.last_j,'String',num2str(ref_j(lastind)))
    573 %         ref_j=ref_j(indsel);
    574 %         j1_civ1=j1_civ1(indsel);
    575 %         j2_civ1=j2_civ1(indsel);
    576 %         j1_civ2=j1_civ2(indsel);
    577 %         j2_civ2=j2_civ2(indsel);
    578 %     end
    579 % elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)
    580 %     displ_num=get(handles.ListPairCiv1,'UserData');
    581 %     i1_civ1=ref_i;
    582 %     i2_civ1=ref_i;
    583 %     j1_civ1=displ_num(1,index_civ1);
    584 %     j2_civ1=displ_num(2,index_civ1);
    585 %     i1_civ2=ref_i;
    586 %     i2_civ2=ref_i;
    587 %     j1_civ2=displ_num(1,index_civ2);
    588 %     j2_civ2=displ_num(2,index_civ2);
    589 % elseif isequal(mode,'displacement')
    590 %     i1_civ1=ref_i;
    591 %     i2_civ1=ref_i;
    592 %     j1_civ1=ref_j;
    593 %     j2_civ1=ref_j;
    594 %     i1_civ2=ref_i;
    595 %     i2_civ2=ref_i;
    596 %     j1_civ2=ref_j;
    597 %     j2_civ2=ref_j;
    598 % end
    599554
    600555%------------------------------------------------------------------------
     
    794749function ListPairCiv2_Callback(hObject, eventdata, handles)
    795750%------------------------------------------------------------------------
    796 % index_pair=get(handles.ListPairCiv2,'Value');%get the selected position index in the menu
    797 %
    798 % %update MinIndex_i and last_i according to the chosen image pairs
    799 % mode_list=get(handles.ListPairMode,'String');
    800 % mode_value=get(handles.ListPairMode,'Value');
    801 % mode=mode_list{mode_value};
    802 % if isequal(mode,'series(Di)')
    803 %     first_i=str2double(get(handles.MinIndex_i,'String'));
    804 %     last_i=str2double(get(handles.MaxIndex_i,'String'));
    805 %     incr_i=str2double(get(handles.incr_i,'String'));
    806 %     num_i=first_i:incr_i:last_i;
    807 %    % lastfield=str2double(get(handles.MaxIndex_i,'String'));
    808 %     if ~isnan(last_i)
    809 %         test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ...
    810 %             (num_i+ceil(index_pair/2)*ones(size(num_i))<=last_i);
    811 %         num_i=num_i(test_find);
    812 %     end
    813 %     set(handles.MinIndex_i,'String',num2str(num_i(1)));
    814 %     set(handles.MaxIndex_i,'String',num2str(num_i(end)));
    815 % elseif isequal(mode,'series(Dj)')
    816 %     first_j=str2double(get(handles.MinIndex_j,'String'));
    817 %     last_j=str2double(get(handles.last_j,'String'));
    818 %     incr_j=str2double(get(handles.incr_j,'String'));
    819 %     num_j=first_j:incr_j:last_j;
    820 %     lastfield2=str2double(get(handles.MaxIndex_j,'String'));
    821 %     if ~isnan(lastfield2)
    822 %         test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...
    823 %             (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2);
    824 %         num_j=num_j(test_find);
    825 %     end
    826 %     set(handles.MinIndex_j,'String',num2str(num_j(1)));
    827 %     set(handles.last_j,'String',num2str(num_j(end)));
    828 % end
     751
    829752
    830753%------------------------------------------------------------------------
     
    839762    errormsg=find_netcpair_civ( handles,2);
    840763end
    841     if ~isempty(errormsg)
     764if isempty(errormsg)
     765    set(handles.ref_i,'BackgroundColor',[1 1 1])
     766else
    842767    msgbox_uvmat('ERROR',errormsg)
    843     end
    844 
    845 %------------------------------------------------------------------------
    846 function ref_j_Callback(hObject, eventdata, handles)
    847 %------------------------------------------------------------------------
    848 mode_list=get(handles.ListPairMode,'String');
    849 mode_value=get(handles.ListPairMode,'Value');
    850 mode=mode_list{mode_value};
    851 errormsg='';
    852 if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)')
    853     errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files
    854 end
    855 if isequal(mode,'series(Dj)') || ...
    856         (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
    857     errormsg=find_netcpair_civ(handles,2);
    858 end
    859 if ~isempty(errormsg)
    860     msgbox_uvmat('ERROR',errormsg)
    861 end
    862 
     768end
     769
     770function ref_i_KeyPressFcn(hObject, eventdata, handles)
     771set(hObject,'BackgroundColor',[1 0 1])
     772       
     773% %------------------------------------------------------------------------
     774% function ref_j_Callback(hObject, eventdata, handles)
     775% %------------------------------------------------------------------------
     776% mode_list=get(handles.ListPairMode,'String');
     777% mode_value=get(handles.ListPairMode,'Value');
     778% mode=mode_list{mode_value};
     779% errormsg='';
     780% if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)')
     781%     errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files
     782% end
     783% if isequal(mode,'series(Dj)') || ...
     784%         (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
     785%     errormsg=find_netcpair_civ(handles,2);
     786% end
     787% if ~isempty(errormsg)
     788%     msgbox_uvmat('ERROR',errormsg)
     789% end
     790%
     791% function ref_j_KeyPressFcn(hObject, eventdata, handles)
     792% set(handles.ref_j,'BackgroundColor',[1 0 1])
    863793%------------------------------------------------------------------------
    864794% determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of
     
    10961026    index=get(handles.ListPairCiv1,'Value');
    10971027    pair_string=list_pair{index};
    1098     time=get(handles.ImaDoc,'UserData'); %get the set of times
     1028    time=get(handles.TimeSource,'UserData'); %get the set of times
    10991029    pxcm=get(handles.SearchRange,'UserData');
    11001030    mode_list=get(handles.ListPairMode,'String');
     
    11431073end
    11441074
     1075%------------------------------------------------------------------------
     1076% --- Executes on button press in CheckMask.
     1077function num_CorrSmooth_Callback(hObject, eventdata, handles)
     1078set(hObject,'BackgroundColor',[1 0 1])
     1079set(handles.configSource,'String','NEW')
     1080
     1081%------------------------------------------------------------------------
     1082
    11451083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    11461084% Callbacks in the uipanel Fix1
    11471085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    11481086%------------------------------------------------------------------------
    1149 % --- Executes on button press in CheckMask.
    1150 function get_mask_fix1_Callback(hObject, eventdata, handles)
     1087% % --- Executes on button press in CheckMask.
     1088% function get_mask_fix1_Callback(hObject, eventdata, handles)
     1089% %------------------------------------------------------------------------
     1090% maskval=get(handles.CheckMask,'Value');
     1091% if isequal(maskval,0)
     1092%     set(handles.Mask,'String','')
     1093% else
     1094%     mask_displ='no mask'; %default
     1095%     filebase=get(handles.RootPath,'String');
     1096%     [nbslice, flag_mask]=get_mask(filebase,handles);
     1097%     if isequal(flag_mask,1)
     1098%         mask_displ=[num2str(nbslice) 'mask'];
     1099%     elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
     1100%         filebase_a=get(handles.RootFile_1,'String');
     1101%         [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
     1102%         if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)
     1103%             mask_displ='no mask';
     1104%         end
     1105%     end
     1106%     if isequal(mask_displ,'no mask')
     1107%         [FileName, PathName, filterindex] = uigetfile( ...
     1108%             {'*.png', ' (*.png)';
     1109%             '*.png',  '.png files '; ...
     1110%             '*.*', 'All Files (*.*)'}, ...
     1111%             'Pick a mask file *.png',filebase);
     1112%         mask_displ=fullfile(PathName,FileName);
     1113%         if ~exist(mask_displ,'file')
     1114%             mask_displ='no mask';
     1115%         end
     1116%     end
     1117%     if isequal(mask_displ,'no mask')
     1118%         set(handles.CheckMask,'Value',0)
     1119%         set(handles.CheckMask,'Value',0)
     1120%         set(handles.CheckMask,'Value',0)
     1121%     else
     1122%         %set(handles.CheckMask,'Value',1)
     1123%         set(handles.CheckMask,'Value',1)
     1124%     end
     1125%     set(handles.Mask,'String',mask_displ)
     1126%     set(handles.Mask,'String',mask_displ)
     1127%     set(handles.Mask,'String',mask_displ)
     1128% end
     1129
     1130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     1131% Callbacks in the uipanel Civ2
     1132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     1133%------------------------------------------------------------------------
     1134% --- Executes on button press in CheckMask: select box for mask option
     1135function get_mask_civ2_Callback(hObject, eventdata, handles)
    11511136%------------------------------------------------------------------------
    11521137maskval=get(handles.CheckMask,'Value');
     
    11801165        set(handles.CheckMask,'Value',0)
    11811166        set(handles.CheckMask,'Value',0)
    1182         set(handles.CheckMask,'Value',0)
    1183     else
    1184         %set(handles.CheckMask,'Value',1)
    1185         set(handles.CheckMask,'Value',1)
    1186     end
    1187     set(handles.Mask,'String',mask_displ)
    1188     set(handles.Mask,'String',mask_displ)
    1189     set(handles.Mask,'String',mask_displ)
    1190 end
    1191 
    1192 %------------------------------------------------------------------------
    1193 % --- Executes on button press in CheckMask: select box for mask option
    1194 function get_mask_civ2_Callback(hObject, eventdata, handles)
    1195 %------------------------------------------------------------------------
    1196 maskval=get(handles.CheckMask,'Value');
    1197 if isequal(maskval,0)
    1198     set(handles.Mask,'String','')
    1199 else
    1200     mask_displ='no mask'; %default
    1201     filebase=get(handles.RootPath,'String');
    1202     [nbslice, flag_mask]=get_mask(filebase,handles);
    1203     if isequal(flag_mask,1)
    1204         mask_displ=[num2str(nbslice) 'mask'];
    1205     elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    1206         filebase_a=get(handles.RootFile_1,'String');
    1207         [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    1208         if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)
    1209             mask_displ='no mask';
    1210         end
    1211     end
    1212     if isequal(mask_displ,'no mask')
    1213         [FileName, PathName, filterindex] = uigetfile( ...
    1214             {'*.png', ' (*.png)';
    1215             '*.png',  '.png files '; ...
    1216             '*.*', 'All Files (*.*)'}, ...
    1217             'Pick a mask file *.png',filebase);
    1218         mask_displ=fullfile(PathName,FileName);
    1219         if ~exist(mask_displ,'file')
    1220             mask_displ='no mask';
    1221         end
    1222     end
    1223     if isequal(mask_displ,'no mask')
    1224         set(handles.CheckMask,'Value',0)
    1225         set(handles.CheckMask,'Value',0)
    12261167    else
    12271168        set(handles.CheckMask,'Value',1)
    12281169    end
    12291170    set(handles.Mask,'String',mask_displ)
    1230     set(handles.Mask,'String',mask_displ)
    1231 end
    1232 
    1233 %------------------------------------------------------------------------
    1234 % --- Executes on button press in CheckMask.
    1235 function get_mask_fix2_Callback(hObject, eventdata, handles)
    1236 %------------------------------------------------------------------------
    1237 maskval=get(handles.CheckMask,'Value');
    1238 if isequal(maskval,0)
    1239     set(handles.Mask,'String','')
    1240 else
    1241     mask_displ='no mask'; %default
    1242     filebase=get(handles.RootPath,'String');
    1243     [nbslice, flag_mask]=get_mask(filebase,handles);
    1244     if isequal(flag_mask,1)
    1245         mask_displ=[num2str(nbslice) 'mask'];
    1246     elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    1247         filebase_a=get(handles.RootFile_1,'String');
    1248         [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    1249         if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)
    1250             mask_displ='no mask';
    1251         end
    1252     end
    1253     if isequal(mask_displ,'no mask')
    1254         [FileName, PathName, filterindex] = uigetfile( ...
    1255             {'*.png', ' (*.png)';
    1256             '*.png',  '.png files '; ...
    1257             '*.*', 'All Files (*.*)'}, ...
    1258             'Pick a mask file *.png',filebase);
    1259         mask_displ=fullfile(PathName,FileName);
    1260         if ~exist(mask_displ,'file')
    1261             mask_displ='no mask';
    1262         end
    1263     end
    1264     if isequal(mask_displ,'no mask')
    1265         set(handles.CheckMask,'Value',0)
    1266     end
    1267     set(handles.Mask,'String',mask_displ)
    1268 end
     1171end
     1172
     1173% %------------------------------------------------------------------------
     1174% % --- Executes on button press in CheckMask.
     1175% function get_mask_fix2_Callback(hObject, eventdata, handles)
     1176% %------------------------------------------------------------------------
     1177% maskval=get(handles.CheckMask,'Value');
     1178% if isequal(maskval,0)
     1179%     set(handles.Mask,'String','')
     1180% else
     1181%     mask_displ='no mask'; %default
     1182%     filebase=get(handles.RootPath,'String');
     1183%     [nbslice, flag_mask]=get_mask(filebase,handles);
     1184%     if isequal(flag_mask,1)
     1185%         mask_displ=[num2str(nbslice) 'mask'];
     1186%     elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
     1187%         filebase_a=get(handles.RootFile_1,'String');
     1188%         [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
     1189%         if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)
     1190%             mask_displ='no mask';
     1191%         end
     1192%     end
     1193%     if isequal(mask_displ,'no mask')
     1194%         [FileName, PathName, filterindex] = uigetfile( ...
     1195%             {'*.png', ' (*.png)';
     1196%             '*.png',  '.png files '; ...
     1197%             '*.*', 'All Files (*.*)'}, ...
     1198%             'Pick a mask file *.png',filebase);
     1199%         mask_displ=fullfile(PathName,FileName);
     1200%         if ~exist(mask_displ,'file')
     1201%             mask_displ='no mask';
     1202%         end
     1203%     end
     1204%     if isequal(mask_displ,'no mask')
     1205%         set(handles.CheckMask,'Value',0)
     1206%     end
     1207%     set(handles.Mask,'String',mask_displ)
     1208% end
    12691209
    12701210%------------------------------------------------------------------------
     
    14751415    end
    14761416end
     1417set(hObject,'BackgroundColor',[1 0 1])
     1418set(handles.configSource,'String','NEW')
    14771419
    14781420%------------------------------------------------------------------------
     
    14911433    hhseries=guidata(hseries);
    14921434    InputTable=get(hhseries.InputTable,'Data');
    1493      ind_A=1;% line index of the (first) image series
     1435    ind_A=1;% line index of the (first) image series
    14941436    if strcmp(InputTable{1,5},'.nc');
    14951437        ind_A=2;
    14961438    end
    1497     [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name 
     1439    [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name
    14981440    if isequal(flag_mask,1)
    14991441        filemask=[num2str(nbslice) 'mask'];
    15001442        testmask=1;
    1501     else % browse for a mask 
    1502         filemask=get(hObject,'UserData');%look for previous mask name stored as UserData
    1503         if exist(filemask,'file')
    1504             filebase=filemask;
    1505         end
    1506         filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image'); 
     1443    else % browse for a mask
     1444%         filemask=get(hObject,'UserData');%look for previous mask name stored as UserData
     1445%         if exist(filemask,'file')
     1446%             filebase=filemask;
     1447%         end
     1448        filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image');
    15071449        set(hObject,'UserData',filemask);%store for future use
    15081450        if ~isempty(filemask)
     
    15121454end
    15131455if testmask
    1514    % if strcmp(parent_tag,'Civ1')
    1515         set(handles.Mask,'Visible','on')
    1516         set(handles.Mask,'String',filemask)
     1456    set(handles.Mask,'Visible','on')
     1457    set(handles.Mask,'String',filemask)
    15171458    set(handles.CheckMask,'Value',1)
    1518    % end
    15191459else
    15201460    set(hObject,'Value',0);
    15211461    set(handle_txtbox,'Visible','off')
    15221462end
    1523 
    1524 %------------------------------------------------------------------------
    1525 % --- Executes on button press in get_gridpatch1.
    1526 function get_gridpatch1_Callback(hObject, eventdata, handles)
    1527 %------------------------------------------------------------------------
    1528 filebase=get(handles.RootPath,'String');
    1529 [FileName, PathName, filterindex] = uigetfile( ...
    1530     {'*.grid', ' (*.grid)';
    1531     '*.grid',  '.grid files '; ...
    1532     '*.*', 'All Files (*.*)'}, ...
    1533     'Pick a file',filebase);
    1534 filegrid=fullfile(PathName,FileName);
    1535 set(handles.grid_patch1,'string',filegrid);
    1536 
    1537 
    1538 %------------------------------------------------------------------------
    1539 % --- Executes on button press in get_gridpatch2.
    1540 function get_gridpatch2_Callback(hObject, eventdata, handles)
    1541 %------------------------------------------------------------------------
    1542 
     1463set(hObject,'BackgroundColor',[1 0 1])
     1464set(handles.configSource,'String','NEW')
     1465
     1466% %------------------------------------------------------------------------
     1467% % --- Executes on button press in get_gridpatch1.
     1468% function get_gridpatch1_Callback(hObject, eventdata, handles)
     1469% %------------------------------------------------------------------------
     1470% filebase=get(handles.RootPath,'String');
     1471% [FileName, PathName, filterindex] = uigetfile( ...
     1472%     {'*.grid', ' (*.grid)';
     1473%     '*.grid',  '.grid files '; ...
     1474%     '*.*', 'All Files (*.*)'}, ...
     1475%     'Pick a file',filebase);
     1476% filegrid=fullfile(PathName,FileName);
     1477% set(handles.grid_patch1,'string',filegrid);
     1478% set(hObject,'BackgroundColor',[1 0 1])
    15431479
    15441480%------------------------------------------------------------------------
     
    17421678    set(obj,'Visible','off')
    17431679end
    1744 
     1680set(hObject,'BackgroundColor',[1 0 1])
     1681set(handles.configSource,'String','NEW')
    17451682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    17461683%%%%%%%%%%%%%%   TEST functions
     
    18721809end
    18731810
    1874 
     1811%------------------------------------------------------------------------
    18751812% --- Executes on button press in TestCiv2.
     1813%------------------------------------------------------------------------
    18761814function TestCiv2_Callback(hObject, eventdata, handles)
     1815drawnow
     1816if get(handles.TestCiv2,'Value')
     1817    set(handles.TestCiv2,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch
     1818    % TO UPDATE TO UPDATE TO UPDATE TO UPDATE
     1819    [Data,Param.Civ2]=get_param_civ2(handles);
     1820    Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV
     1821    hview_field=view_field(Data); %view the image in the GUI view_field
     1822    set(0,'CurrentFigure',hview_field)
     1823    hhview_field=guihandles(hview_field);
     1824    set(hview_field,'CurrentAxes',hhview_field.PlotAxes)
     1825    ViewData=get(hview_field,'UserData');
     1826    ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field
     1827    ViewData.PlotAxes.B=imread(Param.Civ1.ImageName_B);%store the second image in the UserData of the GUI view_field
     1828    ViewData.PlotAxes.X=Grid.Civ1_X; %keep the set of points in memeory
     1829    ViewData.PlotAxes.Y=Grid.Civ1_Y;
     1830    set(hview_field,'UserData',ViewData)
     1831    corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
     1832    if isempty(corrfig)
     1833        corrfig=figure;
     1834        set(corrfig,'tag','corrfig')
     1835        set(corrfig,'name','image correlation')
     1836        set(corrfig,'DeleteFcn',{@closeview_field})%
     1837        % end
     1838        set(handles.TestCiv1,'BackgroundColor',[1 0 0])
     1839    else
     1840        set(handles.TestCiv1,'BackgroundColor',[1 0 0])% paint button to red
     1841        corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
     1842        if ~isempty(corrfig)
     1843            delete(corrfig)
     1844        end
     1845        hview_field=findobj(allchild(0),'tag','view_field');% look for view_field
     1846        if ~isempty(hview_field)
     1847            delete(hview_field)
     1848        end
     1849    end
     1850else
     1851    hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field
     1852    if ~isempty(hview_field)
     1853        delete(hview_field)
     1854    end     
     1855end
    18771856
    18781857
     
    20402019end
    20412020
    2042 
    2043 % % --- Executes on key press with focus on civ_input and none of its controls.
    2044  function keyboard_callback(hObject,eventdata,handles)
    2045 set(handles.ConfigSource,'String','NEW')% indicate that param have been modified
    20462021
    20472022%------------------------------------------------------------------------
     
    21042079 par_civ1.ImageName_B=ImageName_B;
    21052080
     2081%------------------------------------------------------------------------
    21062082% --- Executes on button press in InportParam.
     2083%------------------------------------------------------------------------
    21072084function InportParam_Callback(hObject, eventdata, handles)
    21082085hseries=findobj(allchild(0),'Tag','series');
     
    21462123end
    21472124
    2148 
    21492125% --- Executes on selection change in iterate.
    21502126function iterate_Callback(hObject, eventdata, handles)
    2151 
     2127   
     2128%------------------------------------------------------------------------
     2129% --- Executes on key press with selection of a uicontrol
     2130%------------------------------------------------------------------------
     2131function keyboard_callback(hObject,eventdata,handles)
     2132   
     2133ListExclude={'CheckCiv1','CheckFix1','CheckPatch1','CheckCiv2','CheckFix2','CheckPatch2','ref_i'};
     2134if isempty(find(strcmp(get(gco,'Tag'),ListExclude),1))% if the selected uicontrol is not in the Exclude list
     2135    set(gco,'BackgroundColor',[1 0 1])
     2136    drawnow
     2137    set(handles.ConfigSource,'String','NEW')% indicate that the configuration is new
     2138end
  • trunk/src/series/civ_series.m

    r833 r851  
    6464    Data.OutputSubDirMode='last'; %select the last subDir in the input table as root of the output subdir name (option 'all'/'first'/'last', 'all' by default)
    6565    Data.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar)
    66         % check the existence of the first file in the series: suppressed
    67 %     first_j=[];
    68 %     if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
    69 %     last_j=[];
    70 %     if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end
    71 %     PairString='';
    72 %     if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end
    7366    return
    7467end
     
    571564        end     
    572565       
    573         ncfile=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1,i2,...
    574             j1,j2);
     566        ncfile=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1,i2,j1,j2);
    575567        par_civ2.ImageWidth=FileInfo_A.Width;
    576568        par_civ2.ImageHeight=FileInfo_A.Height;
     
    599591            DVDY=zeros(size(par_civ2.Grid,1),1);
    600592        end
    601         NbSubDomain=size(Data.Civ1_SubRange,3);
    602         % get the guess from patch1
     593       
     594         % get the guess from patch1 or patch2 (case 'iterate')
     595        if isfield (par_civ2,'iterate') && strcmp(par_civ2.iterate,'iterate')
     596           SubRange= Data.Civ2_SubRange;
     597           NbCentres=Data.Civ2_NbCentres;
     598           Coord_tps=Data.Civ2_Coord_tps;
     599           U_tps=Data.Civ2_U_tps;
     600           V_tps=Data.Civ2_V_tps;
     601           CivStage=Data.CivStage;
     602           Civ1_Dt=Data.Civ2_Dt;
     603           Data=[];%reinitialise the result structure Data
     604           Data.ListGlobalAttribute={'Conventions','Program','CivStage'};
     605           Data.Conventions='uvmat/civdata';% states the conventions used for the description of field variables and attributes
     606           Data.Program='civ_series';
     607           Data.CivStage=CivStage;
     608           Data.ListVarName={};
     609           Data.VarDimName={};
     610        else
     611           SubRange= Data.Civ1_SubRange;
     612           NbCentres=Data.Civ1_NbCentres;
     613           Coord_tps=Data.Civ1_Coord_tps;
     614           U_tps=Data.Civ1_U_tps;
     615           V_tps=Data.Civ1_V_tps;
     616           Civ1_Dt=Data.Civ1_Dt;
     617        end
     618        NbSubDomain=size(SubRange,3);       
    603619        for isub=1:NbSubDomain% for each sub-domain of Patch1
    604             nbvec_sub=Data.Civ1_NbCentres(isub);% nbre of Civ1 vectors in the subdomain
    605             ind_sel=find(par_civ2.Grid(:,1)>=Data.Civ1_SubRange(1,1,isub) & par_civ2.Grid(:,1)<=Data.Civ1_SubRange(1,2,isub) &...
    606                 par_civ2.Grid(:,2)>=Data.Civ1_SubRange(2,1,isub) & par_civ2.Grid(:,2)<=Data.Civ1_SubRange(2,2,isub));
     620            nbvec_sub=NbCentres(isub);% nbre of Civ vectors in the subdomain
     621            ind_sel=find(par_civ2.Grid(:,1)>=SubRange(1,1,isub) & par_civ2.Grid(:,1)<=SubRange(1,2,isub) &...
     622                par_civ2.Grid(:,2)>=SubRange(2,1,isub) & par_civ2.Grid(:,2)<=SubRange(2,2,isub));
    607623            epoints = par_civ2.Grid(ind_sel,:);% coordinates of interpolation sites
    608             ctrs=Data.Civ1_Coord_tps(1:nbvec_sub,:,isub) ;%(=initial points) ctrs
     624            ctrs=Coord_tps(1:nbvec_sub,:,isub) ;%(=initial points) ctrs
    609625            nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap)
    610             EM = tps_eval(epoints,ctrs);
    611             Shiftx(ind_sel)=Shiftx(ind_sel)+EM*Data.Civ1_U_tps(1:nbvec_sub+3,isub);
    612             Shifty(ind_sel)=Shifty(ind_sel)+EM*Data.Civ1_V_tps(1:nbvec_sub+3,isub);
     626            EM = tps_eval(epoints,ctrs);               
     627            Shiftx(ind_sel)=Shiftx(ind_sel)+EM*U_tps(1:nbvec_sub+3,isub);
     628            Shifty(ind_sel)=Shifty(ind_sel)+EM*V_tps(1:nbvec_sub+3,isub);
    613629            if par_civ2.CheckDeformation
    614630                [EMDX,EMDY] = tps_eval_dxy(epoints,ctrs);%2D matrix of distances between extrapolation points epoints and spline centres (=site points) ctrs
    615                 DUDX(ind_sel)=DUDX(ind_sel)+EMDX*Data.Civ1_U_tps(1:nbvec_sub+3,isub);
    616                 DUDY(ind_sel)=DUDY(ind_sel)+EMDY*Data.Civ1_U_tps(1:nbvec_sub+3,isub);
    617                 DVDX(ind_sel)=DVDX(ind_sel)+EMDX*Data.Civ1_V_tps(1:nbvec_sub+3,isub);
    618                 DVDY(ind_sel)=DVDY(ind_sel)+EMDY*Data.Civ1_V_tps(1:nbvec_sub+3,isub);
     631                DUDX(ind_sel)=DUDX(ind_sel)+EMDX*U_tps(1:nbvec_sub+3,isub);
     632                DUDY(ind_sel)=DUDY(ind_sel)+EMDY*U_tps(1:nbvec_sub+3,isub);
     633                DVDX(ind_sel)=DVDX(ind_sel)+EMDX*V_tps(1:nbvec_sub+3,isub);
     634                DVDY(ind_sel)=DVDY(ind_sel)+EMDY*V_tps(1:nbvec_sub+3,isub);
    619635            end
    620636        end
     
    628644        par_civ2.SearchBoxSize(2)=2*iby2+9;
    629645        Civ2_Dt=time(i2+1,j2+1)-time(i1+1,j1+1);
    630         par_civ2.SearchBoxShift=(Civ2_Dt/Data.Civ1_Dt)*[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)];
     646        par_civ2.SearchBoxShift=(Civ2_Dt/Civ1_Dt)*[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)];
    631647        par_civ2.Grid=[par_civ2.Grid(nbval>=1,1)-par_civ2.SearchBoxShift(:,1)/2 par_civ2.Grid(nbval>=1,2)-par_civ2.SearchBoxShift(:,2)/2];% grid taken at the extrapolated origin of the displacement vectors
    632648        if par_civ2.CheckDeformation
     
    636652            par_civ2.DVDY=DVDY./nbval;
    637653        end
    638         % caluclate velocity data (y and v in indices, reverse to y component)
     654        % calculate velocity data (y and v in indices, reverse to y component)
    639655        [xtable ytable utable vtable ctable F] = civ (par_civ2);
    640656        list_param=(fieldnames(Param.ActionInput.Civ2))';
  • trunk/src/series/extract_rdvision.m

    r844 r851  
    8181%     InputTable(:,2)=ListDir';
    8282    isel=0;
     83    InputTable=Param.InputTable;
    8384    for ilist=1:numel(ListDir)
    8485        ListStructSub=dir(fullfile(RootPath,ListDir{ilist}));
  • trunk/src/series/stereo_civ.m

    r846 r851  
    595595        Data.Civ2_FF(ind_good)=FFres;
    596596        Data.CivStage=Data.CivStage+1;
     597       
     598       
     599% %         
     600% %          % get z from u and v (displacements)
     601% %       
     602%         Data.Xphys=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ2_X-0.5)/(Npx-1);
     603%         Data.Yphys=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ2_Y-0.5)/(Npy-1);
     604%         U=Data.Civ2_U_smooth*(Rangx(2)-Rangx(1))/(Npx-1);
     605%         V=Data.Civ2_V_smooth*(Rangy(2)-Rangy(1))/(Npy-1);
     606%         [Data.Zphys,Data.Civ1_E]=shift2z(Data.Xphys,Data.Yphys,U,V,XmlData);
     607% %         if ~isempty(errormsg)
     608% %             disp_uvmat('ERROR',errormsg,checkrun)
     609% %             return
     610% %         end
     611       
    597612    end
    598613   
     
    821836                utable(ivec)=vector(1)*mesh+shiftx(ivec);
    822837                vtable(ivec)=vector(2)*mesh+shifty(ivec);
    823                 xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2)
    824                 ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge)
     838%                 xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2)
     839%                 ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge)
    825840                iref=round(xtable(ivec));% image index for the middle of the vector
    826841                jref=round(ytable(ivec));
     
    10341049error=0;
    10351050
     1051
    10361052%% first image
    10371053Calib_A=XmlData{1}.GeometryCalib;
    10381054R=(Calib_A.R)';
    1039 x_a=xmid- u/2;
    1040 y_a=ymid- v/2;
    1041 z_a=R(7)*x_a+R(8)*y_a+R(9)*Calib_A.SliceCoord(1,3);
    1042 X=(R(1)*x_a+R(2)*y_a+R(3)*Calib_A.SliceCoord(1,3))./z_a;
    1043 Y=(R(4)*x_a+R(5)*y_a+R(6)*Calib_A.SliceCoord(1,3))./z_a;
    1044 A_1_1=R(1)-R(7)*x_a;
    1045 A_1_2=R(2)-R(8)*x_a;
    1046 A_1_3=R(3)-R(9)*x_a;
    1047 A_2_1=R(4)-R(7)*y_a;
    1048 A_2_2=R(5)-R(8)*y_a;
    1049 A_2_3=R(6)-R(9)*y_a;
     1055x_a=xmid-u/2;
     1056y_a=ymid-v/2;
     1057z_a=R(7)*x_a+R(8)*y_a+Calib_A.Tx_Ty_Tz(1,3);
     1058Xa=(R(1)*x_a+R(2)*y_a+Calib_A.Tx_Ty_Tz(1,1))./z_a;
     1059Ya=(R(4)*x_a+R(5)*y_a+Calib_A.Tx_Ty_Tz(1,2))./z_a;
     1060
     1061A_1_1=R(1)-R(7)*Xa;
     1062A_1_2=R(2)-R(8)*Xa;
     1063A_1_3=R(3)-R(9)*Xa;
     1064A_2_1=R(4)-R(7)*Ya;
     1065A_2_2=R(5)-R(8)*Ya;
     1066A_2_3=R(6)-R(9)*Ya;
    10501067Det=A_1_1.*A_2_2-A_1_2.*A_2_1;
    10511068Dxa=(A_1_2.*A_2_3-A_2_2.*A_1_3)./Det;
     
    10531070
    10541071%% second image
    1055 Calib_A=XmlData{1}.GeometryCalib;
    1056 R=(Calib_A.R)';
    1057 x_a=xmid+ u/2;
    1058 y_a=ymid+ v/2;
    1059 z_a=R(7)*x_a+R(8)*y_a+R(9)*Calib_A.SliceCoord(1,3);
    1060 X=(R(1)*x_a+R(2)*y_a+R(3)*Calib_A.SliceCoord(1,3))./z_a;
    1061 Y=(R(4)*x_a+R(5)*y_a+R(6)*Calib_A.SliceCoord(1,3))./z_a;
    1062 A_1_1=R(1)-R(7)*x_a;
    1063 A_1_2=R(2)-R(8)*x_a;
    1064 A_1_3=R(3)-R(9)*x_a;
    1065 A_2_1=R(4)-R(7)*y_a;
    1066 A_2_2=R(5)-R(8)*y_a;
    1067 A_2_3=R(6)-R(9)*y_a;
    1068 Det=A_1_1.*A_2_2-A_1_2.*A_2_1;
    1069 Dxb=(A_1_2.*A_2_3-A_2_2.*A_1_3)./Det;
    1070 Dyb=(A_2_1.*A_1_3-A_1_1.*A_2_3)./Det;
     1072Calib_B=XmlData{2}.GeometryCalib;
     1073R=(Calib_B.R)';
     1074x_b=xmid+ u/2;
     1075y_b=ymid+ v/2;
     1076z_b=R(7)*x_b+R(8)*y_b+Calib_B.Tx_Ty_Tz(1,3);
     1077Xb=(R(1)*x_b+R(2)*y_b+Calib_B.Tx_Ty_Tz(1,1))./z_b;
     1078Yb=(R(4)*x_b+R(5)*y_b+Calib_B.Tx_Ty_Tz(1,2))./z_b;
     1079B_1_1=R(1)-R(7)*Xb;
     1080B_1_2=R(2)-R(8)*Xb;
     1081B_1_3=R(3)-R(9)*Xb;
     1082B_2_1=R(4)-R(7)*Yb;
     1083B_2_2=R(5)-R(8)*Yb;
     1084B_2_3=R(6)-R(9)*Yb;
     1085Det=B_1_1.*B_2_2-B_1_2.*B_2_1;
     1086Dxb=(B_1_2.*B_2_3-B_2_2.*B_1_3)./Det;
     1087Dyb=(B_2_1.*B_1_3-B_1_1.*B_2_3)./Det;
    10711088
    10721089%% result
     
    10741091error=((Dyb-Dya).*u-(Dxb-Dxa).*v)./Den;
    10751092z=((Dxb-Dxa).*u-(Dyb-Dya).*v)./Den;
     1093
Note: See TracChangeset for help on using the changeset viewer.