Changeset 1041 for trunk/src/uvmat.m


Ignore:
Timestamp:
May 10, 2018, 8:30:27 AM (6 years ago)
Author:
sommeria
Message:

psmn parameters updated + miscenaleous

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r1040 r1041  
    18461846% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    18471847% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
    1848 % if isempty(regexp(fileinput,'^http://'))
    1849 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
    1850 % else
    1851 %     FileInfo.FileType='netcdf';
    1852 %     [RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(fileinput);
    1853 %     i1_series=[0 i1 i2];
    1854 %     i2_series=[];
    1855 %     j1_series=[0 j1 j1];
    1856 %     j2_series=[0 j1 j1];
    1857 %     MovieObject=[];
    1858 % %     [RootPath,RootFile]=fileparts(fileinput);
    1859 % %     [RootPath,SubDir]=fileparts(RootPath);
    1860 % %     NomType='*';
    1861 % end
    1862 FileType=FileInfo.FileType;
    1863 if strcmp(FileType,'txt')
    1864     try
    1865         edit(fileinput)
    1866     catch ME
    1867         msgbox_uvmat('ERROR','invalid intput file')
    1868     end
    1869     return
    1870 elseif strcmp(FileType,'xml')
    1871     editxml(fileinput)
    1872      return
    1873 elseif strcmp(FileType,'figure')
    1874     open(fileinput)
    1875      return
    1876 end
     1848[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=...
     1849    find_file_series(FilePath,[FileName FileExt]);
    18771850
    18781851%% open the file or fill the GUI uvmat according to the detected file type
    1879 switch FileType
     1852FieldType=FileInfo.FieldType;
     1853switch FieldType
    18801854    case ''
    18811855        msgbox_uvmat('ERROR','invalid input file type')
     1856        return
    18821857    case 'txt'
    18831858        edit(fileinput)
     1859        return
    18841860    case 'figure'                           %display matlab figure
    18851861        hfig=open(fileinput);
     
    18871863        set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function
    18881864        set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function
     1865        return
    18891866    case 'xml'                % edit xml files
    18901867        t=xmltree(fileinput);
     
    18951872            editxml(fileinput);
    18961873        end
     1874        return
    18971875    case 'xls'% Excel file opended by editxml
    18981876        editxml(fileinput);
     1877        return
    18991878    otherwise
    19001879        set(handles_RootPath,'String',RootPath);
    19011880        set(handles_SubDir,'String',['/' SubDir]);
    19021881        set(handles_RootFile,'String',['/' RootFile]); %display the separator
    1903 %         if strcmp(NomType,'level')
    1904 %             rootname=fullfile(RootPath,SubDir,'level');
    1905 %             rr=regexp(fileinput,['^' rootname '(?<j>\d+)/' RootFile '(?<i>\d+)' FileExt '$'],'names');
    1906 %             if ~isempty(rr)
    1907 %                 set(handles_FileIndex,'String',rr.i);
    1908 %             end
    1909 %         else
    1910             if isempty(regexp(RootPath,'^http://'))
     1882        if isempty(regexp(RootPath,'^http://'))
    19111883            rootname=fullfile(RootPath,SubDir,RootFile);
    1912             else
    1913                 rootname=[RootPath '/' SubDir '/' RootFile];
    1914             end
    1915             indices=fileinput(length(rootname)+1:end);
    1916             indices(end-length(FileExt)+1:end)=[]; %remove extension
    1917             set(handles_FileIndex,'String',indices);
    1918 %         end
     1884        else
     1885            rootname=[RootPath '/' SubDir '/' RootFile];
     1886        end
     1887        indices=fileinput(length(rootname)+1:end);
     1888        indices(end-length(FileExt)+1:end)=[]; %remove extension
     1889        set(handles_FileIndex,'String',indices);
    19191890        set(handles_NomType,'String',NomType);
    19201891        set(handles_FileExt,'String',FileExt);
     
    19311902                i2_s=i2_0;
    19321903            else
    1933                i2_s=i2;
     1904                i2_s=i2;
    19341905            end
    19351906            j1_0=stra2num(get(handles.j1,'String'));
     
    19461917            end
    19471918        end
    1948 
     1919       
    19491920        % synchronise indices of the second  input file if it exists
    19501921        if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers
     
    19751946            set(handles.FileIndex_1,'String',FileIndex_1)
    19761947        end
    1977 
     1948       
    19781949        %enable other menus
    19791950        set(handles.MenuOpenCampaign,'Enable','on')
     
    19821953        set(handles.MenuExportMovie,'Enable','on')
    19831954        set(handles.MenuTools,'Enable','on')
    1984 
     1955       
    19851956        % initiate input file series and inputfilerefresh the current field view:
    19861957        update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,index);
    1987 
    19881958end
    19891959
     
    19971967for ifile=1:min(length(MenuFile),5)
    19981968    set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile});
    1999     %set(handles.(['MenuFile_' num2str(ifile) '_1']),'Label',MenuFile{ifile});
    20001969end
    20011970dir_perso=prefdir;
     
    20622031        XmlData.Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/FileInfo.FrameRate:(FileInfo.NumberOfFrames)/FileInfo.FrameRate);
    20632032    end
    2064 %     if strcmp(FileInfo.FileType,'rdvision')
    2065 %         TimeName='timestamp';
    2066 %     else
    2067 %     TimeName='video';
    2068 %     end
    20692033end
    20702034if isfield(FileInfo,'TimeName')
     
    21112075                ind_start=0;
    21122076            end
    2113             % complement the input if the whole time series is not defined
    2114             %             if size(i1_series,3)>size(XmlDataRead.Time,1)-ind_start %only the first time interval is defined, extrapolate to the whole series
    2115             %                 Dti_total=XmlDataRead.Time(end)-XmlDataRead.Time(1);%total time interval covered by the time vector
    2116             %                 missing_indices=sizDti+1+ind_start:size(i1_series,3)+1;% remaining set of frame indices for which time needs to be found
    2117             %                 repeat_nbre=1+floor((missing_indices-sizDti-ind_start)/(sizDti-1));% number of repetitions of Dti
    2118             %                 time_indices=1+mod(missing_indices-sizDti-1,sizDti-1);
    2119             %                 for j=1:size(XmlDataRead.Time,2)
    2120             %                     XmlData.Time(missing_indices,j)=XmlDataRead.Time(time_indices,j)+repeat_nbre'*Dti_total;
    2121             %                 end
    2122             %                 % update the xml file with NbDti
    2123             %                 t=xmltree(XmlFileName);
    2124             %                 uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti')
    2125             %                 if isempty(uid_NbDti)
    2126             %                     uid_BurstTiming=find(t,'ImaDoc/Camera/BurstTiming')
    2127             %                     [t,uid_NbDti]=add(t,uid_BurstTiming,'element','NbDti');
    2128             %                 end
    2129             %                 [t,uid_NbDti]=add(t,uid_NbDti,'chardata',num2str(repeat_nbre(end)-1));
    2130             %                 save(t,XmlFileName)
    2131             %             end
    21322077        end
    21332078        set(handles.view_xml,'BackgroundColor',[1 1 1])% paint back to white
     
    21602105%% Define timing
    21612106% time not set by the input file: images or civ data: indicate that time is read from the xml file
    2162 FileType=FileInfo.FileType;
     2107%FileType=FileInfo.FileType;
    21632108if isfield(XmlData,'Time')&& ~isempty(XmlData.Time) && ...
    2164         (strcmp(FileType,'image')|| strcmp(FileType,'multimage'))%||strcmp(FileType,'civdata')||strcmp(FileType,'civx'))
     2109        (strcmp(FileInfo.FileType,'image')|| strcmp(FileInfo.FileType,'multimage'))%||strcmp(FileType,'civdata')||strcmp(FileType,'civx'))
    21652110    TimeName='xml';
    2166 elseif strcmp(FileType,'civdata')% ajouter pivdata_fluidimage
     2111elseif strcmp(FileInfo.FieldType,'civdata')% ajouter pivdata_fluidimage
    21672112    TimeName='civdata';
    2168 elseif strcmp(FileType,'civx')
    2169     TimeName='civx';
    21702113end
    21712114if index==1
     
    22602203
    22612204%% set default options in menu 'FieldName'
    2262 switch FileType
    2263     case {'civx','civdata','pivdata_fluidimage'}
     2205switch FileInfo.FieldType
     2206    case 'civdata'
    22642207        [FieldList,ColorList]=set_field_list('U','V','C');
    22652208        set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
     
    33183261FieldName='';%default
    33193262VelType='';%default
    3320 if strcmp(UvData.FileInfo{1}.FieldType,'image')
     3263if isfield(UvData.FileInfo{1},'FieldType') && strcmp(UvData.FileInfo{1}.FieldType,'image')
    33213264    FieldName='image';
    33223265    frame_index=1;%default
     
    33763319    ParamIn.Coord_x=get(handles.Coord_x,'String');
    33773320    ParamIn.Coord_y=get(handles.Coord_y,'String');
     3321    if iscell(ParamIn.Coord_y)
     3322        ParamIn.Coord_y=ParamIn.Coord_y';
     3323    end
    33783324    ParamIn.Coord_z=get(handles.Coord_z,'String');
    33793325    %ParamIn.CheckCoordIndex=strcmp(get(handles.SwitchCoordIndex,'String'),'dim');
     
    35553501%% update the display menu for the first velocity type (first menuline)
    35563502test_veltype=0;
    3557 if (strcmp(UvData.FileInfo{1}.FileType,'civx')||strcmp(UvData.FileInfo{1}.FileType,'civdata')||strcmp(UvData.FileInfo{1}.FileType,'pivdata_fluidimage'))...
    3558         && ~strcmp(FieldName,'get_field...')
     3503if isfield(UvData.FileInfo{1},'FieldType') && strcmp(UvData.FileInfo{1}.FieldType,'civdata')&& ~strcmp(FieldName,'get_field...')
    35593504    test_veltype=1;
    35603505    set(handles.VelType,'Visible','on')
     
    35813526if isempty(FileName_1)
    35823527elseif ~test_keepdata_1
    3583     if (strcmp(UvData.FileType{2},'civx')||strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileInfo{1}.FileType,'pivdata_fluidimage'))...
    3584             && ~strcmp(FieldName_1,'get_field...')
     3528    if strcmp(UvData.FileInfo{2}.FieldType,'civdata')&& ~strcmp(FieldName_1,'get_field...')
    35853529        test_veltype_1=1;
    35863530        set(handles.VelType_1,'Visible','on')
     
    45044448            case '1D plot'
    45054449                YName=GetFieldData.PanelOrdinate.ordinate;
    4506                 FieldList={''};         
     4450                FieldList={''}; 
     4451                set(handles.uvmat,'ToolBar','figure')
     4452                set(handles.Coord_y,'Max',2)
     4453                %set(huvmat,
    45074454            case 'civdata...'%reinitiate input, return to automatic civ data reading
    45084455                display_file_name(handles,FileName,1)
Note: See TracChangeset for help on using the changeset viewer.