Changeset 1192 for trunk/src


Ignore:
Timestamp:
Feb 7, 2026, 9:25:13 PM (2 weeks ago)
Author:
sommeria
Message:

error corrected in xml2struct

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r1191 r1192  
    17971797
    17981798%------------------------------------------------------------------------
    1799 function MenuMask_Callback(hObject, eventdata, handles)
    1800 %------------------------------------------------------------------------
    1801 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    1802 ListObj=UvData.ProjObject;
    1803 select=zeros(1,numel(ListObj));
    1804 for iobj=1:numel(ListObj);
    1805     if strcmp(ListObj{iobj}.ProjMode,'mask_inside')||strcmp(ListObj{iobj}.ProjMode,'mask_outside')
    1806         select(iobj)=1;
    1807     end
    1808 end
    1809 val=find(select);
    1810 if isempty(val)
    1811     msgbox_uvmat('ERROR','polygons must be first created by Projection object/mask polygon in the menu bar');
    1812     return
    1813 else
    1814     set(handles.ListObject,'Value',val);
    1815     flag=1;
    1816     if ~isfield(UvData.Field,'A')
    1817         msgbox_uvmat('ERROR','an image needs to be opened to set the mask size');
    1818         return
    1819     end
    1820     npx=size(UvData.Field.A,2);
    1821     npy=size(UvData.Field.A,1);
    1822     xi=0.5:npx-0.5;
    1823     yi=0.5:npy-0.5;
    1824     [Xi,Yi]=meshgrid(xi,yi);
    1825     for iobj=1:length(UvData.ProjObject)
    1826         ObjectData=UvData.ProjObject{iobj};
    1827         if isfield(ObjectData,'ProjMode') &&(isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside'));
    1828             flagobj=1;
    1829             testphys=0; %coordinates in pixels by default
    1830             if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel')
    1831                 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib')
    1832                     Calib=UvData.XmlData{1}.GeometryCalib;
    1833                     testphys=1;
     1799    function MenuMask_Callback(hObject, eventdata, handles)
     1800        %------------------------------------------------------------------------
     1801        UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     1802        ListObj=UvData.ProjObject;
     1803        select=zeros(1,numel(ListObj));
     1804        for iobj=1:numel(ListObj);
     1805            if strcmp(ListObj{iobj}.ProjMode,'mask_inside')||strcmp(ListObj{iobj}.ProjMode,'mask_outside')
     1806                select(iobj)=1;
     1807            end
     1808        end
     1809        val=find(select);
     1810        if isempty(val)
     1811            msgbox_uvmat('ERROR','polygons must be first created by Projection object/mask polygon in the menu bar');
     1812            return
     1813        else
     1814            set(handles.ListObject,'Value',val);
     1815            flag=1;
     1816            if ~isfield(UvData.Field,'A')
     1817                msgbox_uvmat('ERROR','an image needs to be opened to set the mask size');
     1818                return
     1819            end
     1820            npx=size(UvData.Field.A,2);
     1821            npy=size(UvData.Field.A,1);
     1822            xi=0.5:npx-0.5;
     1823            yi=0.5:npy-0.5;
     1824            [Xi,Yi]=meshgrid(xi,yi);
     1825            for iobj=1:length(UvData.ProjObject)
     1826                ObjectData=UvData.ProjObject{iobj};
     1827                if isfield(ObjectData,'ProjMode') &&(isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside'));
     1828                    flagobj=1;
     1829                    testphys=0; %coordinates in pixels by default
     1830                    if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel')
     1831                        if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib')
     1832                            Calib=UvData.XmlData{1}.GeometryCalib;
     1833                            testphys=1;
     1834                        end
     1835                    end
     1836                    if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Type')
     1837                        if isequal(ObjectData.Type,'polygon')
     1838                            X=ObjectData.Coord(:,1);
     1839                            Y=ObjectData.Coord(:,2);
     1840                            if testphys
     1841                                pos=[X Y zeros(size(X))];
     1842                                if isfield(Calib,'SliceCoord') && length(Calib.SliceCoord)>=3
     1843                                    if isfield(Calib,'SliceAngle')&&~isequal(Calib.SliceAngle,[0 0 0])
     1844                                        om=norm(Calib.SliceAngle);%norm of rotation angle in radians
     1845                                        OmAxis=Calib.SliceAngle/om; %unit vector marking the rotation axis
     1846                                        cos_om=cos(pi*om/180);
     1847                                        sin_om=sin(pi*om/180);
     1848                                        pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis;
     1849                                    end
     1850                                    pos(:,1)=pos(:,1)+Calib.SliceCoord(1);
     1851                                    pos(:,2)=pos(:,2)+Calib.SliceCoord(2);
     1852                                    pos(:,3)=pos(:,3)+Calib.SliceCoord(3);
     1853                                end
     1854                                [X,Y]=px_XYZ(Calib,Slice,pos(:,1),pos(:,2),pos(:,3));
     1855                            end
     1856                            flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside
     1857                        elseif isequal(ObjectData.Type,'ellipse')
     1858                            if testphys
     1859                                %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys
     1860                            end
     1861                            RangeX=max(ObjectData.RangeX);
     1862                            RangeY=max(ObjectData.RangeY);
     1863                            X2Max=RangeX*RangeX;
     1864                            Y2Max=RangeY*RangeY;
     1865                            distX=(Xi-ObjectData.Coord(1,1));
     1866                            distY=(Yi-ObjectData.Coord(1,2));
     1867                            flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1;
     1868                        elseif isequal(ObjectData.Type,'rectangle')
     1869                            if testphys
     1870                                %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys
     1871                            end
     1872                            distX=abs(Xi-ObjectData.Coord(1,1));
     1873                            distY=abs(Yi-ObjectData.Coord(1,2));
     1874                            flagobj=distX>max(ObjectData.RangeX) | distY>max(ObjectData.RangeY);
     1875                        end
     1876                        if isequal(ObjectData.ProjMode,'mask_outside')
     1877                            flagobj=~flagobj;
     1878                        end
     1879                        flag=flag & flagobj;
     1880                    end
    18341881                end
    18351882            end
    1836             if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Type')
    1837                 if isequal(ObjectData.Type,'polygon')
    1838                     X=ObjectData.Coord(:,1);
    1839                     Y=ObjectData.Coord(:,2);
    1840                     if testphys
    1841                         pos=[X Y zeros(size(X))];
    1842                         if isfield(Calib,'SliceCoord') && length(Calib.SliceCoord)>=3
    1843                             if isfield(Calib,'SliceAngle')&&~isequal(Calib.SliceAngle,[0 0 0])
    1844                                 om=norm(Calib.SliceAngle);%norm of rotation angle in radians
    1845                                 OmAxis=Calib.SliceAngle/om; %unit vector marking the rotation axis
    1846                                 cos_om=cos(pi*om/180);
    1847                                 sin_om=sin(pi*om/180);
    1848                                 pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis;
    1849                             end
    1850                             pos(:,1)=pos(:,1)+Calib.SliceCoord(1);
    1851                             pos(:,2)=pos(:,2)+Calib.SliceCoord(2);
    1852                             pos(:,3)=pos(:,3)+Calib.SliceCoord(3);
    1853                         end
    1854                         [X,Y]=px_XYZ(Calib,Slice,pos(:,1),pos(:,2),pos(:,3));
     1883            %mask name
     1884            RootPath=get(handles.RootPath,'String');
     1885            SubDir=get(handles.SubDir,'String');
     1886            RootFile=get(handles.RootFile,'String');
     1887            if ~isempty(RootFile)&&(isequal(RootFile(1),'/')|| isequal(RootFile(1),'\'))
     1888                RootFile(1)=[];
     1889            end
     1890            list=get(handles.masklevel,'String');
     1891            masknumber=num2str(length(list));
     1892            maskindex=get(handles.masklevel,'Value');
     1893            mask_name=fullfile_uvmat(RootPath,[SubDir '.mask'],'mask','.png','_1',maskindex);
     1894            imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200)
     1895            imflag=flipdim(imflag,1);
     1896           
     1897            %display the mask
     1898            hfigmask=figure;
     1899            set(hfigmask,'Name','mask image')
     1900            vec=linspace(0,1,256);%define a linear greyscale colormap
     1901            map=[vec' vec' vec'];
     1902            colormap(map)
     1903            image(imflag);
     1904            answer=msgbox_uvmat('INPUT_TXT','mask file name:', mask_name);
     1905            if ~strcmp(answer,'Cancel')
     1906                mask_dir=fileparts(answer);
     1907                if ~exist(mask_dir,'dir')
     1908                    [success,msg]=mkdir(mask_dir);
     1909                    if success==0
     1910                        msgbox_uvmat('ERROR',['cannot create ' mask_dir ': ' msg]);%error message for directory creation
     1911                        return
    18551912                    end
    1856                     flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside
    1857                 elseif isequal(ObjectData.Type,'ellipse')
    1858                     if testphys
    1859                         %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys
     1913                    [success,msg] = fileattrib(mask_dir,'+w','g','s');% allow writing access for the group of users, recursively in the folder
     1914                    if success==0
     1915                        msgbox_uvmat('WARNING',{['unable to set group write access to ' mask_dir ':']; msg});%error message for directory creation
    18601916                    end
    1861                     RangeX=max(ObjectData.RangeX);
    1862                     RangeY=max(ObjectData.RangeY);
    1863                     X2Max=RangeX*RangeX;
    1864                     Y2Max=RangeY*RangeY;
    1865                     distX=(Xi-ObjectData.Coord(1,1));
    1866                     distY=(Yi-ObjectData.Coord(1,2));
    1867                     flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1;
    1868                 elseif isequal(ObjectData.Type,'rectangle')
    1869                     if testphys
    1870                         %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys
    1871                     end
    1872                     distX=abs(Xi-ObjectData.Coord(1,1));
    1873                     distY=abs(Yi-ObjectData.Coord(1,2));
    1874                     flagobj=distX>max(ObjectData.RangeX) | distY>max(ObjectData.RangeY);
    18751917                end
    1876                 if isequal(ObjectData.ProjMode,'mask_outside')
    1877                     flagobj=~flagobj;
     1918                try
     1919                    imwrite(imflag,answer,'BitDepth',8);
     1920                catch ME
     1921                    msgbox_uvmat('ERROR',ME.message)
    18781922                end
    1879                 flag=flag & flagobj;
    1880             end
    1881         end
    1882     end
    1883     %mask name
    1884     RootPath=get(handles.RootPath,'String');
    1885     SubDir=get(handles.SubDir,'String');
    1886     RootFile=get(handles.RootFile,'String');
    1887     if ~isempty(RootFile)&&(isequal(RootFile(1),'/')|| isequal(RootFile(1),'\'))
    1888         RootFile(1)=[];
    1889     end
    1890     list=get(handles.masklevel,'String');
    1891     masknumber=num2str(length(list));
    1892     maskindex=get(handles.masklevel,'Value');
    1893     mask_name=fullfile_uvmat(RootPath,[SubDir '.mask'],'mask','.png','_1',maskindex);
    1894     imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200)
    1895     imflag=flipdim(imflag,1);
    1896 
    1897     %display the mask
    1898     hfigmask=figure;
    1899     set(hfigmask,'Name','mask image')
    1900     vec=linspace(0,1,256);%define a linear greyscale colormap
    1901     map=[vec' vec' vec'];
    1902     colormap(map)
    1903     image(imflag);
    1904     answer=msgbox_uvmat('INPUT_TXT','mask file name:', mask_name);
    1905     if ~strcmp(answer,'Cancel')
    1906         mask_dir=fileparts(answer);
    1907         if ~exist(mask_dir,'dir')
    1908             [success,msg]=mkdir(mask_dir);
    1909             if success==0
    1910                 msgbox_uvmat('ERROR',['cannot create ' mask_dir ': ' msg]);%error message for directory creation
    1911                 return
    1912             end
    1913             [success,msg] = fileattrib(mask_dir,'+w','g','s');% allow writing access for the group of users, recursively in the folder
    1914             if success==0
    1915                 msgbox_uvmat('WARNING',{['unable to set group write access to ' mask_dir ':']; msg});%error message for directory creation
    1916             end
    1917         end
    1918         try
    1919             imwrite(imflag,answer,'BitDepth',8);
    1920         catch ME
    1921             msgbox_uvmat('ERROR',ME.message)
    1922         end
    1923     end
    1924     set(handles.ListObject,'Value',1)
    1925 end
     1923            end
     1924            set(handles.ListObject,'Value',1)
     1925        end
    19261926
    19271927%------------------------------------------------------------------------
     
    19471947function MenuRelabelFrames_Callback(hObject, eventdata, handles)
    19481948
    1949 
    19501949[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
    19511950FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
    1952 % CheckRelabel=false;
    19531951
    19541952if strcmp(FileExt,'.seq')
     
    19581956end
    19591957[XmlData,errormsg]=imadoc2struct(XmlFile);
    1960 % if isempty(XmlData) || isempty(XmlData.Time)
    1961 %     msgbox_uvmat('ERROR',['the timing needs to be documented in the file ' XmlFile])
    1962 %     return
    1963 % end
     1958
    19641959FileInfo=get_file_info(FileName);
    19651960switch FileInfo.FileType
     
    19691964            FileSeries.Convention='PCO';
    19701965            FileSeries.NbFramePerFile=FileInfo.NumberOfFrames;
    1971 %             BurstTiming.Dtj='';
    1972 %             BurstTiming.NbDtj='';
    1973 %             BurstTiming.Dti='';
    1974 %             BurstTiming.NbDti='';
     1966            hbrowse=browse_data(fullfile(RootPath,SubDir))
     1967            [BurstTiming,errormsg] = set_param_input(ListParam,{'PCO',FileInfo.NumberOfFrames,'','','',''},[]);%fill an input panel with Matlab fct 'inputdlg'
     1968            FileSeries.Convention=BurstTiming.Convention; BurstTiming=rmfield(BurstTiming,'Convention');
     1969            Camera.BurstTiming=BurstTiming;
     1970            FileSeries.FileName={'im.tif';'im@0001.tif'};
     1971            FileSeries.NbFramePerFile=BurstTiming.NbFramePerFile; BurstTiming=rmfield(BurstTiming,'NbFramePerFile');
     1972            [ListPath, ListSubdir]=read_browsdata (hbrowse);
     1973            NbExp=numel(ListSubdir);
     1974            for iexp=1:NbExp
     1975                [checkupdate,XmlFile,errormsg]=update_imadoc(ListPath{iexp},ListSubdir{iexp},'Camera',Camera);
     1976                if ~strcmp(errormsg,'')
     1977                    msgbox_uvmat('ERROR',errormsg);
     1978                else
     1979                    update_imadoc(ListPath{iexp},ListSubdir{iexp},'FileSeries',FileSeries,0);% introduce the FileSeries data in the xml file
     1980                end
     1981            end
     1982            msgbox_uvmat('CONFIMATION',['FileSeries replicated for ' num2str(NbExp) ' experiments, open with uvmat to check']);
     1983           
    19751984        end
    19761985    case 'rdvision'%TO CHECK******
    19771986        check_time_rdvision(FileName,XmlData)
    1978 end
    1979 hbrowse=browse_data(fullfile(RootPath,SubDir))
    1980 %STR = input('OK?')
    1981 [BurstTiming,errormsg] = set_param_input(ListParam,{'PCO',FileInfo.NumberOfFrames,'','','',''},[]);%fill an input panel with Matlab fct 'inputdlg'
    1982 FileSeries.Convention=BurstTiming.Convention; BurstTiming=rmfield(BurstTiming,'Convention');
    1983 Camera.BurstTiming=BurstTiming;
    1984 FileSeries.FileName={'im.tif';'im@0001.tif'};
    1985 FileSeries.NbFramePerFile=BurstTiming.NbFramePerFile; BurstTiming=rmfield(BurstTiming,'NbFramePerFile');
    1986 
    1987 %
    1988 % BrowseData=guidata(hbrowse);
    1989 % SourceDir=get(BrowseData.SourceDir,'String');
    1990 % ListExp=get(BrowseData.ListExperiments,'String');
    1991 % ExpIndices=get(BrowseData.ListExperiments,'Value');
    1992 % ListExp=ListExp(ExpIndices);
    1993 % ListDevices=get(BrowseData.ListDevices,'String');
    1994 % DeviceIndices=get(BrowseData.ListDevices,'Value');
    1995 % ListDevices=ListDevices(DeviceIndices);
    1996 % ListDataSeries=get(BrowseData.DataSeries,'String');
    1997 % DataSeriesIndices=get(BrowseData.DataSeries,'Value');
    1998 % ListDataSeries=ListDataSeries(DataSeriesIndices);
    1999 % NbExp=0; % counter of the number of experiments set by the GUI browse_data
    2000 % for iexp=1:numel(ListExp)
    2001 %     if ~isempty(regexp(ListExp{iexp},'^\+/', 'once'))% if it is a folder
    2002 %         for idevice=1:numel(ListDevices)
    2003 %             if ~isempty(regexp(ListDevices{idevice},'^\+/', 'once'))% if it is a folder
    2004 %                 for isubdir=1:numel(ListDataSeries)
    2005 %                     if ~isempty(regexp(ListDataSeries{isubdir},'^\+/', 'once'))% if it is a folder
    2006 %                         lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
    2007 %                             regexprep(ListDevices{idevice},'^\+/',''));
    2008 %                         ldir= regexprep(ListDataSeries{isubdir},'^\+/','');
    2009 %                         if exist(fullfile(lpath,ldir),'dir')
    2010 %                             NbExp=NbExp+1;
    2011 %                             ListPath{NbExp}=lpath;
    2012 %                             ListSubdir{NbExp}=ldir;
    2013 %                             ExpIndex{NbExp}=iexp;
    2014 %                         end
    2015 %                     end
    2016 %                 end
    2017 %             end
    2018 %         end
    2019 %     end
    2020 % end
    2021 [ListPath, ListSubdir]=read_browsdata (hbrowse);
    2022 NbExp=numel(ListSubdir);
    2023 for iexp=1:NbExp
    2024     [checkupdate,XmlFile,errormsg]=update_imadoc(ListPath{iexp},ListSubdir{iexp},'Camera',Camera)
    2025     if ~strcmp(errormsg,'')
    2026         msgbox_uvmat('ERROR',errormsg);
    2027     else
    2028         update_imadoc(ListPath{iexp},ListSubdir{iexp},'FileSeries',FileSeries,0);% introduce the FileSeries data in the xml file
    2029         if checkupdate
    2030             disp([XmlFile ' updated with FileSeries'])
     1987    case 'telopsIR'
     1988       
     1989        DirContent=dir(fullfile(RootPath,SubDir));
     1990        NbFiles=0;
     1991        FileSeries.Convention='telopsIR';
     1992        for ilist=1:numel(DirContent)
     1993            FName=DirContent(ilist).name;
     1994            if ~isempty(regexp(FName,'.hcc$', 'once'))%select only the files .hcc
     1995                NbFiles=NbFiles+1;
     1996                FileSeries.FileName{NbFiles,1}=FName;
     1997            end
     1998        end
     1999        FileSeries.NbFramePerFile=FileInfo.NumberOfFrames;
     2000        Camera.BurstTiming.Dti=1/FileInfo.FrameRate;
     2001        Camera.BurstTiming.NbDti=NbFiles*FileInfo.NumberOfFrames-1;
     2002        [checkupdate,XmlFile,errormsg]=update_imadoc(RootPath,SubDir,'Camera',Camera);
     2003        if ~strcmp(errormsg,'')
     2004            msgbox_uvmat('ERROR',errormsg);
    20312005        else
    2032             disp([XmlFile ' created with FileSeries'])
    2033         end
    2034     end
    2035 end
    2036 msgbox_uvmat('CONFIMATION',['FileSeries replicated for ' num2str(NbExp) ' experiments, open with uvmat to check']);
     2006            [checkupdate,Xmlfile,errormsg]=update_imadoc(RootPath,SubDir,'FileSeries',FileSeries);
     2007            msgbox_uvmat('CONFIMATION',[XmlFile  ' updated with FileSeries']);
     2008        end
     2009        MaxIndexcell{1}=num2str(NbFiles*FileInfo.NumberOfFrames);
     2010        set(handles.MaxIndex_i,'String',MaxIndexcell)
     2011end
    20372012
    20382013if ~isempty(errormsg)
    20392014    disp(errormsg)
     2015else
     2016    if checkupdate
     2017        disp([XmlFile ' updated with FileSeries'])
     2018    else
     2019        disp([XmlFile ' created with FileSeries'])
     2020    end
    20402021end
    20412022
     
    24722453
    24732454set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])% paint back button to red to indicate update is finished
    2474 set(handles.uvmat,'Pointer','arrow')% set back the mouse pointer to arrowCheckIndexing
     2455set(handles.uvmat,'Pointer','arrow')% set back the mouse pointer to arrow
    24752456
    24762457
     
    24872468XmlFileName=find_imadoc(RootPath,SubDir);% search the appropriate ImaDoc xml file
    24882469[~,XmlName]=fileparts(XmlFileName);
    2489 CheckIndexing=false;% test for virtual indexing of frames different from the file name index, false by default
     2470CheckRelabel=false;% test for virtual indexing of frames different from the file name index, false by default
    24902471if isempty(XmlFileName) %no ImaDoc xml file detected
    24912472    set(handles.view_xml,'Visible','off')
     
    25022483        if isfield(XmlData,'FileSeries')
    25032484             if strcmp(XmlName,SubDir)% xml file directly at the level of the current data file (not up in the data tree)
    2504                  CheckIndexing=true;%  virtual indexing of frames different from the file name index
     2485                 CheckRelabel=true;%  virtual indexing of frames different from the file name index
    25052486             else % xml file not used to document index relabeling
    25062487                  XmlData=rmfield(XmlData,'FileSeries');%desactivate file indexing option for derived file series (e.g. images.png)
     
    25152496    end
    25162497end
    2517 if CheckIndexing
     2498if CheckRelabel
    25182499    set(handles.MenuRelabelFrames,'checked','on')% activate the relabel tool by default
    25192500else
     
    25212502end
    25222503XmlData.FileInfo=FileInfo;
    2523 errormsg=update_series(handles,RootPath,SubDir,FileName,XmlData,CheckIndexing,input_line);
     2504errormsg=update_series(handles,RootPath,SubDir,FileName,XmlData,CheckRelabel,input_line);
    25242505
    25252506%--------------------------------------------------------
    2526 function errormsg=update_series(handles,RootPath,SubDir,FileName,XmlData,CheckIndexing,input_line)
     2507function errormsg=update_series(handles,RootPath,SubDir,FileName,XmlData,CheckRelabel,input_line)
    25272508errormsg=''; %default error msg
    25282509warntext='';%default warning message
     
    25342515%% get the file series
    25352516MovieObject=[];
    2536 if CheckIndexing
     2517if CheckRelabel
    25372518    NomType='*';
    25382519    i1_series=[];
     
    25902571            TimeName='xml';%Time possibly documented by the xml file (but priority to the opened file if available)
    25912572end
    2592 if CheckIndexing
     2573if CheckRelabel
    25932574    i1=str2double(get(handles.FileIndex,'String'));
    25942575    if isnan(i1)
     
    29392920        RootFile=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j);
    29402921        index_string='';
     2922         [~,RootFile]=fileparts(RootFile);%suppress the file extension
    29412923        set(handles.RootFile,'String',RootFile)
    29422924    else
     
    37343716    end
    37353717end
    3736 %% case of file relabeling (PCO, Telops...)
     3718%% case of file relabeling (PCO, TelopsIR...)
    37373719if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'FileSeries')
    37383720    [RootName,~,Ext]=fileparts(FileName);
  • trunk/src/xml2struct.m

    r1191 r1192  
    8686    case 'char'
    8787            out=str2double(strsplit(ss));% convert to number or vector (str2num applied to a fct name executes this fct by 'eval', thus this possibility had to be ruled out above
    88             if isnan(out)
     88            if find(isnan(out))
    8989                sep_ind=regexp(ss,'\s&\s');% check for separator ' & ' which indicates column separation in tables
    9090                if ~isempty(sep_ind)
     
    102102        check_numeric=zeros(size(ss));
    103103        for ilist=1:numel(ss)
    104             if  ~isnan(str2double(strsplit(ss{ilist})))
    105                 out{ilist,1}=str2double(strsplit(ss{ilist}));
    106                 check_numeric(ilist)=1;
    107             else
     104            if  find(isnan(str2double(strsplit(ss{ilist}))))
    108105                sep_ind=regexp(ss{ilist},'\s&\s');% check for separator ' & ' which indicates column separation in tables
    109106                if ~isempty(sep_ind)
     
    115112                    out{ilist,1}=ss{ilist}; %reproduce the input string
    116113                end
     114            else
     115                out{ilist,1}=str2double(strsplit(ss{ilist}));
     116                check_numeric(ilist)=1;
    117117            end
    118118        end
Note: See TracChangeset for help on using the changeset viewer.