Changeset 1152 for trunk


Ignore:
Timestamp:
Jul 4, 2024, 4:23:43 PM (3 months ago)
Author:
sommeria
Message:

update_xml simlified, bug on civ_series corrected

Location:
trunk/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/filter_tps.m

    r1143 r1152  
    106106            ind_ind_sel=1:numel(ind_sel);%default
    107107            if exist('Threshold','var')&&~isempty(Threshold)
    108                 FF(ind_sel)=2*(NormDiff>Threshold);%put FF value to 2 to identify the criterium of elimmination
     108                FF(ind_sel)=4*(NormDiff>Threshold);%put FF value to 4 to identify the criterium of elimmination
    109109                ind_ind_sel=find(FF(ind_sel)==0); % select the indices of remaining vectors in the subset of ind_sel vectors
    110110            end
     
    166166U_smooth=U_smooth./nb_select;% take the average at the intersection of several subdomains
    167167V_smooth=V_smooth./nb_select;
    168 U_smooth(FF==2)=U(FF==2);% set to the initial values the eliminated vectors (flagged as false)
    169 V_smooth(FF==2)=V(FF==2);
     168U_smooth(FF==4)=U(FF==4);% set to the initial values the eliminated vectors (flagged as false)
     169V_smooth(FF==4)=V(FF==4);
    170170fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    171171Coord_tps=cat(1,Coord_tps,fill);
  • trunk/src/find_imadoc.m

    r1127 r1152  
    22% take into account the old conventions
    33%-----------------------------------------------------------------------
    4 % function XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt)
     4% function XmlFileName=find_imadoc(RootPath,SubDir)
    55%
    66% OUTPUT:
     
    88%
    99% INPUT:
    10 % RootPath,SubDir,RootFile,FileExt, as given from the input file name by fileparts_uvmat
     10% RootPath: path to the folder containing the image series,
     11% SubDir: name of the folder containing the image series
    1112
    1213%=======================================================================
     
    2829%=======================================================================
    2930
    30 function XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt)
    31 SubDirBase=SubDir;
    32 XmlFileName=fullfile(RootPath,[SubDir '.xml']);
    33 if ~exist (XmlFileName,'file')
    34     dotchar=regexp(SubDir,'\.');
     31function XmlFileName=find_imadoc(RootPath,SubDir)
     32
     33dotchar=regexp(SubDir,'\.');%detect the dots in the folder name
     34if isempty(dotchar)
     35    XmlFileName=fullfile(RootPath,[SubDir '.xml']);
     36else %go upward to the root name, stop if an xml file already exists
    3537    for idot=1:numel(dotchar)
    36         XmlFileName=fullfile(RootPath,[SubDir(1:dotchar(end-idot+1)-1) '.xml']);
     38        SubDir=SubDir(1:dotchar(end-idot+1)-1);
     39        XmlFileName=fullfile(RootPath,[SubDir '.xml']);
    3740        if exist(XmlFileName,'file')
    38             SubDirBase=fullfile(RootPath,SubDir(1:dotchar(end-idot+1)-1));
    3941            break
    40         end
    41     end   
    42 end
    43 if ~exist(XmlFileName,'file')
    44     XmlFileName=[fullfile(RootPath,SubDirBase,RootFile) '.xml']; % old convention: xml inside the image folder, case of images or new civ files
    45     if ~exist(XmlFileName,'file')
    46         XmlFileName=[fullfile(RootPath,SubDirBase,RootFile) '.civ']; % very old convention: .civ file
    47         if ~exist(XmlFileName,'file') && strcmp(FileExt,'.nc')
    48             XmlFileName=[fullfile(RootPath,RootFile) '.xml'] ; % old convention: xml inside the image folder, old civ file opened
    49             if ~exist(XmlFileName,'file')
    50                 XmlFileName=[fullfile(RootPath,RootFile) '.civ']; % very old convention: .civ file
    51             end
    5242        end
    5343    end
    5444end
    55 if ~exist(XmlFileName,'file')% convention Pierre Augier for 3D images
    56     check3D=find(~isempty(regexp(SubDirBase,'^level')));
    57     if check3D
    58         [RootRootPath,RootDir]=fileparts(RootPath);
    59         XmlFileName=fullfile(RootRootPath,[RootDir '.xml']);
    60         dotchar=regexp(RootDir,'\.');
    61         for idot=1:numel(dotchar)
    62             XmlFileName=fullfile(RootRootPath,[RootDir(1:dotchar(end-idot+1)-1) '.xml']);
    63             if exist(XmlFileName,'file')
    64                 break
    65             end
    66         end
    67     end
    68 end
    69 if exist(XmlFileName,'file')~=2
     45if ~exist(XmlFileName,'file')
    7046    XmlFileName='';
    7147end
     48
     49
     50
  • trunk/src/geometry_calib.m

    r1151 r1152  
    125125if exist('inputfile','var')&& ~isempty(inputfile)
    126126    [RootPath,SubDir,RootFile,tild,tild,tild,tild,FileExt]=fileparts_uvmat(inputfile);
    127     struct.XmlInputFile=find_imadoc(RootPath,SubDir,RootFile,FileExt);
     127    struct.XmlInputFile=find_imadoc(RootPath,SubDir);
    128128    set(handles.ListCoord,'Data',[])
    129129    if exist(struct.XmlInputFile,'file')
     
    305305            end
    306306            if find(~cellfun('isempty',strfind(ListDataSeries,'.')))
    307                 msgbox_uvmat('ERROR','select only folders at the root, without dot (.) in the name');
    308                 return
     307                msgbox_uvmat('WARNING','select folders at the root, without dot (.) in the name');
    309308            end
    310309            NbExp=0; % counter of the number of experiments set by the GUI browse_data
     
    332331            NbErrors=0;
    333332            for iexp=1:NbExp
    334                 XmlName=fullfile(ListPath{iexp},[ListSubdir{iexp} '.xml']);
    335                 if exist(XmlName,'file')
    336                     check_update=1;
    337                 else
    338                     check_update=0;
    339                 end
    340                 errormsg=update_imadoc(GeometryCalib,XmlName,'GeometryCalib');% introduce the calibration data in the xml file
     333                [check_update,xmlfile,errormsg]=update_imadoc(ListPath{iexp},ListSubdir{iexp},'GeometryCalib',GeometryCalib);% introduce the calibration data in the xml file
    341334                dispmessage='';
    342335                if checkslice
    343                     errormsg=update_imadoc(Slice,XmlName,'Slice');% introduce the slice position in the xml file
     336                   [~,~,errormsg]=update_imadoc(ListPath{iexp},ListSubdir{iexp},'Slice',Slice,0);% introduce the slice position in the xml file
    344337                    dispmessage=' and slice position';
    345338                end
     
    349342                else
    350343                    if check_update
    351                         disp([XmlName ' updated with calibration parameters' dispmessage]);
     344                        disp([xmlfile ' updated with calibration parameters' dispmessage]);
    352345                    else
    353                         disp([XmlName ' created with calibration parameters: no timing defined' dispmessage]);
     346                        disp([xmlfile ' created with calibration parameters: no timing defined' dispmessage]);
    354347                    end
    355348                end
     
    363356    else
    364357        %% update the calibration parameters in the currently opened uvmat GUI
    365         if ~exist(outputfile,'file') && ~isempty(SubDirBase) %copy the xml file from the old location if appropriate
    366             oldxml=[fullfile(RootPath,SubDirBase,get(hhuvmat.RootFile,'String')) '.xml'];
    367             if exist(oldxml,'file')
    368                 [success,message]=copyfile(oldxml,outputfile);%copy the old xml file to a new one with the new convention
    369             end
    370         end
    371         errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');% introduce the calibration data in the xml file
     358        % if ~exist(outputfile,'file') && ~isempty(SubDirBase) %copy the xml file from the old location if appropriate
     359        %     oldxml=[fullfile(RootPath,SubDirBase,get(hhuvmat.RootFile,'String')) '.xml'];
     360        %     if exist(oldxml,'file')
     361        %         [success,message]=copyfile(oldxml,outputfile);%copy the old xml file to a new one with the new convention
     362        %     end
     363        % endSlice,
     364        [~,~,errormsg]=update_imadoc(RootPath,get(hhuvmat.SubDir,'String'),'GeometryCalib',GeometryCalib);% introduce the calibration data in the xml file
    372365        if checkslice
    373             errormsg=update_imadoc(Slice,outputfile,'Slice');% introduce the slice position in the xml file
     366          [~,~,errormsg]=update_imadoc(RootPath,get(hhuvmat.SubDir,'String'),'Slice',Slice,0);% introduce the slice position in the xml file
    374367        end
    375368        if ~strcmp(errormsg,'')
     
    839832
    840833%------------------------------------------------------------------------
    841 % --- Executes on button press in STORE.
     834% --- Executes on button press in STORE: store the current points
    842835function STORE_Callback(hObject, eventdata, handles)
    843836%------------------------------------------------------------------------
    844837Coord=get(handles.ListCoord,'Data');
    845 %Object=read_geometry_calib(Coord_cell);
    846838unitlist=get(handles.CoordUnit,'String');
    847839unit=unitlist{get(handles.CoordUnit,'value')};
     
    850842huvmat=findobj(allchild(0),'Name','uvmat');
    851843hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
    852 % RootPath='';
    853 % RootFile='';
    854 if ~isempty(hhuvmat.RootPath)&& ~isempty(hhuvmat.RootFile)
    855     %     testhandle=1;
     844if ~isempty(hhuvmat.RootPath)&& ~isempty(hhuvmat.SubDir)
    856845    RootPath=get(hhuvmat.RootPath,'String');
    857     RootFile=get(hhuvmat.RootFile,'String');
    858     filebase=[fullfile(RootPath,RootFile) '~'];
     846    SubDir=get(hhuvmat.SubDir,'String');
     847    filebase=[fullfile(RootPath,SubDir) '~'];
    859848    while exist([filebase '.xml'],'file')
    860849        filebase=[filebase '~'];
    861850    end
    862851    outputfile=[filebase '.xml'];
    863     errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');
     852    [~,RootFile]=fileparts(filebase);
     853    [~,~,errormsg]=update_imadoc(RootPath,SubDir,'GeometryCalib',GeometryCalib,0);
    864854    if ~strcmp(errormsg,'')
    865855        msgbox_uvmat('ERROR',errormsg);
  • trunk/src/plot_field.m

    r1144 r1152  
    12191219    if ~isempty(ivar_FF_vec)
    12201220        if isfield(PlotParam.Vectors,'CheckShowFalse') && PlotParam.Vectors.CheckShowFalse==1
    1221            % colorlist(nbcolor,:)=[1 0 1];% magenta color
    1222             colorlist(nbcolor,:)=[0 0 0];% blackcolor
     1221            colorlist(nbcolor,:)=[1 0 1];% magenta color
     1222            %colorlist(nbcolor,:)=[0 0 0];% blackcolor
    12231223            if strcmp(PlotParam.Vectors.FalseCriteria,'ALL')
    12241224                col_vec(vec_FF~=0)=nbcolor;
  • trunk/src/read_multimadoc.m

    r1127 r1152  
    4242timecell=cell(1,nbview);
    4343for iview=1:nbview%Loop on views
    44     XmlFileName=find_imadoc(RootPath{iview},SubDir{iview},RootFile{iview},FileExt{iview});
     44    XmlFileName=find_imadoc(RootPath{iview},SubDir{iview});
    4545    if ~isempty(XmlFileName)
    4646        [XmlData{iview},warnmsg]=imadoc2struct(XmlFileName);% read the ImaDoc xml file
  • trunk/src/series.m

    r1150 r1152  
    949949XmlData=[];
    950950check_calib=0;
    951 XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5});
     951XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2});
    952952if ~isempty(XmlFileName)
    953953    [XmlData,errormsg]=imadoc2struct(XmlFileName);
  • trunk/src/series/civ_3D.m

    r1151 r1152  
    189189%% get timing from the ImaDoc file or input video
    190190if iview_A~=0
    191     XmlFileName=find_imadoc(RootPath_A,SubDir_A,RootFile_A,FileExt_A);
     191    XmlFileName=find_imadoc(RootPath_A,SubDir_A);
    192192    Time=[];
    193193    if ~isempty(XmlFileName)
  • trunk/src/series/civ_input.m

    r1148 r1152  
    23622362% --- Executes on selection change in field_ref2.
    23632363function field_ref2_Callback(hObject, eventdata, handles)
    2364 
    2365 
    2366 
  • trunk/src/series/civ_series.m

    r1148 r1152  
    256256%% get timing from the ImaDoc file or input video
    257257if iview_A~=0
    258     XmlFileName=find_imadoc(RootPath_A,SubDir_A,RootFile_A,FileExt_A);
     258    XmlFileName=find_imadoc(RootPath_A,SubDir_A);
    259259    Time=[];
    260260    if ~isempty(XmlFileName)
     
    488488        end
    489489        if strcmp(Param.ActionInput.ListCompareMode, 'PIV volume')
    490             Data.ListVarName=[Data.ListVarName 'Civ1_Z'];
    491             Data.Civ1_X=[];Data.Civ1_Y=[];Data.Civ1_Z=[];
    492             Data.Civ1_U=[];Data.Civ1_V=[];Data.Civ1_C=[];
    493             for ivol=1:NbSlice
    494                 % caluclate velocity data (y and v in indices, reverse to y component)
    495                 [xtable, ytable, utable, vtable, ctable, F, result_conv, errormsg] = civ (par_civ1);
    496                 if ~isempty(errormsg)
    497                     disp_uvmat('ERROR',errormsg,checkrun)
    498                     return
    499                 end
    500                 Data.Civ1_X=[Data.Civ1_X reshape(xtable,[],1)];
    501                 Data.Civ1_Y=[Data.Civ1_Y reshape(Param.Civ1.ImageHeight-ytable+1,[],1)];
    502                 Data.Civ1_Z=[Data.Civ1_Z ivol*ones(numel(xtable),1)];% z=image index in image coordinates
    503                 Data.Civ1_U=[Data.Civ1_U reshape(utable,[],1)];
    504                 Data.Civ1_V=[Data.Civ1_V reshape(-vtable,[],1)];
    505                 Data.Civ1_C=[Data.Civ1_C reshape(ctable,[],1)];
    506                 Data.Civ1_FF=[Data.Civ1_FF reshape(F,[],1)];
    507             end
     490            % Data.ListVarName=[Data.ListVarName 'Civ1_Z'];
     491            % Data.Civ1_X=[];Data.Civ1_Y=[];Data.Civ1_Z=[];
     492            % Data.Civ1_U=[];Data.Civ1_V=[];Data.Civ1_C=[];
     493            % for ivol=1:NbSlice
     494            %     % caluclate velocity data (y and v in indices, reverse to y component)
     495            %     [xtable, ytable, utable, vtable, ctable, F, result_conv, errormsg] = civ (par_civ1);
     496            %     if ~isempty(errormsg)
     497            %         disp_uvmat('ERROR',errormsg,checkrun)
     498            %         return
     499            %     end
     500            %     Data.Civ1_X=[Data.Civ1_X reshape(xtable,[],1)];
     501            %     Data.Civ1_Y=[Data.Civ1_Y reshape(Param.Civ1.ImageHeight-ytable+1,[],1)];
     502            %     Data.Civ1_Z=[Data.Civ1_Z ivol*ones(numel(xtable),1)];% z=image index in image coordinates
     503            %     Data.Civ1_U=[Data.Civ1_U reshape(utable,[],1)];
     504            %     Data.Civ1_V=[Data.Civ1_V reshape(-vtable,[],1)];
     505            %     Data.Civ1_C=[Data.Civ1_C reshape(ctable,[],1)];
     506            %     Data.Civ1_FF=[Data.Civ1_FF reshape(F,[],1)];
     507            % end
    508508        else %usual PIV
    509509            % caluclate velocity data (y and v in indices, reverse to y component)
  • trunk/src/series/merge_proj.m

    r1147 r1152  
    338338            end
    339339            [MaskData,~,errormsg] = read_field(maskname,'image');
     340            if ~isempty(NbSlice_calib)
     341            MaskData.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform
     342        end
    340343            if ~isempty(transform_fct) && nargin(transform_fct)>=2
    341344                MaskData=transform_fct(MaskData,XmlData{iview});
  • trunk/src/series/stereo_civ.m

    r1126 r1152  
    9595time=[];
    9696for iview=1:size(Param.InputTable,1)
    97     XmlFileName=find_imadoc(Param.InputTable{iview,1},Param.InputTable{iview,2},Param.InputTable{iview,3},Param.InputTable{iview,5});
     97    XmlFileName=find_imadoc(Param.InputTable{iview,1},Param.InputTable{iview,2});
    9898    if isempty(XmlFileName)
    9999        disp_uvmat('ERROR', [XmlFileName ' not found'],checkrun)
  • trunk/src/update_imadoc.m

    r1151 r1152  
    11%'update_imadoc': update an xml file with geometric calibration parameters
    22%--------------------------------------------------------------------------
    3 %  function update_imadoc(Struct,outputfile)
     3%  function [checkcreate,xmlfile,errormsg]=update_imadoc(Struct,RootPath,SubDir,StructName)
    44%
    5 %INPUT:
    6 % Struct: structure containing the calibration parameters
    7 % outputfile: xml file to modify
     5% OUTPUT:
     6% checkupdate= 1 if the xml file (containing timing)already exist, =0 when it has to be created
     7% xmlfile: name of the xmlfile containing the the calibration data
     8% errormsg: error message, ='' if OK
     9
     10% INPUT:
     11
     12% RootPath: path to the folder containing the image series to calibrate
     13% SubDir: folder contaiting the image series to calibrate
    814% StructName : Name of the field in the xml file
     15% Struct: Matlab structure containing the calibration parameters
     16% checkbackup=1 (default): backup of existing xml file as .xml~,
    917%-------------------------------------------------------------
    1018
     
    2735%=======================================================================
    2836
    29 function errormsg=update_imadoc(Struct,outputfile,StructName)
     37function [checkupdate,xmlfile,errormsg]=update_imadoc(RootPath,SubDir,StructName,Struct,checkbackup)
     38
    3039errormsg='';
    31 testappend=0;
     40if ~exist('checkbackup','var')
     41    checkbackup=1;
     42end
    3243
    3344%% set the output xml file at the root, hide other existing  xml files
    34 dotchar=regexp(outputfile,'\.');
    35 for idot=1:numel(dotchar)
    36     outputfile=[outputfile(1:dotchar(end-idot+1)-1) '.xml'];
    37     if exist(outputfile,'file')
    38          backupfile=outputfile;
    39          testexist=2;
     45xmlfile=find_imadoc(RootPath,SubDir);
     46if isempty(xmlfile)
     47    checkupdate=0;
     48else
     49    checkupdate=1;
     50end
     51
     52%% backup the existing xml file, adding a ~ to its name
     53if checkupdate
     54    if checkbackup
     55        backupfile=xmlfile;
     56        testexist=2;
    4057        while testexist==2
    4158            backupfile=[backupfile '~'];
    4259            testexist=exist(backupfile,'file');
    4360        end
    44         [success,message]=movefile(outputfile,backupfile);%make backup
     61        [success,message]=copyfile(xmlfile,backupfile);%make backup
    4562        if success~=1
    4663            errormsg=['errror in xml file backup: ' message];
     
    4865        end
    4966    end
    50 end
    51 
    52 
    53 %% backup the output file if it already exist, and read it
    54 if exist(outputfile,'file')%=1 if the output file already exists, 0 else
    55     testappend=1;
    56     t=xmltree(outputfile); %read the file
     67    t=xmltree(xmlfile); %read the file
    5768    title=get(t,1,'name');
    5869    if ~strcmp(title,'ImaDoc')
    59         errormsg=[outputfile ' not appropriate for calibration'];
     70        errormsg=[xmlfile ' not appropriate for calibration'];
    6071        return
    6172    end
     
    6778        t=delete(t,uid_child);
    6879    end
    69 end
    70 
    71 %% create a new xml file
    72 if ~testappend
     80else   % create a new xml file
    7381    t=xmltree;
    7482    t=set(t,1,'name','ImaDoc');
    75     % in case of movie (avi file), copy timing info in the new xml file
    76     [pp,outputroot]=fileparts(outputfile);
    77     %     imainfo=[];
    78     if exist(fullfile(pp,[outputroot '.avi']),'file')
    79         FileName=fullfile(pp,[outputroot '.avi']);
    80         hhh=which('videoreader');
    81         if isempty(hhh)%use old video function of matlab
    82             imainfo=aviinfo(FileName);
    83             imainfo.FrameRate=imainfo.FramesPerSecond;
    84             imainfo.NumberOfFrames=imainfo.NumFrames;
    85         else %use video function videoreader of matlab
    86             imainfo=get(videoreader(FileName));
    87         end
    88         if ~isempty(imainfo)
    89             [t,uid_camera]=add(t,1,'element','Camera');
    90             Camera.TimeUnit='s';
    91             Camera.BurstTiming.Time=0;
    92             Camera.BurstTiming.Dti=1/imainfo.FrameRate;
    93             Camera.BurstTiming.NbDti=imainfo.NumberOfFrames-1;
    94             t=struct2xml(Camera,t,uid_camera);
    95         end
    96     end
    9783    [t,uid_calib]=add(t,1,'element',StructName);
    9884end
     
    10187t=struct2xml(Struct,t,uid_calib);
    10288try
    103     save(t,outputfile);
     89    save(t,xmlfile);
    10490catch ME
    105     errormsg=['error in saving ' outputfile ': ' ME.message];
     91    errormsg=['error in saving ' xmlfile ': ' ME.message];
    10692end
  • trunk/src/uvmat.m

    r1143 r1152  
    13991399FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];%name of the current input file
    14001400[RootPath,SubDir,RootFile,tild,tild,tild,tild,FileExt]=fileparts_uvmat(FileName);
    1401 XmlFile=find_imadoc(RootPath,SubDir,RootFile,FileExt);%find name of the relevant xml file
     1401XmlFile=find_imadoc(RootPath,SubDir);%find name of the relevant xml file
    14021402if isempty(XmlFile)
    14031403    msgbox_uvmat('ERROR','an xml file with calibration parameters must be first created, use Tools/geometric calibration');
     
    14741474        end
    14751475        for iexp=1:NbExp
    1476             XmlName=fullfile(ListPath{iexp},[ListSubdir{iexp} '.xml']);
    1477             if exist(XmlName,'file')
    1478                 check_update=1;
    1479             else
    1480                 check_update=0;
    1481             end
    1482             errormsg=update_imadoc(Slice,XmlName,'Slice');% introduce the calibration data in the xml file
     1476            % XmlName=fullfile(ListPath{iexp},[ListSubdir{iexp} '.xml']);
     1477            % if exist(XmlName,'file')
     1478            %     check_update=1;
     1479            % else
     1480            %     check_update=0;
     1481            % end
     1482            [check_update,xmlfile,errormsg]=update_imadoc(ListPath{iexp},ListSubdir{iexp},'Slice',Slice);% introduce the calibration data in the xml file
    14831483            if ~strcmp(errormsg,'')
    14841484                msgbox_uvmat('ERROR',errormsg);
    14851485            else
    14861486                if check_update
    1487                     display([XmlName ' updated with slice positions'])
     1487                    disp([xmlfile ' updated with slice positions'])
    14881488                else
    1489                     display([XmlName ' created with slice positions'])
     1489                    disp([xmlfile ' created with slice positions'])
    14901490                end
    14911491            end
     
    14961496   
    14971497    %% store the result in the xml file used for calibration
    1498     errormsg=update_imadoc(Slice,XmlFile,'Slice');% introduce the calibration data in the xml file
     1498    [~,xmlfile,errormsg]=update_imadoc(RootPath,SubDir,'Slice',Slice);% introduce the calibration data in the xml file
    14991499    if strcmp(errormsg,'')
    1500         msgbox_uvmat('CONFIRMATION',['slice positions saved in ' XmlFile]);
     1500        msgbox_uvmat('CONFIRMATION',['slice positions saved in ' xmlfile]);
    15011501    else
    15021502        msgbox_uvmat('ERROR',errormsg);
     
    17791779answer = questdlg('Where','record the LIF parameters','Current series', 'Replicate', 'Cancel', 'Cancel');
    17801780if strcmp(answer,'Current series')
    1781     XmlFileName=find_imadoc(get(handles.RootPath,'String'),get(handles.SubDir,'String'),get(handles.RootFile,'String'),get(handles.FileExt,'String'));
    1782     update_imadoc(XmlData.LIFCalib,XmlFileName,'LIFCalib');% introduce the calibration data in the xml file
     1781    %XmlFileName=find_imadoc(get(handles.RootPath,'String'),get(handles.SubDir,'String'),get(handles.RootFile,'String'),get(handles.FileExt,'String'));
     1782    update_imadoc(get(handles.RootPath,'String'),get(handles.SubDir,'String'),'LIFCalib',XmlData.LIFCalib);% introduce the calibration data in the xml file
    17831783    % display the concentration in uvmat
    17841784    InputFileREFRESH_Callback(hObject, eventdata, handles);% refresh the current xml file to apply 'ima2concentration'
     
    18271827    end
    18281828    for iexp=1:NbExp
    1829         XmlName=fullfile(ListPath{iexp},[ListSubdir{iexp} '.xml']);
    1830         if exist(XmlName,'file')
    1831             check_update=1;
    1832         else
    1833             check_update=0;
    1834         end
    1835         errormsg=update_imadoc(XmlData.LIFCalib,XmlName,'LIFCalib');% introduce the calibration data in the xml file
     1829        % XmlName=fullfile(ListPath{iexp},[ListSubdir{iexp} '.xml']);
     1830        % if exist(XmlName,'file')
     1831        %     check_update=1;
     1832        % else
     1833        %     check_update=0;
     1834        % end
     1835        [check_update,xmlfile,errormsg]=update_imadoc(ListPath{iexp},ListSubdir{iexp},'LIFCalib',XmlData.LIFCalib);% introduce the calibration data in the xml file
    18361836        if ~strcmp(errormsg,'')
    18371837            msgbox_uvmat('ERROR',errormsg);
    18381838        else
    18391839            if check_update
    1840                 display([XmlName ' updated with calibration parameters'])
     1840                display([xmlfile ' updated with calibration parameters'])
    18411841            else
    1842                 display([XmlName ' created with calibration parameters'])
     1842                display([xmlfile ' created with calibration parameters'])
    18431843            end
    18441844        end
     
    18461846    msgbox_uvmat('CONFIMATION',['LIF calibration replicated for ' num2str(NbExp) ' experiments']);
    18471847end
    1848 
    1849 
    1850 
    1851 %     
    1852 %     
    1853 %     t=xmltree(XmlFileName); %read the file
    1854 %     title_str=get(t,1,'name');
    1855 %     if ~strcmp(title_str,'ImaDoc')
    1856 %         msgbox_uvmat('ERROR','wrong xml file');
    1857 %         return
    1858 %     end
    1859 %     % backup the output file if it already exist, and read it
    1860 %     backupfile=XmlFileName;
    1861 %     testexist=2;
    1862 %     while testexist==2
    1863 %         backupfile=[backupfile '~'];
    1864 %         testexist=exist(backupfile,'file');
    1865 %     end
    1866 %     [success,message]=copyfile(XmlFileName,backupfile);%make backup
    1867 %     if success~=1
    1868 %         errormsg=['errror in xml file backup: ' message];
    1869 %         return
    1870 %     end
    1871 %     uid_illumination=find(t,'ImaDoc/LIFCalib');
    1872 %     if isempty(uid_illumination)  %if GeometryCalib does not already exists, create it
    1873 %         [t,uid_illumination]=add(t,1,'element','LIFCalib');
    1874 %     end
    1875 %     uid_origin=find(t,'ImaDoc/LIFCalib/LightOrigin');
    1876 %     if ~isempty(uid_origin)  %if LightOrigin already exists, delete it
    1877 %         t=delete(t,uid_origin);
    1878 %     end
    1879 %     uid_line=find(t,'ImaDoc/LIFCalib/Ray1Coord');
    1880 %     if ~isempty(uid_line)  %if Ray1Coord already exists, delete it
    1881 %         t=delete(t,uid_line);
    1882 %     end
    1883 %     uid_line=find(t,'ImaDoc/LIFCalib/Ray2Coord');
    1884 %     if ~isempty(uid_line)  %if Ray2Coord already exists, delete it
    1885 %         t=delete(t,uid_line);
    1886 %     end
    1887 %     uid_line=find(t,'ImaDoc/LIFCalib/RefLineCoord');
    1888 %     if ~isempty(uid_line)  %if RefLineCoord already exists, delete it
    1889 %         t=delete(t,uid_line);
    1890 %     end
    1891 %     uid_mask=find(t,'ImaDoc/LIFCalib/MaskPolygonCoord');
    1892 %     if ~isempty(uid_mask) %if MaskPolygonCoord already exists, delete it
    1893 %         t=delete(t,uid_mask);
    1894 %     end
    1895 %     uid_BlackOffset=find(t,'ImaDoc/LIFCalib/BlackOffset');
    1896 %     if ~isempty(uid_BlackOffset)  %if BlackOffset already exists, delete it
    1897 %         t=delete(t,uid_BlackOffset);
    1898 %     end
    1899 %     uid_RefLineWidth=find(t,'ImaDoc/LIFCalib/RefLineWidth');
    1900 %     if ~isempty(uid_RefLineWidth)  %if RefLineWidth already exists, delete it
    1901 %         t=delete(t,uid_RefLineWidth);
    1902 %     end
    1903 %     uid_DecayRate=find(t,'ImaDoc/LIFCalib/DecayRate');
    1904 %     if ~isempty(uid_DecayRate)  %if DecayRate already exists, delete it
    1905 %         t=delete(t,uid_DecayRate);
    1906 %     end
    1907 %     uid_RefLineRadius=find(t,'ImaDoc/LIFCalib/RefLineRadius');
    1908 %     if ~isempty(uid_RefLineRadius)  %if RefLineLum already exists, delete it
    1909 %         t=delete(t,uid_RefLineRadius);
    1910 %     end
    1911 %     uid_RefLineLum=find(t,'ImaDoc/LIFCalib/RefLineLum');
    1912 %     if ~isempty(uid_RefLineLum)  %if RefLineLum already exists, delete it
    1913 %         t=delete(t,uid_RefLineLum);
    1914 %     end
    1915 %     uid_RefLineAzimuth=find(t,'ImaDoc/LIFCalib/RefLineAzimuth');
    1916 %     if ~isempty(uid_RefLineAzimuth)  %if RefLineLum already exists, delete it
    1917 %         t=delete(t,uid_RefLineAzimuth);
    1918 %     end
    1919 %     
    1920 %     % save the LIF calibration data
    1921 %     t=struct2xml(XmlData.LIFCalib,t,uid_illumination);
    1922 %     save(t,XmlFileName);
    1923    
    1924 
    19251848
    19261849
     
    25042427    [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
    25052428end
    2506 XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt);
     2429XmlFileName=find_imadoc(RootPath,SubDir);
    25072430[tild,tild,DocExt]=fileparts(XmlFileName);
    25082431warntext='';%default warning message
Note: See TracChangeset for help on using the changeset viewer.