Changeset 854 for trunk/src/series


Ignore:
Timestamp:
Jan 21, 2015, 7:02:04 PM (10 years ago)
Author:
sommeria
Message:

bugrepair

Location:
trunk/src/series
Files:
5 edited

Legend:

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

    r853 r854  
    257257set(handles.dt_unit,'String',['dt in m' TimeUnit]);%display dt in unit 10-3 of the time (e.g ms)
    258258set(handles.TimeUnit,'String',TimeUnit);
    259 set(handles.CoordUnit,'String',CoordUnit)
     259%set(handles.CoordUnit,'String',CoordUnit)
    260260set(handles.SearchRange,'UserData', pxcm_search);
    261261
     
    988988    set(handles.num_VMin,'Visible','on')
    989989    set(handles.num_VMax,'Visible','on')
    990     set(handles.CoordUnit,'Visible','on')
    991     set(handles.TimeUnit,'Visible','on')
    992     set(handles.slash_title,'Visible','on')
     990    %set(handles.CoordUnit,'Visible','on')
     991    %set(handles.TimeUnit,'Visible','on')
     992    %set(handles.slash_title,'Visible','on')
    993993    set(handles.min_title,'Visible','on')
    994994    set(handles.max_title,'Visible','on')
     
    10231023end   
    10241024if ~(isempty(umin)||isempty(umax)||isempty(vmin)||isempty(vmax))
    1025     list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs
    1026     index=get(handles.ListPairCiv1,'Value');
    1027     pair_string=list_pair{index};
    1028     time=get(handles.TimeSource,'UserData'); %get the set of times
    1029     pxcm=get(handles.SearchRange,'UserData');
    1030     mode_list=get(handles.ListPairMode,'String');
    1031     mode_value=get(handles.ListPairMode,'Value');
    1032     mode=mode_list{mode_value};     
    1033     if isequal (mode, 'series(Di)' )
    1034         ref_i=str2double(get(handles.ref_i,'String'));
    1035         num1=ref_i-floor(index/2);%  first image numbers
    1036         num2=ref_i+ceil(index/2);
    1037         num_a=1;
    1038         num_b=1;
    1039     elseif isequal (mode, 'series(Dj)')
    1040         num1=1;
    1041         num2=1;
    1042         ref_j=str2double(get(handles.ref_j,'String'));
    1043         num_a=ref_j-floor(index/2);%  first image numbers
    1044         num_b=ref_j+ceil(index/2);
    1045     elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)     
    1046         ref_i=str2double(get(handles.ref_i,'String'));
    1047         num1=ref_i;
    1048         num2=ref_i;
    1049                 r=regexp(pair_string,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');
    1050         if isempty(r)
    1051             r=regexp(pair_string,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');
    1052         end 
    1053         num_a=str2num(r.num1);
    1054         num_b=str2num(r.num2);
    1055     end
    1056     dt=time(num2+1,num_b+1)-time(num1+1,num_a+1);
    1057     ibx=str2double(get(handles.num_CorrBoxSize_1,'String'));
    1058     iby=str2double(get(handles.num_CorrBoxSize_2,'String'));
    1059     umin=dt*pxcm*umin;
    1060     umax=dt*pxcm*umax;
    1061     vmin=dt*pxcm*vmin;
    1062     vmax=dt*pxcm*vmax;
     1025%     list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs
     1026%     index=get(handles.ListPairCiv1,'Value');
     1027%     pair_string=list_pair{index};
     1028%     time=get(handles.TimeSource,'UserData'); %get the set of times
     1029%     pxcm=get(handles.SearchRange,'UserData');
     1030%     mode_list=get(handles.ListPairMode,'String');
     1031%     mode_value=get(handles.ListPairMode,'Value');
     1032%     mode=mode_list{mode_value};     
     1033%     if isequal (mode, 'series(Di)' )
     1034%         ref_i=str2double(get(handles.ref_i,'String'));
     1035%         num1=ref_i-floor(index/2);%  first image numbers
     1036%         num2=ref_i+ceil(index/2);
     1037%         num_a=1;
     1038%         num_b=1;
     1039%     elseif isequal (mode, 'series(Dj)')
     1040%         num1=1;
     1041%         num2=1;
     1042%         ref_j=str2double(get(handles.ref_j,'String'));
     1043%         num_a=ref_j-floor(index/2);%  first image numbers
     1044%         num_b=ref_j+ceil(index/2);
     1045%     elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)     
     1046%         ref_i=str2double(get(handles.ref_i,'String'));
     1047%         num1=ref_i;
     1048%         num2=ref_i;
     1049%                 r=regexp(pair_string,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');
     1050%         if isempty(r)
     1051%             r=regexp(pair_string,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');
     1052%         end 
     1053%         num_a=str2num(r.num1);
     1054%         num_b=str2num(r.num2);
     1055%     end
     1056%     dt=time(num2+1,num_b+1)-time(num1+1,num_a+1);
     1057%     ibx=str2double(get(handles.num_CorrBoxSize_1,'String'));
     1058%     iby=str2double(get(handles.num_CorrBoxSize_2,'String'));
     1059%     umin=dt*pxcm*umin;
     1060%     umax=dt*pxcm*umax;
     1061%     vmin=dt*pxcm*vmin;
     1062%     vmax=dt*pxcm*vmax;
    10631063    shiftx=round((umin+umax)/2);
    10641064    shifty=round((vmin+vmax)/2);
    1065     isx=(umax+2-shiftx)*2+param_civ1.Bx;
     1065    isx=(umax+2-shiftx)*2+param_civ1.CorrBoxSize(1);
    10661066    isx=2*ceil(isx/2)+1;
    1067     isy=(vmax+2-shifty)*2+param_civ1.Bx;
     1067    isy=(vmax+2-shifty)*2+param_civ1.CorrBoxSize(2);
    10681068    isy=2*ceil(isy/2)+1;
    10691069    set(handles.num_SearchBoxShift_1,'String',num2str(shiftx));
     
    10761076% --- Executes on button press in CheckMask.
    10771077function num_CorrSmooth_Callback(hObject, eventdata, handles)
    1078 set(hObject,'BackgroundColor',[1 0 1])
    10791078set(handles.configSource,'String','NEW')
    1080 
     1079set(handles.configSource,'BackgroundColor',[1 0 1])
    10811080%------------------------------------------------------------------------
    10821081
     
    14171416set(hObject,'BackgroundColor',[1 0 1])
    14181417set(handles.configSource,'String','NEW')
    1419 
     1418set(handles.configSource,'BackgroundColor',[1 0 1])
    14201419%------------------------------------------------------------------------
    14211420% --- Executes on button press in CheckMask: common to all panels (civ1, Civ2..)
     
    14611460    set(handle_txtbox,'Visible','off')
    14621461end
    1463 set(hObject,'BackgroundColor',[1 0 1])
    14641462set(handles.configSource,'String','NEW')
     1463set(handles.configSource,'BackgroundColor',[1 0 1])
    14651464
    14661465% %------------------------------------------------------------------------
     
    16781677    set(obj,'Visible','off')
    16791678end
    1680 set(hObject,'BackgroundColor',[1 0 1])
    16811679set(handles.configSource,'String','NEW')
     1680set(handles.configSource,'BackgroundColor',[1 0 1])
    16821681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    16831682%%%%%%%%%%%%%%   TEST functions
     
    21332132ListExclude={'CheckCiv1','CheckFix1','CheckPatch1','CheckCiv2','CheckFix2','CheckPatch2','ref_i'};
    21342133if 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
    21372134    set(handles.ConfigSource,'String','NEW')% indicate that the configuration is new
    2138 end
     2135    set(handles.ConfigSource,'BackgroundColor',[1 0 1])%
     2136end
  • trunk/src/series/civ_series.m

    r852 r854  
    611611       
    612612         % get the guess from patch1 or patch2 (case 'iterate')
    613         if isfield (par_civ2,'iterate') && strcmp(par_civ2.iterate,'iterate')
     613        if isfield (par_civ2,'iterate') && strcmp(par_civ2.iterate,'civ3')
    614614           SubRange= Data.Civ2_SubRange;
    615615           NbCentres=Data.Civ2_NbCentres;
     
    10021002                    [vector,F(ivec)] = SUBPIX2DGAUSS (result_conv,x,y);
    10031003                end
    1004                 utable(ivec)=vector(1)*mesh+shiftx(ivec);
     1004%                 if ~isfield(par_civ,'CheckDeformation')
     1005                utable(ivec)=vector(1)*mesh+shiftx(ivec);
    10051006                vtable(ivec)=vector(2)*mesh+shifty(ivec);
     1007%                 else
     1008%                                 utable(ivec)=shiftx(ivec);% TEST TEST !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1009%                 vtable(ivec)=shifty(ivec);
     1010%                 end
    10061011                xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2)
    10071012                ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge)
  • trunk/src/series/stereo_civ.m

    r851 r854  
    327327       
    328328        % set the list of variables
    329         Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_F','Civ1_C','Xphys','Yphys','Zphys','Civ1_E'};%  cell array containing the names of the fields to record
    330         Data.VarDimName={'nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1'};
     329        Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_F','Civ1_C'};%  cell array containing the names of the fields to record
     330        Data.VarDimName={'nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1'};
    331331        Data.VarAttribute{1}.Role='coord_x';
    332332        Data.VarAttribute{2}.Role='coord_y';
     
    345345        Data.Civ1_C=reshape(ctable,[],1);
    346346        Data.Civ1_F=reshape(F,[],1);
    347         Data.Xphys=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ1_X-0.5)/(Npx-1);
    348         Data.Yphys=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ1_Y-0.5)/(Npy-1);
    349         U=Data.Civ1_U*(Rangx(2)-Rangx(1))/(Npx-1);
    350         V=Data.Civ1_V*(Rangy(2)-Rangy(1))/(Npy-1);
    351         [Data.Zphys,Data.Civ1_E]=shift2z(Data.Xphys,Data.Yphys,U,V,XmlData);
    352         if ~isempty(errormsg)
    353             disp_uvmat('ERROR',errormsg,checkrun)
    354             return
    355         end
     347%         Data.Xphys=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ1_X-0.5)/(Npx-1);
     348%         Data.Yphys=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ1_Y-0.5)/(Npy-1);
     349%         
     350%         U=Data.Civ1_U*(Rangx(2)-Rangx(1))/(Npx-1);
     351%         V=Data.Civ1_V*(Rangy(2)-Rangy(1))/(Npy-1);
     352%         [Data.Zphys,Data.Civ1_E]=shift2z(Data.Xphys,Data.Yphys,U,V,XmlData);
     353%         if ~isempty(errormsg)
     354%             disp_uvmat('ERROR',errormsg,checkrun)
     355%             return
     356%         end
    356357    end
    357358   
     
    444445            j2=j2_series_Civ2(ifield);
    445446        end
    446         par_civ2.ImageWidth=FileInfo_A.Width;
    447         par_civ2.ImageHeight=FileInfo_A.Height;
    448        
     447        par_civ2.ImageWidth=size(par_civ2.ImageA,2);%FileInfo_A.Width;
     448        par_civ2.ImageHeight=size(par_civ2.ImageA,1);%FileInfo_A.Height;
    449449        if isfield(par_civ2,'Grid')% grid points set as input file
    450450            if ischar(par_civ2.Grid)%read the grid file if the input is a file name
     
    522522       
    523523        nbvar=numel(Data.ListVarName);
    524         Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C'}];%  cell array containing the names of the fields to record
    525         Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2'}];
     524        Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C','Xphys','Yphys','Zphys','Civ2_E'}];%  cell array containing the names of the fields to record
     525        Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2'}];
    526526        Data.VarAttribute{nbvar+1}.Role='coord_x';
    527527        Data.VarAttribute{nbvar+2}.Role='coord_y';
     
    596596        Data.CivStage=Data.CivStage+1;
    597597       
    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
     598           
     599         % get z from u and v (displacements)
     600       
     601        Data.Xphys=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ2_X-0.5)/(Npx-1);
     602        Data.Yphys=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ2_Y-0.5)/(Npy-1);
     603        U=Data.Civ2_U_smooth*(Rangx(2)-Rangx(1))/(Npx-1);
     604        V=Data.Civ2_V_smooth*(Rangy(2)-Rangy(1))/(Npy-1);
     605        [Data.Zphys,Data.Civ2_E]=shift2z(Data.Xphys,Data.Yphys,U,V,XmlData);
     606        if ~isempty(errormsg)
     607            disp_uvmat('ERROR',errormsg,checkrun)
     608            return
     609        end
    611610       
    612611    end
     
    820819            image2_crop=interp2(image2_crop,xi,yi);
    821820        end
    822         sum_square=sum(sum(image1_crop.*image1_crop));
     821        sum_square=(sum(sum(image1_crop.*image1_crop))+sum(sum(image2_crop.*image2_crop)))/2;
    823822        %reference: Oliver Pust, PIV: Direct Cross-Correlation
    824823        result_conv= conv2(image2_crop,flipdim(flipdim(image1_crop,2),1),'valid');
     
    834833                    [vector,F(ivec)] = SUBPIX2DGAUSS (result_conv,x,y);
    835834                end
    836                 utable(ivec)=vector(1)*mesh+shiftx(ivec);
     835
     836%                 if isfield(par_civ,'CheckDeformation')
     837%                  utable(ivec)=shiftx(ivec);
     838%                  vtable(ivec)=shifty(ivec);
     839%                 else
     840                 utable(ivec)=vector(1)*mesh+shiftx(ivec);
    837841                vtable(ivec)=vector(2)*mesh+shifty(ivec);
     842%                 end
    838843%                 xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2)
    839844%                 ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge)
     
    10531058Calib_A=XmlData{1}.GeometryCalib;
    10541059R=(Calib_A.R)';
    1055 x_a=xmid-u/2;
    1056 y_a=ymid-v/2;
     1060x_a=xmid;
     1061y_a=ymid;
    10571062z_a=R(7)*x_a+R(8)*y_a+Calib_A.Tx_Ty_Tz(1,3);
    10581063Xa=(R(1)*x_a+R(2)*y_a+Calib_A.Tx_Ty_Tz(1,1))./z_a;
     
    10721077Calib_B=XmlData{2}.GeometryCalib;
    10731078R=(Calib_B.R)';
    1074 x_b=xmid+ u/2;
    1075 y_b=ymid+ v/2;
     1079x_b=xmid+ u;
     1080y_b=ymid+ v;
    10761081z_b=R(7)*x_b+R(8)*y_b+Calib_B.Tx_Ty_Tz(1,3);
    10771082Xb=(R(1)*x_b+R(2)*y_b+Calib_B.Tx_Ty_Tz(1,1))./z_b;
  • trunk/src/series/sub_background.m

    r810 r854  
    145145    if nbfield_i~=1
    146146        nbaver=floor(nbaver_init/nbfield_j); % number of bursts used for the sliding background,
    147         if isequal(floor(nbaver/2),nbaver)
     147        if isequal(mod(nbaver,2),0)% if nbaver is even
    148148            nbaver=nbaver+1;%put the number of burst to an odd number (so the middle burst is defined)
    149149        end
     
    170170        step=nbfield_j;%case of bursts: the sliding background is shifted by the length of one burst
    171171    end
    172     nbaver_ima=str2num(answer{2});%number of images for the sliding background
     172    nbaver_ima=str2double(answer{2});%number of images for the sliding background
    173173    nbaver=ceil(nbaver_ima/step);%number of bursts for the sliding background
    174     if isequal(floor(nbaver/2),nbaver)
     174    if isequal(mod(nbaver,2),0)% if nbaver is even
    175175        nbaver=nbaver+1;%set the number of bursts to an odd number (so the middle burst is defined)
    176176    end
     
    178178    ParamOut.ActionInput.CheckVolume=strcmp(answer{1},'Yes');
    179179    ParamOut.ActionInput.SlidingSequenceLength=nbaver_ima;
    180     ParamOut.ActionInput.BrightnessRankThreshold=str2num(answer{3});
     180    ParamOut.ActionInput.BrightnessRankThreshold=str2double(answer{3});
    181181   
    182182    % apply the image rescaling function 'level' (avoid the blinking effects of bright particles)
     
    198198
    199199%% input preparation
    200 nbaver_ima=Param.ActionInput.SlidingSequenceLength;
    201200NbSlice=Param.IndexRange.NbSlice;
    202201if ~isequal(NbSlice,1)
     
    251250nbaver_ima=Param.ActionInput.SlidingSequenceLength;%number of images for the sliding background
    252251nbaver=ceil(nbaver_ima/step);%number of bursts for the sliding background
    253 if isequal(floor(nbaver/2),nbaver)
     252if isequal(mod(nbaver,2),0)
    254253    nbaver=nbaver+1;%set the number of bursts to an odd number (so the middle burst is defined)
    255254end
Note: See TracChangeset for help on using the changeset viewer.