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

update_xml simlified, bug on civ_series corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.