Changeset 251


Ignore:
Timestamp:
May 13, 2011, 11:05:49 AM (13 years ago)
Author:
sommeria
Message:

bug corrected in mouse_motion (display of z)
civ_uvmat corrected to use mask in fix (not implemented in civx fortran programmes)

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r248 r251  
    21442144                else
    21452145                     fix1.LowerBoundVel=thresh_vel1;
    2146                 end
     2146                end   
     2147                if get(handles.get_mask_fix1,'Value')
     2148                    fix1.MaskName=maskname;
     2149                end     
    21472150                Param.Fix1=fix1;
    21482151            end
  • trunk/src/civ_uvmat.m

    r248 r251  
    1010mask='';
    1111maskname='';%default
     12test_civx=0;%default
    1213
    1314%% Civ1
     
    7475    Data.CivStage=1;
    7576else
    76     if isfield(Param,'Fix1')
    77         Data=nc2struct(ncfile,ListVarCiv1);%read civ1 data in the existing netcdf file
     77    Data=nc2struct(ncfile,'ListGlobalAttribute','absolut_time_T0');
     78   
     79    % read Civx data
     80    if ~isempty(Data.absolut_time_T0')%read civx file
     81%         var={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F','Civ1_FF';...
     82%             'vec_X','vec_Y','vec_U','vec_V','vec_C','vec_F','vec_FixFlag'};
     83
     84        %var=varcivx_generator('velocity','Civ1');%determine the names of constants and variables to read
     85        test_civx=1;
     86        [Data,vardetect,ichoice]=nc2struct(ncfile);%read the variables in the netcdf file
     87%         Data.ListGlobalAttribute=[{'Conventions','Program','CivStage'} Data.ListGlobalAttribute {'Civ1_Time','Civ1_Dt'}];
     88%         Data.Conventions='uvmat/civdata';% states the conventions used for the description of field variables and attributes
     89%         Data.Program='civ_uvmat';
     90%         Data.Civ1_Time=double(Data.absolut_time_T0);
     91%         Data.Civ1_Dt=double(Data.dt);
     92%         Data.VarDimName={'nbvec1','nbvec1','nbvec1','nbvec1','nbvec1','nbvec1','nbvec1'};
     93%         Data.VarAttribute{1}.Role='coord_x';
     94%         Data.VarAttribute{2}.Role='coord_y';
     95%         Data.VarAttribute{3}.Role='vector_x';
     96%         Data.VarAttribute{4}.Role='vector_y';
     97%         Data.VarAttribute{5}.Role='ancillary';
     98%         Data.VarAttribute{6}.Role='warnflag';
     99%         Data.VarAttribute{7}.Role='errorflag';
     100%         Data.CivStage=1;
    78101    else
    79         Data=nc2struct(ncfile,ListVarFix1);%read civ1 and fix1 data in the existing netcdf file
     102
     103        if isfield(Param,'Fix1')
     104            Data=nc2struct(ncfile,ListVarCiv1);%read civ1 data in the existing netcdf file
     105        else
     106            Data=nc2struct(ncfile,ListVarFix1);%read civ1 and fix1 data in the existing netcdf file
     107        end
    80108    end
    81109    if isfield(Data,'Txt')
     
    83111        return
    84112    end
    85     % read Civx data
    86     if isfield(Data,'absolut_time_T0')%read civx file
    87         var={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F','Civ1_FF';'vec_X','vec_Y','vec_U','vec_V','vec_C','vec_F','vec_FixFlag'};
    88         %var=varcivx_generator('velocity','Civ1');%determine the names of constants and variables to read
    89         [Data,vardetect,ichoice]=nc2struct(ncfile,var);%read the variables in the netcdf file
    90         Data.ListGlobalAttribute=[{'Conventions','Program','CivStage'} Data.ListGlobalAttribute {'Civ1_Time','Civ1_Dt'}];
    91         Data.Conventions='uvmat/civdata';% states the conventions used for the description of field variables and attributes
    92         Data.Program='civ_uvmat';
    93         Data.Civ1_Time=double(Data.absolut_time_T0);
    94         Data.Civ1_Dt=double(Data.dt);
    95         Data.VarDimName={'nbvec1','nbvec1','nbvec1','nbvec1','nbvec1','nbvec1','nbvec1'};
    96         Data.VarAttribute{1}.Role='coord_x';
    97         Data.VarAttribute{2}.Role='coord_y';
    98         Data.VarAttribute{3}.Role='vector_x';
    99         Data.VarAttribute{4}.Role='vector_y';
    100         Data.VarAttribute{5}.Role='ancillary';
    101         Data.VarAttribute{6}.Role='warnflag';
    102         Data.VarAttribute{7}.Role='errorflag';
    103         Data.CivStage=1;
    104     end
    105113end
    106114
     
    119127%     Data.Fix1_ThreshVel=Param.Fix1.ThreshVel;
    120128%     Data.Fix1_UpperBoundTest=Param.Fix1.UpperBoundTest;
    121     Data.ListVarName=[Data.ListVarName {'Civ1_FF'}];
    122     Data.VarDimName=[Data.VarDimName {'nbvec1'}];
    123     nbvar=length(Data.ListVarName);
    124     Data.VarAttribute{nbvar}.Role='errorflag';   
    125     Data.Civ1_FF=fix_uvmat(Param.Fix1,Data.Civ1_F,Data.Civ1_C,Data.Civ1_U,Data.Civ1_V);
    126     Data.CivStage=2;                               
     129
     130    if test_civx
     131        if ~isfield(Data,'fix')
     132            Data.ListGlobalAttribute=[Data.ListGlobalAttribute 'fix'];
     133            Data.fix=1;
     134            Data.ListVarName=[Data.ListVarName {'vec_FixFlag'}];
     135            Data.VarDimName=[Data.VardimName {'nb_vectors'}];
     136        end
     137        Data.vec_FixFlag=fix_uvmat(Param.Fix1,Data.vec_F,Data.vec_C,Data.vec_U,Data.vec_V,Data.vec_X,Data.vec_Y);
     138    else
     139        Data.ListVarName=[Data.ListVarName {'Civ1_FF'}];
     140        Data.VarDimName=[Data.VarDimName {'nbvec1'}];
     141        nbvar=length(Data.ListVarName);
     142        Data.VarAttribute{nbvar}.Role='errorflag';   
     143        Data.Civ1_FF=fix_uvmat(Param.Fix1,Data.Civ1_F,Data.Civ1_C,Data.Civ1_U,Data.Civ1_V);
     144        Data.CivStage=2;   
     145    end
    127146end   
    128147%% Patch1
     
    246265%fieldref: 'civ1','filter1'...feld used in fileref
    247266
    248 function FF=fix_uvmat(Param,F,C,U,V)
     267function FF=fix_uvmat(Param,F,C,U,V,X,Y)
    249268%error=[]; %default
     269Param
    250270FF=zeros(size(F));%default
    251271
     
    270290    FF=FF==1 | (U.*U+V.*V)>thresh;
    271291end
     292if isfield(Param,'MaskName')
     293   M=imread(Param.MaskName);
     294   nxy=size(M);
     295   M=reshape(M,1,[]);
     296   rangx0=[0.5 nxy(2)-0.5];
     297   rangy0=[0.5 nxy(1)-0.5];
     298   vec_x1=X-U/2;%beginning points
     299   vec_x2=X+U/2;%end points of vectors
     300   vec_y1=Y-V/2;%beginning points
     301   vec_y2=Y+V/2;%end points of vectors
     302   indx=1+round((nxy(2)-1)*(vec_x1-rangx0(1))/(rangx0(2)-rangx0(1)));% image index x at abcissa vec_x1
     303   indy=1+round((nxy(1)-1)*(vec_y1-rangy0(1))/(rangy0(2)-rangy0(1)));% image index y at ordinate vec_y1   
     304   test_in=~(indx < 1 |indy < 1 | indx > nxy(2) |indy > nxy(1)); %=0 out of the mask image, 1 inside
     305   indx=indx.*test_in+(1-test_in); %replace indx by 1 out of the mask range
     306   indy=indy.*test_in+(1-test_in); %replace indy by 1 out of the mask range
     307   ICOMB=((indx-1)*nxy(1)+(nxy(1)+1-indy));%determine the indices in the image reshaped in a Matlab vector
     308   Mvalues=M(ICOMB);
     309   flag7b=((20 < Mvalues) & (Mvalues < 200))| ~test_in';
     310   indx=1+round((nxy(2)-1)*(vec_x2-rangx0(1))/(rangx0(2)-rangx0(1)));% image index x at abcissa vec_x2
     311   indy=1+round((nxy(1)-1)*(vec_y2-rangy0(1))/(rangy0(2)-rangy0(1)));% image index y at ordinate vec_y2
     312   test_in=~(indx < 1 |indy < 1 | indx > nxy(2) |indy > nxy(1)); %=0 out of the mask image, 1 inside
     313   indx=indx.*test_in+(1-test_in); %replace indx by 1 out of the mask range
     314   indy=indy.*test_in+(1-test_in); %replace indy by 1 out of the mask range
     315   ICOMB=((indx-1)*nxy(1)+(nxy(1)+1-indy));%determine the indices in the image reshaped in a Matlab vector
     316   Mvalues=M(ICOMB);
     317   flag7e=((Mvalues > 20) & (Mvalues < 200))| ~test_in';
     318   FF=FF==1 |(flag7b|flag7e)';
     319end
     320%    flag7=0;
     321% end   
     322
     323
    272324FF=double(FF);
    273325%
     
    311363%
    312364%             % flag7 introduce a grey mask, matrix M
    313 % if isequal (flag_mask,1)
    314 %    M=imread(maskname);
    315 %    nxy=size(M);
    316 %    M=reshape(M,1,nxy(1)*nxy(2));
    317 %    rangx0=[0.5 nxy(2)-0.5];
    318 %    rangy0=[0.5 nxy(1)-0.5];
    319 %    vec_x1=Field.X-Field.U/2;%beginning points
    320 %    vec_x2=Field.X+Field.U/2;%end points of vectors
    321 %    vec_y1=Field.Y-Field.V/2;%beginning points
    322 %    vec_y2=Field.Y+Field.V/2;%end points of vectors
    323 %    indx=1+round((nxy(2)-1)*(vec_x1-rangx0(1))/(rangx0(2)-rangx0(1)));% image index x at abcissa vec_x
    324 %    indy=1+round((nxy(1)-1)*(vec_y1-rangy0(1))/(rangy0(2)-rangy0(1)));% image index y at ordinate vec_y   
    325 %    test_in=~(indx < 1 |indy < 1 | indx > nxy(2) |indy > nxy(1)); %=0 out of the mask image, 1 inside
    326 %    indx=indx.*test_in+(1-test_in); %replace indx by 1 out of the mask range
    327 %    indy=indy.*test_in+(1-test_in); %replace indy by 1 out of the mask range
    328 %    ICOMB=((indx-1)*nxy(1)+(nxy(1)+1-indy));%determine the indices in the image reshaped in a Matlab vector
    329 %    Mvalues=M(ICOMB);
    330 %    flag7b=((20 < Mvalues) & (Mvalues < 200))| ~test_in';
    331 %    indx=1+round((nxy(2)-1)*(vec_x2-rangx0(1))/(rangx0(2)-rangx0(1)));% image index x at abcissa Field.X
    332 %    indy=1+round((nxy(1)-1)*(vec_y2-rangy0(1))/(rangy0(2)-rangy0(1)));% image index y at ordinate vec_y
    333 %    test_in=~(indx < 1 |indy < 1 | indx > nxy(2) |indy > nxy(1)); %=0 out of the mask image, 1 inside
    334 %    indx=indx.*test_in+(1-test_in); %replace indx by 1 out of the mask range
    335 %    indy=indy.*test_in+(1-test_in); %replace indy by 1 out of the mask range
    336 %    ICOMB=((indx-1)*nxy(1)+(nxy(1)+1-indy));%determine the indices in the image reshaped in a Matlab vector
    337 %    Mvalues=M(ICOMB);
    338 %    flag7e=((Mvalues > 20) & (Mvalues < 200))| ~test_in';
    339 %    flag7=(flag7b|flag7e)';
    340 % else
    341 %    flag7=0;
    342 % end   
     365
    343366% flagmagenta=flag1|flag2|flag3|flag4|flag5|flag7;
    344367% fixflag_unit=Field.FF-10*floor(Field.FF/10); %unity term of fix_flag
  • trunk/src/mouse_motion.m

    r248 r251  
    107107                if isfield(Field,'ListVarName')
    108108                    [CellVarIndex,NbDim,VarType]=find_field_indices(Field);%analyse the physical fields contained in Field
    109 %                     if isfield(Field,'Mesh') && ~isempty(Field.Mesh)
    110                         text_displ_1='';
    111                         text_displ_2='';
    112                         text_displ_3='';
    113                         text_displ_4='';
    114                         for icell=1:numel(CellVarIndex)%look for all physical fields
    115                             if NbDim(icell)>=2 % select 2D field
    116                                 if  isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data
    117                                     eval(['X=Field.' Field.ListVarName{VarType{icell}.coord_x} ';'])
    118                                     eval(['Y=Field.' Field.ListVarName{VarType{icell}.coord_y} ';'])
    119                                     flag_vec=(X<(xy(1,1)+Field.Mesh/3) & X>(xy(1,1)-Field.Mesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse
    120                                         (Y<(xy(1,2)+Field.Mesh/3) & Y>(xy(1,2)-Field.Mesh/3));%f
    121                                     ivec=find(flag_vec,1);% search the (first) selected vector index ivec                         
    122                                     hhh=findobj(haxes,'Tag','vector_marker');
    123                                     if ~isempty(ivec)
    124                                         % mark the vectors with a circle in the absence of other operations
    125                                         if ~test_object && ~test_edit_object && ~test_ruler
    126                                             pointershape='arrow'; %mouse indicates  the detection of a vector
    127                                             if isempty(hhh)
    128                                                 set(0,'CurrentFigure',currentfig)
    129                                                 set(currentfig,'CurrentAxes',haxes)
    130                                                 rectangle('Curvature',[1 1],...
    131                                                     'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh],'EdgeColor','m',...
    132                                                     'LineStyle','-','Tag','vector_marker');
    133                                             else
    134                                                 set(hhh,'Visible','on')
    135                                                 set(hhh,'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh])
    136                                             end
     109                    %                     if isfield(Field,'Mesh') && ~isempty(Field.Mesh)
     110                    text_displ_1='';
     111                    text_displ_2='';
     112                    text_displ_3='';
     113                    text_displ_4='';
     114                    ivec=[];
     115                    xName='';
     116                    z=[];
     117                    for icell=1:numel(CellVarIndex)%look for all physical fields
     118                        if NbDim(icell)>=2 % select 2D field
     119                            if  isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data
     120                                eval(['X=Field.' Field.ListVarName{VarType{icell}.coord_x} ';'])
     121                                eval(['Y=Field.' Field.ListVarName{VarType{icell}.coord_y} ';'])
     122                                flag_vec=(X<(xy(1,1)+Field.Mesh/3) & X>(xy(1,1)-Field.Mesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse
     123                                    (Y<(xy(1,2)+Field.Mesh/3) & Y>(xy(1,2)-Field.Mesh/3));%f
     124                                ivec=find(flag_vec,1);% search the (first) selected vector index ivec
     125                                hhh=findobj(haxes,'Tag','vector_marker');
     126                                if ~isempty(ivec)
     127                                    % mark the vectors with a circle in the absence of other operations
     128                                    if ~test_object && ~test_edit_object && ~test_ruler
     129                                        pointershape='arrow'; %mouse indicates  the detection of a vector
     130                                        if isempty(hhh)
     131                                            set(0,'CurrentFigure',currentfig)
     132                                            set(currentfig,'CurrentAxes',haxes)
     133                                            rectangle('Curvature',[1 1],...
     134                                                'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh],'EdgeColor','m',...
     135                                                'LineStyle','-','Tag','vector_marker');
     136                                        else
     137                                            set(hhh,'Visible','on')
     138                                            set(hhh,'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh])
    137139                                        end
    138                                         %display the field values
     140                                    end
     141                                    %display the field values
     142                                    for ivar=1:numel(CellVarIndex{icell})
     143                                        VarName=Field.ListVarName{CellVarIndex{icell}(ivar)};
     144                                        eval(['VarVal=Field.' VarName '(ivec);'])
     145                                        var_text=[VarName '=' num2str(VarVal,3) ','];
     146                                        if isequal(ivar,VarType{icell}.coord_x)||isequal(ivar,VarType{icell}.coord_y)||isequal(ivar,VarType{icell}.coord_z)
     147                                            text_displ_1=[text_displ_1 var_text];
     148                                        elseif isequal(ivar,VarType{icell}.vector_x)||isequal(ivar,VarType{icell}.vector_y)||isequal(ivar,VarType{icell}.vector_z)
     149                                            text_displ_3=[text_displ_3 var_text];
     150                                        else
     151                                            text_displ_4=[text_displ_4 var_text];
     152                                        end
     153                                    end
     154                                else
     155                                    if ~isempty(hhh)
     156                                        set(hhh,'Visible','off')
     157                                    end
     158                                end
     159                            elseif numel(VarType{icell}.coord) >=2 %structured coordinates
     160                                yName=Field.ListVarName{VarType{icell}.coord(1)};
     161                                xName=Field.ListVarName{VarType{icell}.coord(2)};
     162                                 eval(['y=Field.' yName ';'])
     163                                 eval(['x=Field.' xName ';'])
     164                                VarName=Field.ListVarName{CellVarIndex{icell}(1)};
     165                                eval(['nxy=size(Field.' VarName ');']);
     166                                MaxAY=max(y(1),y(end)); %#ok<COLND>
     167                                MinAY=min(y(1),y(end)); %#ok<COLND>
     168                                if (xy(1,1)>x(1))&(xy(1,1)<x(end))&(xy(1,2)<MaxAY)&(xy(1,2)>MinAY) %#ok<COLND>
     169                                    indx0=1+round((nxy(2)-1)*(xy(1,1)-x(1))/(x(end)-x(1)));%#ok<COLND> % index x of pixel
     170                                    indy0=1+round((nxy(1)-1)*(xy(1,2)-y(1))/(y(end)-y(1)));%#ok<COLND> % index y of pixel
     171                                    if indx0>=1 & indx0<=nxy(2) & indy0>=1 & indy0<=nxy(1)
     172                                        text_displ_2=['i='  num2str(indx0) ',j=' num2str(indy0) ','];
    139173                                        for ivar=1:numel(CellVarIndex{icell})
    140174                                            VarName=Field.ListVarName{CellVarIndex{icell}(ivar)};
    141                                             eval(['VarVal=Field.' VarName '(ivec);'])
    142                                             var_text=[VarName '=' num2str(VarVal,3) ','];
    143                                             if isequal(ivar,VarType{icell}.coord_x)||isequal(ivar,VarType{icell}.coord_y)||isequal(ivar,VarType{icell}.coord_z)
    144                                                 text_displ_1=[text_displ_1 var_text];
    145                                             elseif isequal(ivar,VarType{icell}.vector_x)||isequal(ivar,VarType{icell}.vector_y)||isequal(ivar,VarType{icell}.vector_z)
    146                                                 text_displ_3=[text_displ_3 var_text];
    147                                             else
    148                                                 text_displ_4=[text_displ_4 var_text];
    149                                             end
    150                                         end
    151                                     else
    152                                         if ~isempty(hhh)
    153                                             set(hhh,'Visible','off')
    154                                         end
    155                                     end
    156                                 elseif numel(VarType{icell}.coord) >=2 %structured coordinates
    157                                     eval(['y=Field.' Field.ListVarName{VarType{icell}.coord(1)} ';'])
    158                                     eval(['x=Field.' Field.ListVarName{VarType{icell}.coord(2)} ';'])
    159                                     VarName=Field.ListVarName{CellVarIndex{icell}(1)};
    160                                     eval(['nxy=size(Field.' VarName ');']);
    161                                     MaxAY=max(y(1),y(end)); %#ok<COLND>
    162                                     MinAY=min(y(1),y(end)); %#ok<COLND>
    163                                     if (xy(1,1)>x(1))&(xy(1,1)<x(end))&(xy(1,2)<MaxAY)&(xy(1,2)>MinAY) %#ok<COLND>
    164                                         indx0=1+round((nxy(2)-1)*(xy(1,1)-x(1))/(x(end)-x(1)));%#ok<COLND> % index x of pixel
    165                                         indy0=1+round((nxy(1)-1)*(xy(1,2)-y(1))/(y(end)-y(1)));%#ok<COLND> % index y of pixel
    166                                         if indx0>=1 & indx0<=nxy(2) & indy0>=1 & indy0<=nxy(1)
    167                                             text_displ_2=['i='  num2str(indx0) ',j=' num2str(indy0) ','];
    168                                             for ivar=1:numel(CellVarIndex{icell})
    169                                                 VarName=Field.ListVarName{CellVarIndex{icell}(ivar)};
    170                                                 eval(['VarVal=Field.' VarName '(indy0,indx0,:);'])
    171                                                 var_text=[VarName '=' num2str(VarVal) ','];
    172                                                 text_displ_2=[text_displ_2 var_text];
    173                                             end
     175                                            eval(['VarVal=Field.' VarName '(indy0,indx0,:);'])
     176                                            var_text=[VarName '=' num2str(VarVal) ','];
     177                                            text_displ_2=[text_displ_2 var_text];
    174178                                        end
    175179                                    end
     
    177181                            end
    178182                        end
    179 %                     end
    180                     if strcmp(text_displ_1,'')
    181                         text_displ_1=['x=' num2str(xy(1,1),3) ',y=' num2str(xy(1,2),3) ',']; 
    182                         z=[];
    183                         if isfield(Field,'PlaneCoord') && isfield(Field,'ZIndex')
    184                             ZIndex=Field.ZIndex;
    185                             if size(Field.PlaneCoord)>=[ZIndex 3]
    186                             z=Field.PlaneCoord(ZIndex,3);
     183                    end
     184              % display the current x,y coordinates in the absence of detected vector
     185                    if isempty(ivec)
     186                        if isempty(xName)
     187                            xName='x';
     188                            yName='y';
     189                        end
     190                        text_displ_1=[xName '=' num2str(xy(1,1),3) ', ' yName '=' num2str(xy(1,2),3) ','];
     191                    end
     192              %display the z coordinate if defined by the projection plane
     193                    if isfield(Field,'PlaneCoord')
     194%                             ZIndex=Field.ZIndex;
     195                        if size(Field.PlaneCoord)>=[1 3]
     196                            z=Field.PlaneCoord(1,3);
    187197                            if isfield(Field,'PlaneAngle')&&~isequal(Field.PlaneAngle,[0 0 0])
    188                                 om=norm(Field.PlaneAngle(ZIndex,:));%norm of rotation angle in radians
    189                                 OmAxis=Field.PlaneAngle(ZIndex,:)/om; %unit vector marking the rotation axis
     198                                om=norm(Field.PlaneAngle);%norm of rotation angle in radians
     199                                OmAxis=Field.PlaneAngle/om; %unit vector marking the rotation axis
    190200                                cos_om=cos(pi*om/180);
    191201                                sin_om=sin(pi*om/180);
     
    194204                                norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;
    195205                                norm_plane(3)=OmAxis(3)*coeff+cos_om;
    196                                 Z0=norm_plane*Field.PlaneCoord(ZIndex,:)'/norm_plane(3);
     206                                Z0=norm_plane*Field.PlaneCoord'/norm_plane(3);
    197207                                z=Z0-norm_plane(1)*xy(1,1)/norm_plane(3)-norm_plane(2)*xy(1,2)/norm_plane(3);
    198208                            end
    199                             end
    200                         end
    201                         if ~isempty(z)
    202                             text_displ_1=[text_displ_1 ' z=' num2str(z,3)]; %TODO: generaliser au cas avec angle
    203                         end
     209                        end
     210                    end
     211                    if ~isempty(z)
     212                        text_displ_1=[text_displ_1 ' z=' num2str(z,3)];
    204213                    end
    205214                    %coordinate transform if proj_coord differs from menu_coord A REVOIR
    206                     if isfield(Field,'CoordUnit')
    207                         mouse.CoordUnit=Field.CoordUnit;
    208                     end
    209215%                     if isfield(Field,'CoordUnit')
    210216%                         mouse.CoordUnit=Field.CoordUnit;
    211217%                     end
    212 %                     if isfield(mouse,'CoordType')
    213 %                         if isequal(mouse.CoordType,'px')
    214 %                             mouse.CoordUnit='px';
    215 %                         end
    216 %                     else
    217 %                         mouse.CoordUnit='';%default
    218 %                     end
    219                     if test_piv
    220                        par=civ('read_param_civ1',hhciv);
    221 %                        PointCoord=Field.X;
    222                        [dd,ind_pt]=min(abs(Field.X-xy(1,1))+abs(Field.Y-xy(1,2)));
    223 %                        [dd,ind_y]=min(abs(Field.Y-xy(1,2)));
    224                        xround=Field.X(ind_pt);
    225                        yround=Field.Y(ind_pt);
    226 %                             dx=str2double(par.dx);
    227 %                             dy=str2double(par.dy);
    228 %                             xround=x(1)+dx*round((xy(1,1)-x(1))/dx);% index x of pixel
    229 %                             yround=y(1)+dy*round((xy(1,2)-y(1))/dy);% index y of pixel
    230 %                         end
     218             % case of PIV correlation display
     219                    if test_piv
     220                        par=civ('read_param_civ1',hhciv);
     221                        [dd,ind_pt]=min(abs(Field.X-xy(1,1))+abs(Field.Y-xy(1,2)));
     222                        xround=Field.X(ind_pt);
     223                        yround=Field.Y(ind_pt);
    231224                        % mark the correlation box with a rectangle
    232225                        ibx2=floor((str2double(par.ibx)-1)/2);
     
    248241                                'LineStyle','- -','Tag','PIV_search_marker');
    249242                        else
    250 %                             set(hhh,'Visible','on')
    251243                            set(hhh,'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2])
    252244                            set(hhhh,'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2])
    253245                        end
    254246                        [xtable ytable utable vtable ctable typevector result_conv] = pivlab (Field.A,Field.B,ibx2,iby2,isx2,isy2,shiftx,shifty,[xround size(Field.A,1)-yround+1], 1, []);
    255 %                         Asub=Field.A(yround-iby2:yround+iby2,xround-ibx2:xround+ibx2);%first sub-image
    256 %                         Asub=reshape(Asub,[],1);%first sub-image reshaped as matlab vector
    257                          rangx(1)=-(isx2-ibx2)+shiftx;
    258                          rangx(2)=isx2-ibx2+shiftx;
    259                          rangy(1)=-(isy2-iby2)-shifty;
    260                          rangy(2)=(isy2-iby2)-shifty;
    261 %                         correl=zeros(rangy(2)-rangy(1)+1,rangx(2)-rangx(1)+1);
    262 %                         for id=rangx(1):rangx(2)
    263 %                             for jd=rangy(1):rangy(2)
    264 %                                 Bsub=Field.B(yround-iby2+jd:yround+iby2+jd,xround-ibx2+id:xround+ibx2+id);
    265 %                                 Bsub=reshape(Bsub,[],1);
    266 %                                 correl(jd-rangy(1)+1,id-rangx(1)+1)=corr(double(Asub),double(Bsub));
    267 %                             end
    268 %                         end
    269                         %correl=uint8(63.5*correl+63.5);
     247                        rangx(1)=-(isx2-ibx2)+shiftx;
     248                        rangx(2)=isx2-ibx2+shiftx;
     249                        rangy(1)=-(isy2-iby2)-shifty;
     250                        rangy(2)=(isy2-iby2)-shifty;
    270251                        hcorr=[];
    271                         if isfield(AxeData,'CurrentCorrImage')                       
     252                        if isfield(AxeData,'CurrentCorrImage')
    272253                            hcorr=AxeData.CurrentCorrImage;
    273254                            if ~ishandle(hcorr)
     
    287268                            end
    288269                        else
    289                            % set(AxeData.CurrentCorrImage,'CData',correl)
    290270                            set(AxeData.CurrentCorrImage,'CData',result_conv)
    291271                            set(AxeData.CurrentCorrImage,'XData',rangx)
    292272                            set(AxeData.CurrentCorrImage,'YData',-rangy)
    293273                            set(AxeData.CurrentVector,'XData',[0 utable],'YData',[0 -vtable])
    294                         end       
     274                        end
    295275                    end
    296276                end
    297             end     
     277            end
    298278        end
    299279    end
  • trunk/src/uvmat.m

    r248 r251  
    14941494            maskname=maskfiles(ilist).name;% take the first mask file in the list
    14951495            [rr,ff,x1,x2,xa,xb,xext,Mask_NomType{ilist}]=name2display(maskname);
    1496 %
    1497 %             if ~strcmp(Mask_NomType{ilist},Mask_NomType{1})
    1498 %                 msgbox_uvmat('ERROR',['inconsistent mask types ' Mask_NomType{1} ' and ' Mask_NomType{ilist } ' coexist in the current image directory'])
    1499 %                 return
    1500 %             end
    15011496            [Path2,Name,ext]=fileparts(maskname);
    15021497            Namedouble=double(Name);
     
    15231518            num_i1=mod(num_i1-1,nbslice)+1;
    15241519            Mask.NomType=regexprep(Mask_NomType{1},'0','');%remove '0' in nom type for masks
    1525             [maskname,mdetect]=name_generator(Mask.Base,num_i1,num_j1,'.png',Mask.NomType);%
     1520            maskname=name_generator(Mask.Base,num_i1,num_j1,'.png',Mask.NomType);%
    15261521            mdetect=exist(maskname,'file');
    15271522            if mdetect
Note: See TracChangeset for help on using the changeset viewer.