Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 178)
+++ trunk/src/uvmat.m	(revision 179)
@@ -52,5 +52,4 @@
 %          .VelType_1: last velocity type (civ1, civ2...) for the second input series
 %          .FieldName_1: last field name(velocity, vorticity...) for the second input series
-%          .NbDim: number of space dimensions of the input field
 %          .ZMin, .ZMax: range of the z coordinate
 %..... to complement
@@ -1225,5 +1224,5 @@
     nburst_1=1;
     set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
-    time=[0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond]';
+    time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';
     ColorType=imainfo.ImageType;%='truecolor' for color images
     hhh=which('mmreader');
@@ -1333,6 +1332,6 @@
 else
     UvData.GeometryCalib_1=GeometryCalib;
-    if (isfield(GeometryCalib,'R')& ~isequal(GeometryCalib.R(2,1),0) & ~isequal(GeometryCalib.R(1,2),0)) |...
-        (isfield(GeometryCalib,'kappa1')& ~isequal(GeometryCalib.kappa1,0))
+    if (isfield(GeometryCalib,'R')&& ~isequal(GeometryCalib.R(2,1),0) && ~isequal(GeometryCalib.R(1,2),0)) ||...
+        (isfield(GeometryCalib,'kappa1')&& ~isequal(GeometryCalib.kappa1,0))
         set(handles.pxcm,'String','var')
         set(handles.pycm,'String','var')
@@ -1591,5 +1590,4 @@
 end
 num_i1_mask=mod(num_i1-1,MaskData.NbSlice)+1;
-MaskData.NomType
 MaskName=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType);
 huvmat=get(handles.mask_test,'parent');
@@ -2227,5 +2225,6 @@
             if isfield(UvData.XmlData,'Npy')
                 Npz=size(A,1)/UvData.XmlData.Npy;
-                A=reshape(A,Npz,UvData.XmlData.Npy,UvData.XmlData.Npx);
+                A=reshape(A',UvData.XmlData.Npx,UvData.XmlData.Npy,Npz);
+                A=permute(A,[3 2 1]);
             end
         case 'multimage'
@@ -2239,4 +2238,5 @@
     Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
     Rangy=[npxy(1)-0.5 0.5]; %
+    Field{1}.NbDim=2;%default
     Field{1}.AName='image';
     Field{1}.ListVarName={'AY','AX','A'}; % 
@@ -2247,7 +2247,8 @@
              Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
         else
+            Field{1}.NbDim=3;
             Field{1}.ListVarName=['AZ' Field{1}.ListVarName];
             Field{1}.VarDimName={'AZ','AY','AX',{'AZ','AY','AX'}}; 
-            Field{1}.AZ=[0.5 npxy(1)-0.5];
+            Field{1}.AZ=[npxy(1)-0.5 0.5];
             Field{1}.AY=[npxy(2)-0.5 0.5];
             Field{1}.AX=[0.5 npxy(3)-0.5]; % coordinates of the first and last pixel centers
@@ -2342,5 +2343,5 @@
             end
             CivStage=Field{1}.CivStage;
-            UvData.NbDim=Field{1}.nb_dim;
+            %UvData.NbDim=Field{1}.NbDim;
         end
     end
@@ -2411,6 +2412,5 @@
 end
 %put W as background image by default if NbDim=2:
-if ~isfield(UvData,'NbDim')||isempty(UvData.NbDim)||~isequal(UvData.NbDim,3)
-    if UvData.NewSeries && isequal(get(handles.SubField,'Value'),0) && isfield(Field{1},'W') && ~isempty(Field{1}.W);
+if  UvData.NewSeries && isequal(get(handles.SubField,'Value'),0) && isfield(Field{1},'W') && ~isempty(Field{1}.W) && ~isequal(Field{1}.NbDim,3);
         set(handles.SubField,'Value',1);
         %menu=update_menu(handles.Fields_1,'w');%update the menu for the background scalar nd set the choice to 'w'
@@ -2430,18 +2430,11 @@
         set(handles.Fields_1,'Visible','on');
         Field{1}.AName='w';
-%         testscal=1;
-    end
 end           
 
 %multislice case
-if ~isempty(filename) &&(~isfield(UvData,'NbDim') || isequal(UvData.NbDim,2))&&...%2D case
-      isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')&& isfield(UvData.XmlData.GeometryCalib,'SliceCoord')
-       siz=size(UvData.XmlData.GeometryCalib.SliceCoord);
-%        if siz(1)>1
-%            NbSlice=siz(1);
-%        else
-%            NbSlice=1;
-%        end
-end
+% if ~isempty(filename) &&(~isfield(UvData,'NbDim') || isequal(UvData.NbDim,2))&&...%2D case
+%       isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')&& isfield(UvData.XmlData.GeometryCalib,'SliceCoord')
+%        siz=size(UvData.XmlData.GeometryCalib.SliceCoord);
+% end
 
 %store the current open names, fields and vel types in uvmat interface 
@@ -2493,7 +2486,8 @@
     Field{2}=calc_field(InputField_1,Field{2});
 end
-% combine the two input fields (e.g. substract velocity fields)
+
+%% combine the two input fields (e.g. substract velocity fields)
 if numel(Field)==2
-   UvData.Field=sub_field(Field{1},Field{2}); %TO UPDATE FOR MORE GENERAL INPUT  
+   UvData.Field=sub_field(Field{1},Field{2});  
 else
    UvData.Field=Field{1};
@@ -2503,7 +2497,4 @@
 test_x=0;
 test_z=0;% test for unstructured z coordinate
-% UvData.ZMax=0;
-% UvData.ZMin=0;%default
-%UvData.Mesh=1; %default
 [UvData.Field,errormsg]=check_field_structure(UvData.Field);
 if ~isempty(errormsg)
@@ -2513,16 +2504,4 @@
 [CellVarIndex,NbDim,VarType]=find_field_indices(UvData.Field);
 [NbDim,imax]=max(NbDim);
-% if isempty(imax)
-% %    DimVarIndex=0;    
-%     coord_x=[];
-% else
-% %     VarIndex=CellVarIndex{imax};
-%     coord_x=VarType{imax}.coord_x;
-% end
-% if isfield(UvData,'NbDim') && ~isempty(UvData.NbDim)
-%     NbDim=UvData.NbDim;
-% else  
-UvData.NbDim=NbDim;
-% end
 if ~isempty(VarType{imax}.coord_x)  && ~isempty(VarType{imax}.coord_y)    %unstructured coordinates
     XName=UvData.Field.ListVarName{VarType{imax}.coord_x};
@@ -2530,13 +2509,17 @@
     eval(['nbvec=length(UvData.Field.' XName ');'])%nbre of measurement points (e.g. vectors)
     test_x=1;%test for unstructured coordinates
-elseif NbDim==2
-    YName=UvData.Field.ListVarName{VarType{imax}.coord(1)}; %structured coordinates
-    XName=UvData.Field.ListVarName{VarType{imax}.coord(2)};
-elseif NbDim==3
+else %structured coordinate
+    YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates
+    XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)};
+end
+if NbDim==3
     ZName=UvData.Field.ListVarName{VarType{imax}.coord(1)};%structured coordinates in 3D
-    YName=UvData.Field.ListVarName{VarType{imax}.coord(2)};
-    XName=UvData.Field.ListVarName{VarType{imax}.coord(3)};
     eval(['ZMax=max(UvData.Field.' ZName ');'])
     eval(['ZMin=min(UvData.Field.' ZName ');'])
+    test_z=1;
+    if isequal(ZMin,ZMax)%no z dependency
+        NbDim=2;
+        test_z=0;
+    end
 end
 eval(['XMax=max(UvData.Field.' XName ');'])
@@ -2545,21 +2528,5 @@
 eval(['YMin=min(UvData.Field.' YName ');'])
 eval(['nbvec=length(UvData.Field.' XName ');'])
-if NbDim==3%
-    if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_z)%unstructured coordinate z
-%         ZName=UvData.Field.ListVarName{VarType{imax}.coord_z};
-        eval(['ZMax=max(UvData.Field.' ZName ');'])
-        eval(['ZMin=min(UvData.Field.' ZName ');'])
-        test_z=1;   
-    elseif isfield(UvData,'Z')% usual civ data
-        ZMax=max(UvData.Z);
-        ZMin=min(UvData.Z);
-        test_z=1;
-    end
-    if isequal(ZMin,ZMax)%no z dependency
-        NbDim=2;
-        test_z=0;
-    end
-end
-if test_x
+if test_x %unstructured coordinates
     if test_z
         UvData.Field.Mesh=((XMax-XMin)*(YMax-YMin)*(ZMax-ZMin))/nbvec;% volume per vector
@@ -2571,121 +2538,86 @@
     VarIndex=CellVarIndex{imax}; % list of variable indices
     DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable
-    nbpoints_y=UvData.Field.DimValue(DimIndex(1));
-    nbpoints_x=UvData.Field.DimValue(DimIndex(2));
-    DX=(XMax-XMin)/nbpoints_x;
-    DY=(YMax-YMin)/nbpoints_y;
-    UvData.Field.Mesh=sqrt(DX*DY);
-end
+    nbpoints_y=UvData.Field.DimValue(DimIndex(NbDim-1));
+    nbpoints_x=UvData.Field.DimValue(DimIndex(NbDim));
+    DX=(XMax-XMin)/(nbpoints_x-1);
+    DY=(YMax-YMin)/(nbpoints_y-1);
+    if NbDim==3
+        nbpoints_z=UvData.Field.DimValue(DimIndex(1));
+        DZ=(ZMax-ZMin)/(nbpoints_z-1);
+        UvData.Field.Mesh=sqrt(DX*DY*DZ);
+        UvData.Field.ZMax=ZMax;
+        UvData.Field.ZMin=ZMin;
+    else
+        UvData.Field.Mesh=sqrt(DX*DY);
+    end
+end
+UvData.Field.NbDim=NbDim;
 UvData.Field.XMax=XMax;
 UvData.Field.XMin=XMin;
-UvData.Field.YMax=XMax;
-UvData.Field.YMin=XMin;
-if NbDim==3
-    UvData.Field.ZMax=ZMax;
-    UvData.Field.ZMin=ZMin;
-end
-
-%case of structured coordinates
-
-% if  isempty(coord_x) && ~isempty(CellVarIndex)
-%     VarIndex=CellVarIndex{imax}; % list of variable indices
-%     DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable
-%     if NbDim==3
-%         nbpoints=UvData.Field.DimValue(DimIndex(1));
-%         if isfield(VarType{imax},'coord_3')&& ~isequal(VarType{imax}.coord_3,0) % z is a dimension variable
-%             ZName=UvData.Field.ListVarName{VarType{imax}.coord_3};
-%             eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])
-%             eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])
-%         else
-%             testcoord_z=0;
-%             if length(UvData.Field.VarAttribute)>=VarIndex(1)
-%                 if isfield(UvData.Field.VarAttribute{VarIndex(1)},'Coord_1')%regular grid 
-%                     Coord_z=UvData.Field.VarAttribute{VarIndex(1)}.Coord_1;
-%                     UvData.ZMax=max(Coord_z);
-%                     UvData.ZMin=min(Coord_z);
-%                     testcoord_z=1;
-%                 end
-%             end
-%             if ~testcoord_z
-%                   UvData.ZMin=1;
-%                   UvData.ZMax=UvData.Field.DimValue(DimIndex(1));
-%             end
-%         end
-%         Field.Mesh=(UvData.ZMax-UvData.ZMin)/(nbpoints-1); 
-%     elseif NbDim==2
-%         nbpoints_y=UvData.Field.DimValue(DimIndex(1));       
-%         Yvar=VarType{imax}.coord_y;
-%         if Yvar~=0  % x is a dimension variable
-%             YName=UvData.Field.ListVarName{Yvar};
-%             eval(['UvData.YMax=max(UvData.Field.' YName ');'])
-%             eval(['UvData.YMin=min(UvData.Field.' YName ');'])
-%         else
-%             testcoord_y=0;
-%             if ~testcoord_y
-%                   UvData.YMin=1;
-%                   UvData.YMax=UvData.Field.DimValue(DimIndex(1));
-%             end
-%         end
-%         DY=(UvData.YMax-UvData.YMin)/(nbpoints_y-1);
-%         nbpoints_x=UvData.Field.DimValue(DimIndex(2));
-%         Xvar=VarType{imax}.coord_x;
-%         if Xvar~=0  % x is a dimension variable
-%             XName=UvData.Field.ListVarName{Xvar};
-%             eval(['UvData.XMax=max(UvData.Field.' XName ');'])
-%             eval(['UvData.XMin=min(UvData.Field.' XName ');'])
-%         else
-%             testcoord_x=0;
-%             if ~testcoord_x
-%                   UvData.XMin=1;
-%                   UvData.XMax=UvData.Field.DimValue(DimIndex(2));
-%             end
-%         end
-%         DX=(UvData.XMax-UvData.XMin)/(nbpoints_x-1);
-%         Field.Mesh= sqrt(DX*DY); 
-%     end
-% end
-
-%create a default projection menuplane
+UvData.Field.YMax=YMax;
+UvData.Field.YMin=YMin;
+
+%% create a default projection menuplane
 UvData.Object{1}.Style='plane';%main plotting plane
 UvData.Object{1}.ProjMode='projection';%main plotting plane
+UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
+
+
+%% 3D case (menuvolume)
+if NbDim==3% && UvData.NewSeries
+    test_set_object=1;
+    hset_object=findobj(allchild(0),'tag','set_object');
+    ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
+    ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
+    if ~isempty(hset_object)
+        hhset_object=guidata(hset_object);
+        ZBounds_old(1)=get(hhset_object.z_slider,'Min');
+        ZBounds_old(2)=get(hhset_object.z_slider,'Max');
+        if isequal(ZBounds_old,ZBounds)
+            test_set_object=0;
+        else
+            delete(test_set_object);
+        end
+    end
+    if test_set_object% reinitiate set_object
+        delete_object(1);
+        UvData.Object{1}.Style='plane';%main plotting plane
+        UvData.Object{1}.ProjMode='projection';%main plotting plane
+        UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
+        UvData.Object{1}.NbDim=NbDim;%test for 3D objects
+        UvData.Object{1}.RangeZ=UvData.Field.Mesh;%main plotting plane
+        UvData.Object{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
+        UvData.Object{1}.Phi=0;
+        UvData.Object{1}.Theta=0;
+        UvData.Object{1}.Psi=0;
+        UvData.Object{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR
+        PlotHandles=get_plot_handles(handles);
+        UvData.Object{1}.Name='1-PLANE';
+        UvData.Object{1}.enable_plot=1;
+        set_object(UvData.Object{1},PlotHandles,ZBounds);
+        set(handles.list_object_1,'Value',1);
+    end
+    %multilevel case (single menuplane in a 3D space)
+elseif isfield(UvData,'Z')
+    if isfield(UvData,'CoordType')&& isequal(UvData.CoordType,'phys') && isfield(UvData,'XmlData')
+        XmlData=UvData.XmlData;
+        if isfield(XmlData,'PlanePos')
+            UvData.Object{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:);
+        end
+        if isfield(XmlData,'PlaneAngle')
+            siz=size(XmlData.PlaneAngle);
+            indangle=min(siz(1),UvData.ZIndex);%take first angle if a single angle is defined (translating scanning)
+            UvData.Object{1}.Phi=XmlData.PlaneAngle(indangle,1);
+            UvData.Object{1}.Theta=XmlData.PlaneAngle(indangle,2);
+            UvData.Object{1}.Psi=XmlData.PlaneAngle(indangle,3);
+        end
+    elseif isfield(UvData,'ZIndex')
+        UvData.Object{1}.ZObject=UvData.ZIndex;
+    end
+end
 if ~isfield(UvData.Object{1},'plotaxes')
     UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
     set(handles.list_object_1,'Value',1);
     set(handles.list_object_1,'String',{'1-PLANE'});  
-end
-
-%3D case (menuvolume)
-if NbDim==3 && UvData.NewSeries
-    UvData.Object{1}.NbDim=UvData.NbDim;%test for 3D objects
-    UvData.Object{1}.RangeZ=UvData.Field.Mesh;%main plotting plane
-    UvData.Object{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
-    UvData.Object{1}.Phi=0;
-    UvData.Object{1}.Theta=0;
-    UvData.Object{1}.Psi=0;
-    UvData.Object{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR  
-    PlotHandles=get_plot_handles(handles);
-    ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
-    ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
-    UvData.Object{1}.Name='1-PLANE';
-    UvData.Object{1}.enable_plot=1;
-    set_object(UvData.Object{1},PlotHandles,ZBounds);
-    set(handles.list_object_1,'Value',1);
-%multilevel case (single menuplane in a 3D space)
-elseif isfield(UvData,'Z')
-    if isfield(UvData,'CoordType')&& isequal(UvData.CoordType,'phys') && isfield(UvData,'XmlData')
-        XmlData=UvData.XmlData;
-        if isfield(XmlData,'PlanePos')
-             UvData.Object{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:);
-        end
-        if isfield(XmlData,'PlaneAngle')
-            siz=size(XmlData.PlaneAngle);
-            indangle=min(siz(1),UvData.ZIndex);%take first angle if a single angle is defined (translating scanning)              
-            UvData.Object{1}.Phi=XmlData.PlaneAngle(indangle,1);
-            UvData.Object{1}.Theta=XmlData.PlaneAngle(indangle,2);
-            UvData.Object{1}.Psi=XmlData.PlaneAngle(indangle,3);
-        end
-    elseif isfield(UvData,'ZIndex')
-        UvData.Object{1}.ZObject=UvData.ZIndex;
-    end
 end
 
@@ -3569,5 +3501,5 @@
 set(handles.uvmat,'UserData',UvData)
 setfield(handles);% update the field structure ('civ1'....)
-if ~isfield(UvData,'NewSeries')|isequal(UvData.NewSeries,0)
+if ~isfield(UvData,'NewSeries')||isequal(UvData.NewSeries,0)
     run0_Callback(hObject, eventdata, handles)
 end
@@ -3830,6 +3762,6 @@
 npx=size(UvData.Field.A,2);
 npy=size(UvData.Field.A,1);
-xi=[0.5:npx-0.5];
-yi=[0.5:npy-0.5];
+xi=0.5:npx-0.5;
+yi=0.5:npy-0.5;
 [Xi,Yi]=meshgrid(xi,yi);
 if isfield(UvData,'Object')
@@ -3884,5 +3816,5 @@
 RootPath=get(handles.RootPath,'String');
 RootFile=get(handles.RootFile,'String');
-if ~isempty(RootFile)&(isequal(RootFile(1),'/')| isequal(RootFile(1),'\'))
+if ~isempty(RootFile)&&(isequal(RootFile(1),'/')|| isequal(RootFile(1),'\'))
         RootFile(1)=[];
 end
@@ -4184,34 +4116,43 @@
     Amax=double(max(max(max(FieldHisto))));%max of image
     if isequal(Amin,Amax)
-       Histo.Txt=['uniform field =' num2str(Amin)];
+        msgbox_uvmat('WARNING',['uniform field =' num2str(Amin)]);
     else
-    Histo.ListVarName={FieldName,'histo'};
-    if numel(nxy)==2
-        Histo.VarDimName={FieldName,FieldName}; %dimensions for the histogram
-    else %color images
-        Histo.VarDimName={FieldName,{FieldName,'rgb'}}; %dimensions for the histogram
-    end
-    %unit
-    units=[]; %default
-    for ivar=1:numel(Field.ListVarName)    
-        if strcmp(Field.ListVarName{ivar},FieldName)
-            if isfield(Field,'VarAttribute') && numel(Field.VarAttribute)>=ivar && isfield(Field.VarAttribute{ivar},'units')
-                units=Field.VarAttribute{ivar}.units;
-                break
+        Histo.ListVarName={FieldName,'histo'};
+        if isequal(Field.NbDim,3)
+            Histo.VarDimName={FieldName,FieldName}; %dimensions for the histogram
+        else
+            if numel(nxy)==2
+                Histo.VarDimName={FieldName,FieldName}; %dimensions for the histogram
+            else
+                Histo.VarDimName={FieldName,{FieldName,'rgb'}}; %dimensions for the histogram
             end
         end
-    end
-    if ~isempty(units)
-        Histo.VarAttribute{1}.units=units;
-    end
-    eval(['Histo.' FieldName '=linspace(Amin,Amax,50);'])%absissa values for histo
-    for col=1:size(FieldHisto,3)
-        B=FieldHisto(:,:,col);
-        C=reshape(double(B),1,nxy(1)*nxy(2));% reshape in a vector
-       eval(['Histo.histo(:,col)=hist(C, Histo.' FieldName ');']);  %calculate histogram
-    end
-    set(haxes,'XLimMode','auto')%reset auto mode (after zoom effect)
-    set(haxes,'YLimMode','auto')
-    plot_field(Histo,haxes);
+        %unit
+        units=[]; %default
+        for ivar=1:numel(Field.ListVarName)
+            if strcmp(Field.ListVarName{ivar},FieldName)
+                if isfield(Field,'VarAttribute') && numel(Field.VarAttribute)>=ivar && isfield(Field.VarAttribute{ivar},'units')
+                    units=Field.VarAttribute{ivar}.units;
+                    break
+                end
+            end
+        end
+        if ~isempty(units)
+            Histo.VarAttribute{1}.units=units;
+        end
+        eval(['Histo.' FieldName '=linspace(Amin,Amax,50);'])%absissa values for histo
+        if isequal(Field.NbDim,3)
+            C=reshape(double(FieldHisto),1,[]);% reshape in a vector
+            eval(['Histo.histo(:,1)=hist(C, Histo.' FieldName ');']);  %calculate histogram
+        else
+            for col=1:size(FieldHisto,3)
+                B=FieldHisto(:,:,col);
+                C=reshape(double(B),1,nxy(1)*nxy(2));% reshape in a vector
+                eval(['Histo.histo(:,col)=hist(C, Histo.' FieldName ');']);  %calculate histogram
+            end
+        end
+        set(haxes,'XLimMode','auto')%reset auto mode (after zoom effect)
+        set(haxes,'YLimMode','auto')
+        plot_field(Histo,haxes);
     end
 end
@@ -4376,5 +4317,5 @@
 % colcode.CName= list_code{index_code(1)}; % selected field used for vector color
 colcode.FixedCbounds=1;
-vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*[0.5:width-0.5]/width;%sample of vec_C values from min to max
+vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*(0.5:width-0.5)/width;%sample of vec_C values from min to max
 [colorlist,col_vec]=set_col_vec(colcode,vec_C);
 oneheight=ones(1,height);
@@ -4510,5 +4451,5 @@
 hother=findobj('Tag','proj_object');%find all the proj objects
 for iobj=1:length(hother)
-    if isequal(get(hother(iobj),'Type'),'rectangle')|isequal(get(hother(iobj),'Type'),'patch')
+    if isequal(get(hother(iobj),'Type'),'rectangle')||isequal(get(hother(iobj),'Type'),'patch')
         set(hother(iobj),'EdgeColor','b')
         if isequal(get(hother(iobj),'FaceColor'),'m')
@@ -4791,9 +4732,9 @@
         end
     end
-    % flag=~flag;
+    
     %mask name
     RootPath=get(handles.RootPath,'String');
     RootFile=get(handles.RootFile,'String');
-    if ~isempty(RootFile)&(isequal(RootFile(1),'/')| isequal(RootFile(1),'\'))
+    if ~isempty(RootFile)&&(isequal(RootFile(1),'/')|| isequal(RootFile(1),'\'))
         RootFile(1)=[];
     end
