Changeset 883 for trunk/src


Ignore:
Timestamp:
Mar 13, 2015, 8:19:39 PM (10 years ago)
Author:
sommeria
Message:

bugs corrected in series, transform functions with input parameters introduced, civ/deformation corrected (sign)

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r882 r883  
    639639    set(handles.series,'UserData',[])%refresh the stored info
    640640end
    641 for iview=1:size(InputTable,1)
     641nbview=size(InputTable,1);
     642for iview=1:nbview
    642643    RootPath=fullfile(InputTable{iview,1},InputTable{iview,2});
    643644    if ~exist(RootPath,'dir')
    644645        i1_series=[];
    645         %RootPath=fileparts(RootPath); %will try the upper folder
    646646        RootFile='';
    647647    else %scan the input folder
     
    662662    end
    663663end
     664
     665%% update MinIndex_i and MaxIndex_i if the input table content has been reduced in line nbre
     666MinIndex_i_table=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex
     667set(handles.MinIndex_i,'Data',MinIndex_i_table(1:nbview,:));
     668MinIndex_j_table=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex
     669set(handles.MinIndex_j,'Data',MinIndex_j_table(1:nbview,:));
     670MaxIndex_i_table=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex
     671set(handles.MaxIndex_i,'Data',MaxIndex_i_table(1:nbview,:));
     672MaxIndex_j_table=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex
     673set(handles.MaxIndex_j,'Data',MaxIndex_j_table(1:nbview,:));
     674PairString=get(handles.PairString,'Data');%retrieve the min indices in the table MinIndex
     675set(handles.PairString,'Data',PairString(1:nbview,:));
     676TimeTable=get(handles.TimeTable,'Data');%retrieve the min indices in the table MinIndex
     677set(handles.TimeTable,'Data',TimeTable(1:nbview,:));
     678
    664679%% enable field and veltype menus, in accordance with the current action
    665680ActionName_Callback([],[], handles)
     
    766781    SeriesData.Time={};
    767782end
    768    SeriesData.i1_series(iview+1:end)=[];
     783if isfield(SeriesData,'i1_series')
     784    SeriesData.i1_series(iview+1:end)=[];
    769785    SeriesData.i2_series(iview+1:end)=[];
    770786    SeriesData.j1_series(iview+1:end)=[];
     
    773789    SeriesData.FileInfo(iview+1:end)=[];
    774790    SeriesData.Time(iview+1:end)=[];
    775  InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
     791end
     792InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    776793if iview >1
    777794    set(handles.InputLine,'String',num2str(iview))
     
    14111428Param=read_GUI_series(handles);%displayed parameters
    14121429SeriesData=get(handles.series,'UserData');%hidden parameters
     1430if isfield(SeriesData,'TransformInput')
     1431    Param.TransformInput=SeriesData.TransformInput;
     1432end
    14131433if ~isfield(SeriesData,'i1_series')
    14141434    errormsg='The input field series needs to be refreshed: press REFRESH';
     
    24032423end
    24042424set(handles.OutputSubDir,'String',SubDirOut)
     2425set(handles.OutputSubDir,'BackgroundColor',[1 1 1])% set edit box to white color to indicate refreshment
    24052426set(handles.OutputDirExt,'Visible',OutputDirVisible)
    24062427set(handles.OutputSubDir,'Visible',OutputDirVisible)
     
    29712992set(handles.TransformName,'UserData',TransformPathList);
    29722993
     2994%% create the function handle of the selected fct
     2995if ~isempty(TransformName)
     2996    current_dir=pwd;%current working dir
     2997    cd(TransformPathList{TransformIndex})
     2998    transform_handle=str2func(TransformName);
     2999    cd(current_dir)
     3000    Field.Action.RUN=0;% indicate that the transform fct is called only to get input param
     3001    DataOut=feval(transform_handle,Field,[]);% execute the transform fct to get the required conditions
     3002    if isfield(DataOut,'TransformInput')%  used to add transform parameters at selection of the transform fct
     3003        SeriesData=get(handles.series,'UserData');
     3004        SeriesData.TransformInput=DataOut.TransformInput;
     3005        set(handles.series,'UserData',SeriesData)
     3006    end
     3007end
     3008
    29733009%------------------------------------------------------------------------
    29743010% --- fct activated by the upper bar menu ExportConfig
     
    30343070    Param.ActionInput.ConfigSource=filexml;% record the source of config for future info
    30353071    SeriesData.ActionInput=Param.ActionInput;
     3072end
     3073if isfield(Param,'TransformInput')%  introduce  parameters specific to a transform fct
     3074    SeriesData.TransformInput=Param.TransformInput;
    30363075end
    30373076if isfield(Param,'ProjObject') %introduce projection object if relevant
     
    34713510    set(handles.InputTable,'Data',InputTable);
    34723511end
     3512set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refr
    34733513
    34743514
  • trunk/src/series/aver_stat.m

    r881 r883  
    185185    transform_fct=str2func(Param.FieldTransform.TransformName);
    186186    rmpath(Param.FieldTransform.TransformPath)
     187    if isfield(Param,'TransformInput')
     188            XmlData{1}.TransformInput=Param.TransformInput;
     189    end     
    187190end
    188191
  • trunk/src/series/civ_input.m

    r881 r883  
    688688nbfield=siztime(1)-1;
    689689nbfield2=siztime(2)-1;
    690 indchosen=1;  %%first pair selected by default
     690%indchosen=1;  %%first pair selected by default
    691691%displ_num used to define the indices of the civ_input pairs
    692692% in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices
     
    907907nbpair=200;%default
    908908select=ones(size(1:nbpair));%flag for displayed pairs =1 for display
    909 nbpair=200; %default
     909%nbpair=200; %default
    910910
    911911%% determine the menu display in .ListPairCiv1
     
    915915            if select(ipair)
    916916                displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))];
     917                displ_pair_dt{ipair}=displ_pair{ipair};
    917918                if ~checkframe
    918919                    if size(Time,1)>=ref_i+1+ceil(ipair/2) && size(Time,2)>=ref_j+1&& ref_i-floor(ipair/2)>=0 && ref_j>=0
    919920                        dt=Time(ref_i+1+ceil(ipair/2),ref_j+1)-Time(ref_i+1-floor(ipair/2),ref_j+1);%Time interval dtref_j+1
    920                         displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
     921                        displ_pair_dt{ipair}=[displ_pair_dt{ipair} ' :dt= ' num2str(dt*1000)];
    921922                    end
    922923                else
    923924                    dt=ipair/1000;
    924                     displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(ipair)];
     925                    displ_pair_dt{ipair}=[displ_pair_dt{ipair} ' :dt= ' num2str(ipair)];
    925926                end
    926927            else
    927                 displ_pair{ipair}='...'; %pair not displayed in the menu
     928                displ_pair{ipair}='...';
     929                displ_pair_dt{ipair}='...'; %pair not displayed in the menu
    928930            end
    929931        end
     
    932934            if select(ipair)
    933935                displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))];
     936                displ_pair_dt{ipair}=displ_pair{ipair};
    934937                if ~checkframe
    935938                    if size(Time,2)>=ref_j+1+ceil(ipair/2) && size(Time,1)>=ref_i+1 && ref_j-floor(ipair/2)>=0 && ref_i>=0
    936939                        dt=Time(ref_i+1,ref_j+1+ceil(ipair/2))-Time(ref_i+1,ref_j+1-floor(ipair/2));%Time interval dtref_j+1
    937                         displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
     940                        displ_pair_dt{ipair}=[displ_pair_dt{ipair} ' :dt= ' num2str(dt*1000)];
    938941                    end
    939942                else
    940943                    dt=ipair/1000;
    941                     displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
     944                    displ_pair_dt{ipair}=[displ_pair_dt{ipair} ' :dt= ' num2str(dt*1000)];
    942945                end
    943946            else
    944947                displ_pair{ipair}='...'; %pair not displayed in the menu
     948                displ_pair_dt{ipair}='...'; %pair not displayed in the menu
    945949            end
    946950        end
     
    956960                index_pair=index_pair+1;
    957961                displ_pair{index_pair}=['j= ' num2stra(numod_a,nom_type_ima) '-' num2stra(numod_b,nom_type_ima)];
     962                displ_pair_dt{ipair}=displ_pair{ipair};
    958963                dt(index_pair)=numod_b-numod_a;%default dt
    959964                if size(Time,1)>ref_i && size(Time,2)>numod_b  % && ~checkframe
    960965                    dt(index_pair)=Time(ref_i+1,numod_b+1)-Time(ref_i+1,numod_a+1);% Time interval dt
    961                     displ_pair{index_pair}=[displ_pair{index_pair} ' :dt= ' num2str(dt(index_pair)*1000)];
     966                    displ_pair_dt{index_pair}=[displ_pair_dt{index_pair} ' :dt= ' num2str(dt(index_pair)*1000)];
    962967                end
    963968            end
     
    966971        [tild,indsort]=sort(dt);
    967972        displ_pair=displ_pair(indsort);
     973        displ_pair_dt=displ_pair_dt(indsort);
    968974    case 'displacement'
    969975        displ_pair={'Di=Dj=0'};
     976        displ_pair_dt={'Di=Dj=0'};
    970977end
    971978if index==1
    972     set(handles.ListPairCiv1,'String',displ_pair');
     979    set(handles.ListPairCiv1,'String',displ_pair_dt');
    973980end
    974981
     
    976983%ichoice=find(select,1);% index of first selected pair
    977984%if (isempty(ichoice) || ichoice < 1); ichoice=1; end;
     985end_pair=regexp(PairCiv1Init,' :dt=');
     986if ~isempty(end_pair)
     987    PairCiv1Init=PairCiv1Init(1:end_pair-1);
     988end
    978989ichoice=find(strcmp(PairCiv1Init,displ_pair'),1);
    979990if ~isempty(ichoice)
     
    988999%% determine the default selection in the pair menu for Civ2
    9891000if strcmp(get(handles.ListPairCiv2,'Visible'),'on')
     1001    end_pair=regexp(PairCiv2Init,' :dt=');
     1002    if ~isempty(end_pair)
     1003        PairCiv2Init=PairCiv2Init(1:end_pair-1);
     1004    end
    9901005    ichoice=find(strcmp(PairCiv2Init,displ_pair'),1);
    9911006    if ~isempty(ichoice)
     
    9941009        set(handles.ListPairCiv2,'Value',1)
    9951010    end
    996    
    997     %
    998     %     initial=get(handles.ListPairCiv2,'Value');
    999     %
    1000     %
    1001     %     if initial>length(displ_pair')%|~isequal(select(initial),1)
    1002     %         if ichoice <= length(displ_pair')
    1003     %             set(handles.ListPairCiv2,'Value',ichoice);% same pair proposed by default for civ2
    1004     %         else
    1005     %             set(handles.ListPairCiv2,'Value',1);% same pair proposed by default for civ2
    1006     %         end
    1007     %     end
    10081011else
    10091012    set(handles.ListPairCiv2,'Value',get(handles.ListPairCiv1,'Value'))% initiate the choice of Civ2 as a reproduction of if civ1
    10101013end
    1011 set(handles.ListPairCiv2,'String',displ_pair');
     1014set(handles.ListPairCiv2,'String',displ_pair_dt');
    10121015set(gcf,'Pointer','arrow')% Indicate that the process is finished
    1013 
    1014 
    1015    
    1016 % %------------------------------------------------------------------------   
    1017 % % call 'view_field.fig' to display the  field selected in the list of 'status'
    1018 % function open_view_field(hObject, eventdata)
    1019 % %------------------------------------------------------------------------
    1020 % list=get(hObject,'String');
    1021 % index=get(hObject,'Value');
    1022 % rootroot=get(hObject,'UserData');
    1023 % filename=list{index};
    1024 % ind_dot=strfind(filename,'...');
    1025 % filename=filename(1:ind_dot-1);
    1026 % filename=fullfile(rootroot,filename);
    1027 % delete(get(hObject,'parent'))%delete the display figure to stop the check process
    1028 % if exist(filename,'file')%visualise the vel field if it exists
    1029 %     uvmat(filename)
    1030 %     set(gcbo,'Value',1)
    1031 % end
    10321016
    10331017
     
    11601144set(handles.ConfigSource,'String','NEW')
    11611145set(handles.OK,'BackgroundColor',[1 0 1])
     1146if get(handles.CheckDeformation,'Value')
     1147    set(handles.num_CorrSmooth,'Visible','off')
     1148else
     1149    set(handles.num_CorrSmooth,'Visible','on')
     1150end
    11621151
    11631152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  • trunk/src/series/civ_series.m

    r880 r883  
    10361036                    yi=(1:mesh:size(image1_crop,1))';
    10371037                    [XI,YI]=meshgrid(xi-ceil(size(image1_crop,2)/2),yi-ceil(size(image1_crop,1)/2));
    1038                     XIant=XI-par_civ.DUDX(ivec)*XI-par_civ.DUDY(ivec)*YI+ceil(size(image1_crop,2)/2);
    1039                     YIant=YI-par_civ.DVDX(ivec)*XI-par_civ.DVDY(ivec)*YI+ceil(size(image1_crop,1)/2);
     1038                    XIant=XI-par_civ.DUDX(ivec)*XI+par_civ.DUDY(ivec)*YI+ceil(size(image1_crop,2)/2);
     1039                    YIant=YI+par_civ.DVDX(ivec)*XI-par_civ.DVDY(ivec)*YI+ceil(size(image1_crop,1)/2);
    10401040                    image1_crop=interp2(image1_crop,XIant,YIant);
    10411041                    image1_crop(isnan(image1_crop))=0;
     
    10441044                    image2_crop=interp2(image2_crop,xi,yi,'*spline');
    10451045                    image2_crop(isnan(image2_crop))=0;
    1046                     %par_civ.CorrSmooth=3;%%%%%%%%%%%%%%%%%%%
    1047                     %%
     1046                    par_civ.CorrSmooth=2;% use SUBPIX2DGAUSS (take into account more points near the max)
    10481047                end
    10491048                sum_square=sum(sum(image1_crop.*image1_crop));
  • trunk/src/series/merge_proj.m

    r880 r883  
    179179        transform_fct=str2func(Param.FieldTransform.TransformName);
    180180        cd (currentdir)
     181        if isfield(Param,'TransformInput')
     182            for iview=1:NbView
     183            XmlData{iview}.TransformInput=Param.TransformInput;
     184            end
     185        end       
    181186end
    182187%%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
  • trunk/src/series/time_series.m

    r881 r883  
    220220    transform_fct=str2func(Param.FieldTransform.TransformName);
    221221    rmpath(Param.FieldTransform.TransformPath)
     222    if isfield(Param,'TransformInput')
     223        XmlData{1}.TransformInput=Param.TransformInput;
     224    end
    222225end
    223226
  • trunk/src/transform_field/diff_vel.m

    r876 r883  
    3535%=======================================================================
    3636
    37 function SubData=diff_vel(Field,XmlData,Field_1)
     37function Field=diff_vel(Field,XmlData,Field_1)
    3838
    39 SubData=Field;
     39%% request input parameters
     40if isfield(Field,'Action') && isfield(Field.Action,'RUN') && isequal(Field.Action.RUN,0)
     41
     42        %default input:
     43        def={'1'};% multiplicative factor for the second velocity field
     44
     45        if isfield(XmlData,'TransformInput')% if parameters have been memorised
     46            if isfield(XmlData.TransformInput,'Factor')
     47                def{1}=num2str(XmlData.TransformInput.Factor);
     48            end
     49        end
     50        num_lines= 1;%numel(prompt);
     51        % open the dialog fig
     52        prompt='enter scale factor for the second field';
     53        answer = inputdlg(prompt,'',num_lines,def);
     54        Field.TransformInput.Factor=str2num(answer{1});
     55    return
     56end
     57Factor=1;
     58if isfield(XmlData,'TransformInput') && isfield(XmlData.TransformInput,'Factor')
     59Factor=XmlData.TransformInput.Factor;
     60end
    4061if exist('Field_1','var')
    4162          F.U=scatteredInterpolant(Field_1.X,Field_1.Y,Field_1.U,'linear');
    42          SubData.U=Field.U-F.U(Field.X,Field.Y);%substract the interpolated ref to U
     63         Field.U=Field.U-Factor*F.U(Field.X,Field.Y);%substract the interpolated ref to U
    4364          F.V=scatteredInterpolant(Field_1.X,Field_1.Y,Field_1.V,'linear');
    44           SubData.V=Field.V-F.V(Field.X,Field.Y);%substract the interpolated ref to V
     65          Field.V=Field.V-Factor*F.V(Field.X,Field.Y);%substract the interpolated ref to V
    4566end
    4667 
Note: See TracChangeset for help on using the changeset viewer.