Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 163)
+++ trunk/src/uvmat.m	(revision 174)
@@ -426,5 +426,5 @@
 end
 [FileName, PathName] = uigetfile( ...
-       {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol;*.nc;*.cmx;*.fig;*.log;*.dat;*.bat;', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.vol,*.nc,*.cmx ,*.fig,*.log,*.dat,*.bat)';
+       {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol;*.nc;*.cmx;*.fig;*.log;*.dat;*.bat;', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.vol,*.nc,*.cmx,*.fig,*.log,*.dat,*.bat)';
        '*.xml',  '.xml files '; ...
         '*.xls',  '.xls files '; ...
@@ -437,6 +437,5 @@
         '*.nc','.netcdf files'; ...
         '*.cdf','.netcdf files'; ...
-        '*.cmx','.cmx text files';...
-        '*.cmx2','.cmx2 text files';...
+        '*.cmx','.cmx text files ';...
         '*.fig','.fig files (matlab fig)';...
         '*.log','.log text files ';...
@@ -2205,4 +2204,5 @@
 %read images
 if ~isempty(filename) && isequal(FieldName,'image')
+    Npz=1;%default
      switch FileType
         case 'movie'
@@ -2223,4 +2223,8 @@
         case 'vol'
             A=imread(filename);
+            if isfield(UvData.XmlData,'Npy')
+                Npz=size(A,1)/UvData.XmlData.Npy;
+                A=reshape(A,Npz,UvData.XmlData.Npy,UvData.XmlData.Npx);
+            end
         case 'multimage'
             A=imread(filename,num_i1);
@@ -2235,13 +2239,22 @@
     Field{1}.AName='image';
     Field{1}.ListVarName={'AY','AX','A'}; % 
-    if size(A,3)==3;%color
-        Field{1}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %
+    if ndims(A)==3 
+        if Npz==1;%color
+             Field{1}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %
+             Field{1}.AY=[npxy(1)-0.5 0.5];
+             Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
+        else
+            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}.AY=[npxy(2)-0.5 0.5];
+            Field{1}.AX=[0.5 npxy(3)-0.5]; % coordinates of the first and last pixel centers
+        end
     else
         Field{1}.VarDimName={'AY','AX',{'AY','AX'}}; %
-    end
-    Field{1}.AY=Rangy;
-    Field{1}.AX=Rangx;
+        Field{1}.AY=[npxy(1)-0.5 0.5];
+       Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
+    end
     Field{1}.A=A;
-   % Field{1}.CoordType='px'; %used for mouse_motion
     Field{1}.CoordUnit='pixel'; %used for mouse_motion
 end
@@ -2488,6 +2501,6 @@
 test_x=0;
 test_z=0;% test for unstructured z coordinate
-UvData.ZMax=0;
-UvData.ZMin=0;%default
+% UvData.ZMax=0;
+% UvData.ZMin=0;%default
 %UvData.Mesh=1; %default
 [UvData.Field,errormsg]=check_field_structure(UvData.Field);
@@ -2522,6 +2535,7 @@
     YName=UvData.Field.ListVarName{VarType{imax}.coord(2)};
     XName=UvData.Field.ListVarName{VarType{imax}.coord(3)};
-end
-
+    eval(['ZMax=max(UvData.Field.' ZName ');'])
+    eval(['ZMin=min(UvData.Field.' ZName ');'])
+end
 eval(['XMax=max(UvData.Field.' XName ');'])
 eval(['XMin=min(UvData.Field.' XName ');'])
@@ -2565,5 +2579,5 @@
 UvData.Field.YMax=XMax;
 UvData.Field.YMin=XMin;
-if test_z
+if NbDim==3
     UvData.Field.ZMax=ZMax;
     UvData.Field.ZMin=ZMin;
@@ -2642,6 +2656,6 @@
 if NbDim==3 && UvData.NewSeries
     UvData.Object{1}.NbDim=UvData.NbDim;%test for 3D objects
-    UvData.Object{1}.RangeZ=Field.Mesh;%main plotting plane
-    UvData.Object{1}.Coord(1,3)=(UvData.ZMin+UvData.ZMax)/2;%section at a middle plane chosen
+    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;
@@ -2649,6 +2663,6 @@
     UvData.Object{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR  
     PlotHandles=get_plot_handles(handles);
-    ZBounds(1)=UvData.ZMin; %minimum for the Z slider
-    ZBounds(2)=UvData.ZMax;%maximum for the Z slider
+    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;
