Changeset 441 for trunk/src/uvmat.m


Ignore:
Timestamp:
Jun 6, 2012, 2:45:37 PM (12 years ago)
Author:
sommeria
Message:

many bugs corrected for the new file organisation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r439 r441  
    909909
    910910%% read parameters (time, geometric calibration..) from a documentation file (.xml advised)
    911 filexml=[FileBase '.xml'];
    912 fileciv=[FileBase '.civ'];
     911SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
     912filexml=fullfile(RootPath,[SubDirBase '.xml']);% new convention: xml above the image dir
     913if ~exist(filexml,'file')
     914    filexml=fullfile(RootPath,SubDir,[RootFile '.xml']);%old convention: xml within the image directroy
     915end
    913916warntext='';%default warning message
    914917NbSlice=1;%default
     
    945948        end
    946949    end 
    947 elseif exist(fileciv,'file')% if .civ file found
    948     [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']);
    949     GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];
    950     GeometryCalib.Tx=0;
    951     GeometryCalib.Ty=0;
    952     GeometryCalib.Tz=1;
    953     GeometryCalib.dpx=1;
    954     GeometryCalib.dpy=1;
    955     GeometryCalib.sx=1;
    956     GeometryCalib.Cx=0;
    957     GeometryCalib.Cy=0;
    958     GeometryCalib.f=1;
    959     GeometryCalib.kappa1=0;
    960     GeometryCalib.CoordUnit='cm';
    961     XmlData.GeometryCalib=GeometryCalib;
    962     if error==2, warntext=['no file ' FileBase '.civ'];
    963     elseif error==1, warntext='inconsistent number of fields in the .civ file';
    964     end 
    965     set(handles.num_Npx,'String',num2str(npx));%fills nbre of pixels x box
    966     set(handles.num_Npy,'String',num2str(npy));%fills nbre of pixels y box
    967     set(handles.pxcm,'String',num2str(pxcmx));%fills scale x (pixel/cm) box
    968     set(handles.pycm,'String',num2str(pxcmy));%fills scale y (pixel/cm) box
    969     set(handles.pxcm,'Visible','on');%fills scale x (pixel/cm) box
    970     set(handles.pycm,'Visible','on');%fills scale y (pixel/cm) box
    971     set(handles.view_xml,'Visible','on')   
    972     set(handles.view_xml,'String','view .civ')
    973950else
    974     set(handles.view_xml,'Visible','off')
     951    fileciv=fullfile(RootPath,SubDir,[RootFile '.civ']);
     952    if exist(fileciv,'file')% if .civ file found (very old convention)
     953        [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext(fileciv);
     954        GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];
     955        GeometryCalib.Tx=0;
     956        GeometryCalib.Ty=0;
     957        GeometryCalib.Tz=1;
     958        GeometryCalib.dpx=1;
     959        GeometryCalib.dpy=1;
     960        GeometryCalib.sx=1;
     961        GeometryCalib.Cx=0;
     962        GeometryCalib.Cy=0;
     963        GeometryCalib.f=1;
     964        GeometryCalib.kappa1=0;
     965        GeometryCalib.CoordUnit='cm';
     966        XmlData.GeometryCalib=GeometryCalib;
     967        if error==2, warntext=['no file ' fileciv];
     968        elseif error==1, warntext='inconsistent number of fields in the .civ file';
     969        end
     970        set(handles.num_Npx,'String',num2str(npx));%fills nbre of pixels x box
     971        set(handles.num_Npy,'String',num2str(npy));%fills nbre of pixels y box
     972        set(handles.pxcm,'String',num2str(pxcmx));%fills scale x (pixel/cm) box
     973        set(handles.pycm,'String',num2str(pxcmy));%fills scale y (pixel/cm) box
     974        set(handles.pxcm,'Visible','on');%fills scale x (pixel/cm) box
     975        set(handles.pycm,'Visible','on');%fills scale y (pixel/cm) box
     976        set(handles.view_xml,'Visible','on')
     977        set(handles.view_xml,'String','view .civ')
     978    else
     979        set(handles.view_xml,'Visible','off')
     980    end
    975981end
    976982
     
    985991end
    986992if ~isempty(XmlData.Time)
    987 %     nbfield=size(XmlData.Time,1);
    988 %     nbfield_j=size(XmlData.Time,2);
    989993    %transform .Time to a column vector if it is a line vector the nomenclature uses a single index
    990     if isequal(nbfield,1) && ~isequal(nbfield_j,1)% .Time is a line vector
     994    if isequal(size(XmlData.Time,1),1)
     995%     if isequal(nbfield,1) && ~isequal(nbfield_j,1)% .Time is a line vector
    991996        NomType=get(handles.NomType,'String');
    992         if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%'))
     997%         if isempty(nbfield_j)
     998%         if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%'))
    993999            XmlData.Time=(XmlData.Time)';
    994 %             nbfield=nbfield_j;
    995 %             nbfield_j=1;
    996         end
    9971000    end
    9981001end
Note: See TracChangeset for help on using the changeset viewer.