Changeset 502


Ignore:
Timestamp:
Jul 25, 2012, 6:11:45 PM (8 years ago)
Author:
sommeria
Message:

geometry calib corrected: pb reading time with previous convention

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r498 r502  
    157157hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
    158158FileExt=get(hhuvmat.FileExt,'String');
    159 check_input=0;
    160 if ~isempty(FileExt)
    161     if ~isempty(imformats(FileExt(2:end))) ||strcmpi(FileExt,'.avi')
    162         check_input=1;
    163     end
    164 end
    165 if ~check_input
    166     msgbox_uvmat('ERROR','open an image with uvmat to perform calibration')
    167     return
    168 end
     159% check_input=0;
     160% if ~isempty(FileExt)
     161%     if ~isempty(imformats(FileExt(2:end))) ||strcmpi(FileExt,'.avi')
     162%         check_input=1;
     163%     end
     164% end
     165% % if ~check_input
     166%     msgbox_uvmat('ERROR','open an image with uvmat to perform calibration')
     167%     return
     168% end
    169169
    170170%% read the current calibration points
     
    236236% RootFile='';
    237237if ~isempty(hhuvmat.RootPath)&& ~isempty(hhuvmat.RootFile)
    238 %     testhandle=1;
    239238    RootPath=get(hhuvmat.RootPath,'String');
    240     SubDir=get(hhuvmat.SubDir,'String');
    241 %     RootFile=get(hhuvmat.RootFile,'String');
    242 %     filebase=fullfile(RootPath,RootFile);
    243     outputfile=[fullfile(RootPath,SubDir) '.xml'];%xml file associated with the currently displayed image
     239    SubDirBase=regexprep(get(hhuvmat.SubDir,'String'),'\..+$','');
     240    outputfile=[fullfile(RootPath,SubDirBase) '.xml'];%xml file associated with the currently displayed image
    244241else
     242    SubDirBase='';
    245243    question={'save the calibration data and point coordinates in'};
    246244    def={fullfile(RootPath,'ObjectCalib.xml')};
     
    275273    end
    276274    UserData=get(handles.geometry_calib,'UserData');
    277     if isfield(UserData,'XmlInputFile')&&~strcmp(UserData.XmlInputFile, outputfile)&&~exist(outputfile,'file')
    278      [success,message]=copyfile(UserData.XmlInputFile,outputfile);%copy the old xml file to a new one with the new convention
    279     end
     275   
     276    % get the timing from the xml file using the old convention if appropriate
     277    if ~exist(outputfile,'file') && ~isempty(SubDirBase)     
     278        oldxml=[fullfile(RootPath,SubDirBase,get(hhuvmat.RootFile,'String')) '.xml'];
     279        if exist(oldxml,'file')
     280        [success,message]=copyfile(oldxml,outputfile);%copy the old xml file to a new one with the new convention
     281        end
     282    end   
    280283    errormsg=update_imadoc(GeometryCalib,outputfile);% introduce the calibration data in the xml file
    281284    if ~strcmp(errormsg,'')
     
    13651368[s,errormsg]=imadoc2struct(fileinput,'GeometryCalib');
    13661369if ~isempty(errormsg)
    1367     msgbox_uvmat('ERROR',['Error for reading ' fileinput ': '  errormsg])
     1370    msgbox_uvmat('ERROR',errormsg)
    13681371    return
    13691372end
Note: See TracChangeset for help on using the changeset viewer.