Ignore:
Timestamp:
Jan 26, 2015, 12:37:56 AM (9 years ago)
Author:
sommeria
Message:

civtest_implemented_civ2

File:
1 edited

Legend:

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

    r855 r856  
    165165    set(handles.ref_j,'String',num2str(Param.IndexRange.first_j))
    166166end
     167set(handles.ConfigSource,'String','\default')
    167168
    168169%%  set the menus of image pairs and default selection for civ_input   %%%%%%%%%%%%%%%%%%%
     
    340341set(handles.civ_input,'WindowStyle','modal')% Make the GUI modal
    341342drawnow
    342 uiwait(handles.civ_input);
     343uiwait(handles.civ_input);% wait for OK action to end the function
    343344
    344345
     
    368369%------------------------------------------------------------------------
    369370function SetDefaultParam_Callback(hObject, eventdata, handles)
    370    
    371 hseries=findobj(allchild(0),'Name','series');% look for the GUI series
    372 hhseries=guidata(hseries);%handles of elements in the GUI series
    373 SeriesData=get(hseries,'UserData');%read parameters on the GUI series
    374 if isfield (SeriesData,'ActionInput')
    375     SeriesData=rmfield(SeriesData,'ActionInput');% remove recorded civ parameters
    376 end
    377 set(hseries,'UserData',SeriesData)
    378 series('ActionName_Callback',hObject,eventdata,hhseries); %
     371
     372Param.ConfigSource='\default';
     373
     374%% Civ1 parameters
     375Param.Civ1.CorrBoxSize=[25 25];
     376Param.Civ1.SearchBoxSize=[55 55];
     377Param.Civ1.SearchBoxShift=[0 0];
     378Param.Civ1.CorrSmooth=1;
     379Param.Civ1.Dx=20;
     380Param.Civ1.Dy=20;
     381Param.Civ1.CheckGrid=0;
     382Param.Civ1.CheckMask=0;
     383Param.Civ1.CheckThreshold=0;
     384Param.Civ1.TestCiv1=0;
     385
     386%% Fix1 parameters
     387Param.Fix1.CheckFmin2=1;
     388Param.Fix1.CheckF3=1;
     389Param.Fix1.MinCorr=0.2000;
     390
     391%% Patch1 parameters
     392Param.Patch1.FieldSmooth=10;
     393Param.Patch1.MaxDiff=1.5000;
     394Param.Patch1.SubDomainSize=1000;
     395Param.Patch1.TestPatch1=0;
     396
     397%% Civ2 parameters
     398Param.Civ2.CorrBoxSize=[21 21];
     399Param.Civ2.SearchBoxSize=[31 31];
     400Param.Civ2.CorrSmooth=1;
     401Param.Civ2.Dx=10;
     402Param.Civ2.Dy=10;
     403Param.Civ2.CheckGrid=0;
     404Param.Civ2.CheckMask=0;
     405Param.Civ2.CheckThreshold=0;
     406Param.Civ2.TestCiv2=0;
     407
     408%% Fix2 parameters
     409Param.Fix2.CheckFmin2=1;
     410Param.Fix2.CheckF4=1;
     411Param.Fix2.CheckF3=1;
     412Param.Fix2.MinCorr=0.2000;
     413
     414%% Patch2 parameters
     415Param.Patch2.FieldSmooth=2;
     416Param.Patch2.MaxDiff=1.5000;
     417Param.Patch2.SubDomainSize=1000;
     418Param.Patch2.TestPatch2=0;
     419
     420fill_GUI(Param,handles.civ_input)% fill the elements of the GUI series with the input parameters
     421
     422%update_CivOptions(handles,0)
     423%set(handles.ConfigSource,'String','\default')
     424
     425% %Param=read_GUI(handles.civ_input)
     426% hseries=findobj(allchild(0),'Name','series');% look for the GUI series
     427% hhseries=guidata(hseries);%handles of elements in the GUI series
     428% SeriesData=get(hseries,'UserData');%read parameters on the GUI series
     429% if isfield (SeriesData,'ActionInput')
     430%     SeriesData=rmfield(SeriesData,'ActionInput');% remove recorded civ parameters
     431% end
     432% set(hseries,'UserData',SeriesData)
     433% %% exit the GUI and close it
     434% %handles.output.ActionInput=rmfield(ActionInput;
     435% guidata(hObject, handles);% Update handles structure
     436% uiresume(handles.civ_input);
     437% set(hhseries.ActionName,'BusyAction','cancel')
     438% series('ActionName_Callback',hObject,eventdata,hhseries); %
     439
    379440
    380441% -----------------------------------------------------------------------
     
    771832if isempty(errormsg)
    772833    set(handles.ref_i,'BackgroundColor',[1 1 1])
     834    set(handles.ref_j,'BackgroundColor',[1 1 1])
    773835else
    774836    msgbox_uvmat('ERROR',errormsg)
     
    827889
    828890%% determine nom_type_nc, nomenclature type of the .nc files:
    829 [nom_type_nc]=nomtype2pair(nom_type_ima,mode);
     891%[nom_type_nc]=nomtype2pair(nom_type_ima,mode);
    830892
    831893%% reads .nc subdirectoy and image numbers from the interface
     
    920982
    921983%% determine the default selection in the pair menu for Civ1
    922 ichoice=find(select,1);% index of selected pair
     984ichoice=find(select,1);% index of first selected pair
    923985if (isempty(ichoice) || ichoice < 1); ichoice=1; end;
    924986initial=get(handles.ListPairCiv1,'Value');%initial choice of pair
     
    10811143
    10821144%------------------------------------------------------------------------
    1083 % --- Executes on button press in CheckMask.
     1145% --- Executes on selection in menu CorrSmooth.
    10841146function num_CorrSmooth_Callback(hObject, eventdata, handles)
    10851147set(handles.configSource,'String','NEW')
    1086 set(handles.configSource,'BackgroundColor',[1 0 1])
     1148set(handles.OK,'BackgroundColor',[1 0 1])
    10871149%------------------------------------------------------------------------
    10881150
     
    14231485set(hObject,'BackgroundColor',[1 0 1])
    14241486set(handles.configSource,'String','NEW')
    1425 set(handles.configSource,'BackgroundColor',[1 0 1])
     1487set(handles.OK,'BackgroundColor',[1 0 1])
    14261488%------------------------------------------------------------------------
    14271489% --- Executes on button press in CheckMask: common to all panels (civ1, Civ2..)
     
    16851747end
    16861748set(handles.configSource,'String','NEW')
    1687 set(handles.configSource,'BackgroundColor',[1 0 1])
     1749set(handles.OK,'BackgroundColor',[1 0 1])
    16881750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    16891751%%%%%%%%%%%%%%   TEST functions
     
    18201882if get(handles.TestCiv2,'Value')
    18211883    set(handles.TestCiv2,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch
    1822     % TO UPDATE TO UPDATE TO UPDATE TO UPDATE
    1823     [Data,Param.Civ2]=get_param_civ2(handles);
    1824     Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV
    1825     hview_field=view_field(Data); %view the image in the GUI view_field
     1884      hseries=findobj(allchild(0),'Tag','series');
     1885     Param=read_GUI(hseries);
     1886     Param.Action.RUN=1;
     1887     Param.ActionInput=read_GUI(handles.civ_input);
     1888     Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series
     1889     Param.ActionInput.Civ2.SmoothParam=0;% launch Civ2 with no data point (to get the image names for A and B)
     1890     [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results
     1891     
     1892     %% create image data ImageData for display
     1893     ImageData.ListVarName={'ny','nx','A'};
     1894     ImageData.VarDimName= {'ny','nx',{'ny','nx'}};
     1895     ImageData.A=imread(Data.Civ2_ImageA); % read the first image
     1896     if ndims(ImageData.A)==3 %case of color image
     1897         ImageData.VarDimName= {'ny','nx',{'ny','nx','rgb'}};
     1898     end
     1899     ImageData.ny=[size(ImageData.A,1) 1];
     1900     ImageData.nx=[1 size(ImageData.A,2)];
     1901     ImageData.CoordUnit='pixel';% used to set equal scaling for x and y in image dispa=ly
     1902
     1903     %% create the figure view_field for image visualization
     1904    hview_field=view_field(ImageData); %view the image in the GUI view_field
    18261905    set(0,'CurrentFigure',hview_field)
     1906    RectCentre=squeeze(mean(Data.Civ1_SubRange,2));
     1907    for isub=1:size(Data.Civ1_SubRange,3);
     1908        pos_x=Data.Civ1_SubRange(1,1,isub);
     1909        pos_y=Data.Civ1_SubRange(2,1,isub);
     1910        width=Data.Civ1_SubRange(1,2,isub)-Data.Civ1_SubRange(1,1,isub);
     1911        height=Data.Civ1_SubRange(2,2,isub)-Data.Civ1_SubRange(2,1,isub);
     1912        rectangle('Position',[pos_x pos_y width height],'EdgeColor',[0 0 1])
     1913    end
    18271914    hhview_field=guihandles(hview_field);
    18281915    set(hview_field,'CurrentAxes',hhview_field.PlotAxes)
    18291916    ViewData=get(hview_field,'UserData');
    18301917    ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field
    1831     ViewData.PlotAxes.B=imread(Param.Civ1.ImageName_B);%store the second image in the UserData of the GUI view_field
    1832     ViewData.PlotAxes.X=Grid.Civ1_X; %keep the set of points in memeory
    1833     ViewData.PlotAxes.Y=Grid.Civ1_Y;
    1834     set(hview_field,'UserData',ViewData)
    1835     corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
     1918    ViewData.PlotAxes.B=imread(Data.Civ2_ImageB);%store the second image in the UserData of the GUI view_field
     1919    ViewData.PlotAxes.X=Data.Civ2_X';
     1920    ViewData.PlotAxes.Y=Data.Civ2_Y';
     1921    ViewData.PlotAxes.ShiftX=Data.Civ2_U';
     1922    ViewData.PlotAxes.ShiftY=Data.Civ2_V';
     1923    ViewData.PlotAxes.Civ1_SubRange=Data.Civ1_SubRange;
     1924    ViewData.PlotAxes.Civ1_NbCentres=Data.Civ1_NbCentres;
     1925    ViewData.PlotAxes.Civ1_Coord_tps=Data.Civ1_Coord_tps;
     1926    ViewData.PlotAxes.Civ1_U_tps=Data.Civ1_U_tps;
     1927    ViewData.PlotAxes.Civ1_V_tps=Data.Civ1_V_tps;
     1928    ViewData.PlotAxes.Civ1_Dt=Data.Civ1_Dt;
     1929    set(hview_field,'UserData',ViewData)% store the info in the UserData of image view_field
     1930   
     1931    %% look for a current figure for image correlation display
     1932    corrfig=findobj(allchild(0),'tag','corrfig');
    18361933    if isempty(corrfig)
    18371934        corrfig=figure;
     
    18391936        set(corrfig,'name','image correlation')
    18401937        set(corrfig,'DeleteFcn',{@closeview_field})%
    1841         % end
    18421938        set(handles.TestCiv1,'BackgroundColor',[1 0 0])
    18431939    else
     
    18511947            delete(hview_field)
    18521948        end
    1853     end
     1949    end   
    18541950else
    18551951    hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field
     
    20842180
    20852181%------------------------------------------------------------------------
    2086 % --- Executes on button press in InportParam.
    2087 %------------------------------------------------------------------------
    2088 function InportParam_Callback(hObject, eventdata, handles)
     2182% --- Executes on button press in ImportParam.
     2183%------------------------------------------------------------------------
     2184function ImportParam_Callback(hObject, eventdata, handles)
    20892185hseries=findobj(allchild(0),'Tag','series');
    20902186hhseries=guidata(hseries);
     
    21162212        if isfield(Param.ActionInput,'Program')&& strcmp(Param.ActionInput.Program,'civ_series')
    21172213            fill_GUI(Param.ActionInput,handles.civ_input)% fill the elements of the GUI series with the input parameters
     2214            set(handles.ConfigSource,'String',filexml)
    21182215            check_input=1;
    2119             update_CivOptions(handles,0)
    2120                
     2216            update_CivOptions(handles,0)             
    21212217        end
    21222218    end
     
    21382234if isempty(find(strcmp(get(gco,'Tag'),ListExclude),1))% if the selected uicontrol is not in the Exclude list
    21392235    set(handles.ConfigSource,'String','NEW')% indicate that the configuration is new
    2140     set(handles.ConfigSource,'BackgroundColor',[1 0 1])%
    2141 end
     2236    set(handles.OK,'BackgroundColor',[1 0 1])%
     2237    drawnow
     2238end
     2239
     2240
     2241% --- Executes on button press in TestPatch2.
     2242function TestPatch2_Callback(hObject, eventdata, handles)
Note: See TracChangeset for help on using the changeset viewer.