Index: /trunk/src/find_file_series.m
===================================================================
--- /trunk/src/find_file_series.m	(revision 934)
+++ /trunk/src/find_file_series.m	(revision 935)
@@ -68,5 +68,5 @@
     i1_series=[];i2_series=[];j1_series=[];j2_series=[];
     i1_input=1;i2_input=[];j1_input=[];j2_input=[];
-    if ~exist(fullfileinput,'file')
+    if exist(fullfileinput,'file')~=2
         RootFile='';
         return
Index: /trunk/src/get_file_info.m
===================================================================
--- /trunk/src/get_file_info.m	(revision 934)
+++ /trunk/src/get_file_info.m	(revision 935)
@@ -37,5 +37,5 @@
 function [FileInfo,VideoObject]=get_file_info(fileinput)
 VideoObject=[];
-if exist(fileinput,'file')
+if exist(fileinput,'file')==2
     FileInfo.FileName=fileinput;
     FileInfo.FileType='txt'; %default
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 934)
+++ /trunk/src/proj_field.m	(revision 935)
@@ -951,6 +951,6 @@
 PlaneAngle=[0 0 0];
 norm_plane=[0 0 1];
-cos_om=1;
-sin_om=0;
+%cos_om=1;
+%sin_om=0;
 test90x=0;%=1 for 90 degree rotation alround x axis
 test90y=0;%=1 for 90 degree rotation alround y axis
@@ -1052,8 +1052,8 @@
     ProjData.CoordMesh=FieldData.CoordMesh;
 end
-error=0;%default
-flux=0;
-testfalse=0;
-ListIndex={};
+%error=0;%default
+%flux=0;
+%testfalse=0;
+%ListIndex={};
 
 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
@@ -1340,4 +1340,56 @@
             if strcmp(ProjMode{icell},'interp_tps')
                 Coord=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex});
+                
+                
+                coord_x=Coord(:,1,:);% initial x coordinates
+            coord_y=Coord(:,2,:);% initial y coordinates
+            check3D=(numel(CellInfo{icell}.CoordIndex)==3);
+            if check3D
+                coord_z=Coord(:,3,:);
+            end
+            
+            % translate  initial coordinates to account for the new origin
+            coord_x=coord_x-ObjectData.Coord(1,1);
+            coord_y=coord_y-ObjectData.Coord(1,2);
+            if check3D
+                coord_z=coord_z-ObjectData.Coord(1,3);
+            end
+            
+            % selection of the vectors in the projection range (3D case)
+            if check3D &&  width > 0
+                %components of the unitiy vector normal to the projection plane
+                fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane
+                indcut=find(abs(fieldZ) <= width);
+                for ivar=VarIndex
+                    VarName=FieldData.ListVarName{ivar};
+                    FieldData.(VarName)=FieldData.(VarName)(indcut);
+                end
+                coord_x=coord_x(indcut);
+                coord_y=coord_y(indcut);
+                coord_z=coord_z(indcut);
+            end
+            
+            %rotate coordinates if needed: coord_X,coord_Y= = coordinates in the new plane
+            Psi=PlaneAngle(1);
+            Theta=PlaneAngle(2);
+            Phi=PlaneAngle(3);
+            if testangle && ~test90y && ~test90x;%=1 for slanted plane
+                coord_X=(coord_x *cos(Phi) + coord_y* sin(Phi));
+                coord_Y=(-coord_x *sin(Phi) + coord_y *cos(Phi))*cos(Theta);
+                coord_Y=coord_Y+coord_z *sin(Theta);
+                coord_X=(coord_X *cos(Psi) - coord_Y* sin(Psi));%A VERIFIER
+                coord_Y=(coord_X *sin(Psi) + coord_Y* cos(Psi));
+            else
+                coord_X=coord_x;
+                coord_Y=coord_y;
+            end
+            
+            %restriction to the range of X and Y if imposed by the projection object
+
+                
+                Coord(:,1,:)=coord_X;% initial x coordinates
+            Coord(:,2,:)=coord_Y;% initial y coordinates
+                
+                
                 NbCentres=FieldData.(FieldData.ListVarName{CellInfo{icell}.NbCentres_tps});
                 SubRange=FieldData.(FieldData.ListVarName{CellInfo{icell}.SubRange_tps});
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 934)
+++ /trunk/src/series.m	(revision 935)
@@ -518,100 +518,77 @@
 set(handles.InputTable,'Data',InputTable)
 REFRESH_Callback(hObject, eventdata, handles)
-% DataSeries=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
-% fileinput=uigetfile_uvmat('pick an input file',DataSeries);
-% hh=dir(fileinput);
-% if numel(hh)>1
-%     msgbox_uvmat('ERROR','invalid input, probably a broken link');
+
+
+% %------------------------------------------------------------------------
+% % --- fct activated by the browser under 'Open campaign/Browse...'
+% %------------------------------------------------------------------------ 
+% function MenuBrowseCampaignAppend_Callback(hObject, eventdata, handles)
+% append='append';
+% browse_campaign(handles,append);
+
+% %------------------------------------------------------------------------
+% function browse_campaign(handles,append);
+% 
+% %% look for the previously opened file 'oldfile'
+% 
+% % 
+% % 
+% % InputTable=get(handles.InputTable,'Data');
+% % RootPath=InputTable{1,1};
+% % CampaignPath=fileparts(fileparts(RootPath));
+% % DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir');
+% % if ~ischar(DirFull)|| ~exist(DirFull,'dir')
+% %     return
+% % end
+% OutPut=browse_data(oldfile);% open the GUI browse_data to get select a campaign dir, experiment and device
+% if ~isfield(OutPut,'Campaign')
+%     return
+% end
+% DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
+% ListStruct=dir(DirName); %list files and the dir DataSeries
+% % select the first appropriate file in the dir
+% FileName='';
+% for ilist=1:numel(ListStruct)
+%     if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir
+%         FileName=ListStruct(ilist).name;
+%         FileInfo=get_file_info(fullfile(DirName,FileName));
+%         switch FileInfo.FileType
+%             case {'image','multimage','civx','civdata','netcdf'}
+%                 break
+%         end
+%     end
+% end
+% if isempty(FileName)
+%     msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)])
 %     return
 % end
 % 
-% 
-% 
-% %% launch the browser
-% fileinput=uigetfile_uvmat('pick an input file in the series',oldfile);
-% hh=dir(fileinput);
-% if numel(hh)>1
-%     msgbox_uvmat('ERROR','invalid input, probably a broken link');
-% else
-%     if ~isempty(fileinput)
-%         display_file_name(handles,fileinput,'one')
+% %% update the list of campaigns in the menubar
+% MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};...
+%     {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}];
+% check_dir=isempty(find(strcmp(DirName,MenuCampaign)));
+% if check_dir %insert the new campaign in the list if it is not found
+%     MenuCampaign(end)=[]; %suppress the last item
+%     MenuCampaign=[{DirName};MenuCampaign];%insert the new campaign
+%     for ilist=1:numel(MenuCampaign)
+%         set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist})
+%     end
+%     % save the list for future opening:
+%     dir_perso=prefdir;
+%     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
+%     if exist(profil_perso,'file')
+%         save (profil_perso,'MenuCampaign','-append'); %store the file names for future opening of uvmat
+%     else
+%         save (profil_perso,'MenuCampaign','-V6'); %store the file names for future opening of uvmat
 %     end
 % end
-% append='one';
-% set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])
-% drawnow
-% browse_campaign(handles,append);
-
-%------------------------------------------------------------------------
-% --- fct activated by the browser under 'Open campaign/Browse...'
-%------------------------------------------------------------------------ 
-function MenuBrowseCampaignAppend_Callback(hObject, eventdata, handles)
-append='append';
-browse_campaign(handles,append);
-
-%------------------------------------------------------------------------
-function browse_campaign(handles,append);
-
-%% look for the previously opened file 'oldfile'
-
 % 
-% 
-% InputTable=get(handles.InputTable,'Data');
-% RootPath=InputTable{1,1};
-% CampaignPath=fileparts(fileparts(RootPath));
-% DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir');
-% if ~ischar(DirFull)|| ~exist(DirFull,'dir')
-%     return
+% %% display the selected field and related information
+% if get(handles.CheckAppend,'Value')
+%     display_file_name(handles,fullfile(DirName,FileName),'append')
+% else
+%     display_file_name(handles,fullfile(DirName,FileName),'one')
 % end
-OutPut=browse_data(oldfile);% open the GUI browse_data to get select a campaign dir, experiment and device
-if ~isfield(OutPut,'Campaign')
-    return
-end
-DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
-ListStruct=dir(DirName); %list files and the dir DataSeries
-% select the first appropriate file in the dir
-FileName='';
-for ilist=1:numel(ListStruct)
-    if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir
-        FileName=ListStruct(ilist).name;
-        FileInfo=get_file_info(fullfile(DirName,FileName));
-        switch FileInfo.FileType
-            case {'image','multimage','civx','civdata','netcdf'}
-                break
-        end
-    end
-end
-if isempty(FileName)
-    msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)])
-    return
-end
-
-%% update the list of campaigns in the menubar
-MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};...
-    {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}];
-check_dir=isempty(find(strcmp(DirName,MenuCampaign)));
-if check_dir %insert the new campaign in the list if it is not found
-    MenuCampaign(end)=[]; %suppress the last item
-    MenuCampaign=[{DirName};MenuCampaign];%insert the new campaign
-    for ilist=1:numel(MenuCampaign)
-        set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist})
-    end
-    % save the list for future opening:
-    dir_perso=prefdir;
-    profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
-    if exist(profil_perso,'file')
-        save (profil_perso,'MenuCampaign','-append'); %store the file names for future opening of uvmat
-    else
-        save (profil_perso,'MenuCampaign','-V6'); %store the file names for future opening of uvmat
-    end
-end
-
-%% display the selected field and related information
-if get(handles.CheckAppend,'Value')
-    display_file_name(handles,fullfile(DirName,FileName),'append')
-else
-    display_file_name(handles,fullfile(DirName,FileName),'one')
-end
-set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
+% set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
 
 % --------------------------------------------------------------------
@@ -619,26 +596,64 @@
 % -------------------------------------------------------------------- 
 set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])
-OutPut=browse_data(get(hObject,'Label'));% open the GUI browse_data to get select a campaign dir, experiment and device
+OutPut=browse_data(get(hObject,'Label'),'on','on');% open the GUI browse_data to get select a campaign dir, experiment and device
 if ~isfield(OutPut,'Campaign')
     return
 end
-DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
-hdir=dir(DirName); %list files and dirs
-for ilist=1:numel(hdir)
-    if ~isequal(hdir(ilist).isdir,1)%look for files, not dir
-        FileName=hdir(ilist).name;
-        FileInfo=get_file_info(fullfile(DirName,FileName));
-        switch FileInfo.FileType
-            case {'image','multimage','civx','civdata','netcdf'}
-            break
-        end
-    end
-end
-if get(handles.CheckAppend,'Value')
-    display_file_name(handles,fullfile(DirName,FileName),'append')
-else
-    display_file_name(handles,fullfile(DirName,FileName),'one')
-end
-set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
+NbLines=numel(OutPut.Experiment)*numel(OutPut.DataSeries);
+icount=0;
+InputTable=get(handles.InputTable,'Data');
+for iexp=1:numel(OutPut.Experiment)
+    for idevice=1:numel(OutPut.DataSeries)
+        icount=icount+1;
+        InputTable{icount,1}=fullfile(OutPut.Campaign,OutPut.Experiment{iexp});
+        InputTable{icount,2}=OutPut.DataSeries{idevice};
+        if isempty(InputTable{icount,3})
+            if icount>1
+                InputTable{icount,3}=InputTable{icount-1,3};
+            else
+                InputTable{icount,3}='';
+            end
+        end
+        if isempty(InputTable{icount,4})
+            if icount>1
+                InputTable{icount,4}=InputTable{icount-1,4};
+            else
+                InputTable{icount,4}='';
+            end
+        end
+        if isempty(InputTable{icount,5})
+            if icount>1
+                InputTable{icount,5}=InputTable{icount-1,5};
+            else
+                InputTable{icount,5}='';
+            end
+        end
+    end
+end
+if size(InputTable,1)>icount
+    InputTable(icount+1:size(InputTable,1),:)=[];
+end
+set(handles.InputTable,'Data',InputTable)
+REFRESH_Callback(hObject, eventdata, handles)
+
+
+% DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
+% hdir=dir(DirName); %list files and dirs
+% for ilist=1:numel(hdir)
+%     if ~isequal(hdir(ilist).isdir,1)%look for files, not dir
+%         FileName=hdir(ilist).name;
+%         FileInfo=get_file_info(fullfile(DirName,FileName));
+%         switch FileInfo.FileType
+%             case {'image','multimage','civx','civdata','netcdf'}
+%             break
+%         end
+%     end
+% end
+% if get(handles.CheckAppend,'Value')
+%     display_file_name(handles,fullfile(DirName,FileName),'append')
+% else
+%     display_file_name(handles,fullfile(DirName,FileName),'one')
+% end
+% set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
 
 
@@ -1610,13 +1625,14 @@
         NbCore=1;% no need to split the calculation
     case 'cluster_oar'
-        if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
-            NbCore=1;% one core used only (limitation of Matlab licences)
-            answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
-            if ~strcmp(answer,'Yes')
-                errormsg='Action launch interrupted by user';
-                return
-            end
-            extra_oar='';
-        else
+        %%%%% TEST A REMETTRE%%%%%
+ %       if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
+%             NbCore=1;% one core used only (limitation of Matlab licences)
+%             answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
+%             if ~strcmp(answer,'Yes')
+%                 errormsg='Action launch interrupted by user';
+%                 return
+%             end
+%             extra_oar='';
+ %       else
             answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});
             if isempty(answer)
@@ -1626,5 +1642,5 @@
             NbCore=str2double(answer{1});
             extra_oar=answer{2};
-        end
+ %       end
     case 'cluster_pbs'
         if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
@@ -1698,5 +1714,5 @@
 DirXml=fullfile(OutputDir,'0_XML');
 if ~exist(DirXml,'dir')
-    [tild,msg1]=mkdir(DirXml);
+    [~,msg1]=mkdir(DirXml);
     if ~strcmp(msg1,'')
         errormsg=['cannot create ' DirXml ': ' msg1];%error message for directory creation
@@ -2113,7 +2129,10 @@
 end
 if exist(OutputDir,'dir')
+    [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir)
+    if MESSAGE.GroupWrite~=1
     [success,msg] = fileattrib(OutputDir,'+w','g','s');% allow writing access for the group of users, recursively in the folder
     if success==0
-        msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg1});%error message for directory creation
+        msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg});%error message for directory creation
+    end
     end
 end
Index: /trunk/src/series/extract_rdvision.m
===================================================================
--- /trunk/src/series/extract_rdvision.m	(revision 934)
+++ /trunk/src/series/extract_rdvision.m	(revision 935)
@@ -469,11 +469,12 @@
 NbDti=size(timestamp,1); %default for series or burst
 uid_motor_nbslice=find(t,'ImaDoc/TranslationMotor/Nbslice');
-if ~isempty(uid_motor_nbslice)
+uid_nbDtk=find(t,'ImaDoc/TranslationMotor/NbDtk');
+if ~isempty(uid_motor_nbslice)&& ~isempty(uid_nbDtk)
     uid_content=get(t,uid_motor_nbslice,'contents');
     NbSlice=str2num(get(t,uid_content,'value'));
     NbDti=NbSlice-1;
-uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti');
-uid_content=get(t,uid_NbDti,'contents');
-t=set(t,uid_content,'value',num2str(NbDti));
+    uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti');
+    uid_content=get(t,uid_NbDti,'contents');
+    t=set(t,uid_content,'value',num2str(NbDti));
 end
 
@@ -510,5 +511,5 @@
        [success,msg] = fileattrib(newxml,'+w','g');% allow writing access for the group of users  
         if success==0
-            msgbox_uvmat('WARNING',{['unable to set group write access to ' newxml ':']; msg1});%error message for directory creation
+            msgbox_uvmat('WARNING',{['unable to set group write access to ' newxml ':']; msg});%error message for directory creation
         end
 
Index: /trunk/src/transform_field/phys_polar.m
===================================================================
--- /trunk/src/transform_field/phys_polar.m	(revision 934)
+++ /trunk/src/transform_field/phys_polar.m	(revision 935)
@@ -67,4 +67,7 @@
     DataOut.TransformInput.PolarReferenceRadius=str2num(answer{2}); 
     DataOut.TransformInput.PolarReferenceAngle=str2num(answer{3}); 
+    if isfield(XmlData,'GeometryCalib')&& isfield(XmlData.GeometryCalib,'CoordUnit')
+        DataOut.CoordUnit=XmlData.GeometryCalib.CoordUnit;% states that the output is in unit defined by GeometryCalib, then erased all projection objects with different units
+    end
     return
 end
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 934)
+++ /trunk/src/uvmat.m	(revision 935)
@@ -3585,4 +3585,7 @@
     if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority
         XmlData=UvData.XmlData{1};
+        if isfield(UvData,'TransformInput')
+            XmlData.TransformInput=UvData.TransformInput;
+        end
         if numel(UvData.XmlData)==2
             XmlData_1=UvData.XmlData{2};
@@ -4949,4 +4952,7 @@
             XmlData=UvData.XmlData{1};
         end
+        if isfield(UvData,'TransformInput')
+            XmlData.TransformInput=UvData.TransformInput;
+        end
         UvData.Field.Action.RUN=0;% indicate that the transform fct is called only to get input param
         DataOut=feval(transform_handle,UvData.Field,XmlData);% execute the transform fct to get the required conditions
@@ -4958,5 +4964,5 @@
         end
         if isfield(DataOut,'TransformInput')%  used to add transform parameters at selection of the transform fct
-            UvData.XmlData{1}.TransformInput=DataOut.TransformInput;
+            UvData.TransformInput=DataOut.TransformInput;
         end
     end
