Changeset 1041 for trunk/src


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

psmn parameters updated + miscenaleous

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_field_cells.m

    r1027 r1041  
    137137                CellInfo{icell}.CoordSize=prod(CellInfo{icell}.CoordSize);
    138138            end
     139            ind_scalar=find(strcmp('scalar',Role(VarIndex)));
     140            ind_vector_x=find(strcmp('vector_x',Role(VarIndex)));
     141            ind_vector_y=find(strcmp('vector_y',Role(VarIndex)));
    139142            ind_y=find(strcmp('coord_y',Role(VarIndex)));
    140             if numel(VarIndex)==2||isempty(ind_y)% no variable, except possibly y
     143            if numel([ind_scalar ind_vector_x ind_vector_y])==0           
     144%             if numel(VarIndex)==2||isempty(ind_y)% no variable, except possibly y
    141145                NbDim(icell)=1;
    142146            else
  • trunk/src/get_file_info.m

    r1040 r1041  
    5555function [FileInfo,VideoObject]=get_file_info(fileinput)
    5656VideoObject=[];
     57FileInfo.FileType='';% input file does not exist
     58FileInfo.FieldType=''; %default output
     59% check the existence (not possible for OpenDAP data)
    5760if ~isempty(regexp(fileinput,'^http://'))|| exist(fileinput,'file')
    5861    FileInfo.FileName=fileinput;
    5962    FileInfo.FileType='txt'; %default
    6063else
    61     FileInfo.FileType='';% input file does not exist
    62     return
     64    return %input file does not exist.
    6365end
    6466[tild,tild,FileExt]=fileparts(fileinput);%get the file extension FileExt
     
    186188        end
    187189end
     190
    188191if ismember (FileInfo.FileType,{'image','image_DaVis','multimage','mmreader','cine_phantom','video','netcdf','civdata'})
    189192        FileInfo.FileIndexing='on'; % allow to detect file index for scanning series
     193else
     194    FileInfo.FileIndexing='off';
    190195end
    191196FileInfo.FieldType=FileInfo.FileType;%default
     
    193198    case {'image','multimage','video','mmreader','rdvision','image_DaVis','cine_phantom'}
    194199    FileInfo.FieldType='image';
    195 end
    196 
     200    case {'civx','civdata','pivdata_fluidimage'}
     201        FileInfo.FieldType='civdata';
     202end
     203
  • trunk/src/read_field.m

    r1033 r1041  
    101101        checkU=0;
    102102        checkV=0;
     103        % scan the list InputField
    103104        for ilist=1:numel(InputField)
    104105            % look for input variables to read
    105106            r=regexp(InputField{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names');
    106107            if isempty(r)%  no operator used
    107                 if isempty(find(strcmp(InputField{ilist},ListVar)))
     108                if isempty(find(strcmp(InputField{ilist},ListVar),1))
    108109                    ListVar=[ListVar InputField(ilist)];%append the variable name if not already in the list
    109110                    ListInputField=[ListInputField InputField(ilist)];
     
    111112                end
    112113                if check_colorvar(ilist)
    113                     if isempty(find(strcmp(InputField{ilist},ListVar)))
     114                    if isempty(find(strcmp(InputField{ilist},ListVar),1))
    114115                    Role{numel(ListVar)}='ancillary';% not projected with interpolation
    115116                    ProjModeRequest{numel(ListVar)}='';
     
    118119                    Role{numel(ListVar)}='scalar';
    119120                    ProjModeRequest{numel(ListVar)}='interp_lin';%scalar field (requires interpolation for plot)
     121                end
     122                if isfield(ParamIn,'Coord_y')
     123                    if ~isempty(strcmp(InputField{ilist},ParamIn.Coord_y))
     124                        Role{numel(ListVar)}='coord_y';
     125                    end
    120126                end
    121127            else  % an operator 'vec' or 'norm' is used
     
    139145                    Role=[Role {'vector_y'}];
    140146                    ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}];
    141                     ListInputField=[ListInputField InputField(ilist)];
    142                    
     147                    ListInputField=[ListInputField InputField(ilist)];               
    143148                else
    144149                    checkV=1;
     
    301306    Npz=1;%default
    302307    npxy=size(A);
    303     %     Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
    304     %     Rangy=[npxy(1)-0.5 0.5]; %
    305308    Field.NbDim=2;%default
    306309    Field.AName='image';
     
    318321                ParamOut.Npy=npxy(1);
    319322            end
    320 %             Field.VarAttribute{3}.Mesh=1;
    321323        else
    322324            Field.NbDim=3;
     
    330332                ParamOut.Npy=npxy(2);
    331333            end
    332 %             Field.VarAttribute{4}.Mesh=1;
    333334        end
    334335    else
     
    336337        Field.Coord_y=[npxy(1)-0.5 0.5];
    337338        Field.Coord_x=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
    338 %        ParamOut.Npx=npxy(2);% display image size on the interface
    339  %       ParamOut.Npy=npxy(1);
    340 %         Field.VarAttribute{3}.Mesh=1;
    341339    end
    342340    Field.A=A;
    343341    Field.CoordUnit='pixel'; %used for mouse_motion
    344        
    345 end
    346 
    347 
    348 
     342end
     343
     344
     345
  • trunk/src/series/civ_series.m

    r1027 r1041  
    176176                end
    177177            case 'displacement'
     178                if isfield(Param.ActionInput,'OriginIndex')
    178179                i1_series_Civ1=Param.ActionInput.OriginIndex*ones(size(i1_series{1}));
     180                else
     181                    i1_series_Civ1=ones(size(i1_series{1}));
     182                end
    179183                i1_series_Civ2=i1_series_Civ1;
    180184                i2_series_Civ1=i1_series{1};
  • 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.