Changeset 1033 for trunk


Ignore:
Timestamp:
Apr 30, 2018, 8:01:35 PM (7 years ago)
Author:
sommeria
Message:

miscellaneous updates

Location:
trunk/src
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_files.m

    r1027 r1033  
    163163    svn_info.rep_rev=0;svn_info.cur_rev=0;
    164164    [tild,result]=system(['svn info ' dir_fct]); %get info fromn the svn server
    165     t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');%detect 'rï¿œvision' or 'Revision' in the text
     165    t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');%detect 'revision' or 'Revision' in the text
    166166    if ~isempty(t)
    167167        svn_info.cur_rev=str2double(t.rev); %version nbre of the current package
  • trunk/src/compile.m

    r1027 r1033  
    4646MCRROOT = ['MCRROOT',int2str(mcrmajor),int2str(mcrminor)];
    4747FctNameVersion=[FctName,'_',MCRROOT];
    48 %hver=ver('MATLAB');
    49 %FctNameVersion=[FctName '_MCRROOT' regexprep(hver.Version,'\.','')]; % suppress the dot in version number
    5048try
    5149    disp(['mcc -m -R -nojvm -R -nodisplay -R -singleCompThread ' SubfctPath ' ' FctName '.m'])
  • trunk/src/dir_uvmat.m

    r1022 r1033  
    1 function [ ListFiles ] = dir_uvmat( DirName)
     1%'dir_uvmat': list the content of a folder, extending 'dir' to the case of OpenDap server
     2%--------------------------------------------------------------------
     3%[RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(FileInput)
     4%
     5%OUTPUT:
     6%ListFiles:
     7%
     8%INPUT:
     9%DirName: complete name of the folder to scan, including path
     10
     11%=======================================================================
     12% Copyright 2008-2018, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
     13%   http://www.legi.grenoble-inp.fr
     14%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
     15%
     16%     This file is part of the toolbox UVMAT.
     17%
     18%     UVMAT is free software; you can redistribute it and/or modify
     19%     it under the terms of the GNU General Public License as published
     20%     by the Free Software Foundation; either version 2 of the license,
     21%     or (at your option) any later version.
     22%
     23%     UVMAT is distributed in the hope that it will be useful,
     24%     but WITHOUT ANY WARRANTY; without even the implied warranty of
     25%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     26%     GNU General Public License (see LICENSE.txt) for more details.
     27%=======================================================================
     28
     29function [ ListFiles] = dir_uvmat(DirName)
    230if regexp(DirName,'^http://')
    331    catalog=[DirName,'/catalog.xml'];
  • trunk/src/find_file_series.m

    r1027 r1033  
    4848%------------------------------------------------------------------------
    4949
    50 %% get input root name and nomenclature type
     50%% get input root name and info on the input file
    5151if isempty(regexp(FilePath,'^http://'))
    5252fullfileinput=fullfile(FilePath,fileinput);% input file name with path
     
    153153            end
    154154        end
    155  
     155       
    156156        detect_string=['^' RootFile sep1 i1_str i2_str sep2 j1_str j2_str FileExt '$'];%string used in regexp to detect file indices
    157 %         if isempty(regexp(FilePath,'^http://'))
    158         %find the string used to extract the relevant files with the command dir
    159 %         star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt];
    160 %         wd=pwd;%current working directory
    161 %         cd (FilePath)% move to the local dir to save time in the operation dir.
    162 %         dirpair=dir(star_string);% look for relevant files in the file directory
    163 %         cd(wd)
    164 %         else
    165             ListStruct=dir_uvmat(FilePath);
    166             ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
    167             ListFiles=ListCells(1,:);%list of file names
    168             rr=regexp(ListFiles,detect_string,'names');
    169 %         end
    170 %         nbpair=numel(dirpair);
     157        ListStruct=dir_uvmat(FilePath);% scan the content of the folder FilePath
     158        ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
     159        ListFiles=ListCells(1,:);%list of file names
     160        rr=regexp(ListFiles,detect_string,'names');
    171161        nbpair=numel(rr);
    172162        ref_i_list=zeros(1,nbpair);
     
    177167        % scan the list of relevant files, extract the indices
    178168        for ifile=1:nbpair
    179 %             rr=regexp(dirpair(ifile).name,detect_string,'names');
     169            %             rr=regexp(dirpair(ifile).name,detect_string,'names');
    180170            if ~isempty(rr{ifile})
    181171                i1=str2num(rr{ifile}.i1);
     
    274264        NomType='*';
    275265        i2_series=[];j1_series=[];j2_series=[];
    276 %         i1_input=1;i2_input=[];j1_input=[];j2_input=[];
     266        %         i1_input=1;i2_input=[];j1_input=[];j2_input=[];
    277267        if ~exist(fullfileinput,'file')
    278268            RootFile='';
     
    281271    end
    282272end
    283 % %% detect rdvision format
    284 % if strcmp(FileExt,'.bin')
    285 %     if exist(fullfile(RootPath,SubDir,[RootFile '.seq']),'file')
    286 %         FileInfo.FileType='rdvision';
    287 %         FileInfo.SeqFile=[RootFile '.seq'];
    288 %     end
    289 % end
    290273
    291274%% introduce the frame index in case of movies or multimage type
  • trunk/src/get_file_info.m

    r1032 r1033  
    66% FileInfo: structure containing info on the file (case of images or video), in particular
    77%      .FileType: type of file, needed as input of read_field.m
     8%               ='figure': Matlab figure
     9%               ='xml': xml file
     10%               ='xls': Excel file
     11%               ='dat': text file for data,
     12%               ='image': image format recognised by Matlab
     13%               ='multimage': image format recognised by Matlab with  multiple frames
     14%               ='video': video movie file
     15%               ='mmreader': video from old versions of Matlab (<2009)
     16%               ='rdvision': images in binary format from company rdvision
     17%               ='image_DaVis': images from softwar DaVis (company LaVision)
     18%               ='cine_phantom': images from fast camera Phantom
     19%               ='bin': binary file without specific organisation
     20%               ='netcdf': netcdf file
     21%               ='civdata': netcdf files provided by civ_series
     22%               ='civx': netcdf files provided by the obsolete program civx (in fortran)
     23%               ='pivdata_fluidimage': PIV data from software 'fluidimage'
    824%      .FileIndexing='on' for data files (when series of indexed files are  expected)
    925%      .Height: image height in pixels
     
    5470    case {'.seq','.sqb'}
    5571        [A,FileInfo,timestamps,errormsg]=read_rdvision(fileinput,[]);
    56 %         %%%%%
    57 %         FileInfo.NumberOfFrame=24000;
    58 %         %%%%%%%%
    5972    case '.im7'
    6073        try
     
    6679             FileInfo.Width=size(Image,1);
    6780             FileInfo.TimeName='timestamp';
    68              DateString=Input.Attributes{60}.Value
    69              TimeString=Input.Attributes{59}.Value
     81             for ilist=1:numel(Input.Attributes)
     82                 if strcmp(Input.Attributes{ilist}.Name,'_Date')
     83                     DateString=Input.Attributes{ilist}.Value;
     84                 end
     85                 if strcmp(Input.Attributes{ilist}.Name,'_Time')
     86                     TimeString=Input.Attributes{ilist}.Value;
     87                 end
     88             end
    7089        catch ME
    71             msgbox_uvmat('ERROR',[ME.message;'reading image from DaVis is possible only with Matlab version 2013 or earlier'])
     90            msgbox_uvmat('ERROR',{ME.message;'reading image from DaVis is possible only with Matlab version 2013 or earlier'})
    7291            return
    7392        end
     
    166185        end
    167186end
    168 switch FileInfo.FileType
    169     case {'image','image_DaVis','multimage','mmreader','cine_phantom','video','netcdf','civdata'}
     187if ismember (FileInfo.FileType,{'image','image_DaVis','multimage','mmreader','cine_phantom','video','netcdf','civdata'})
    170188        FileInfo.FileIndexing='on'; % allow to detect file index for scanning series
    171189end
     190FileInfo.FieldType=FileInfo.FileType;%default
     191switch FileInfo.FileType
     192    case {'image','multimage','video','mmreader','rdvision','image_DaVis','cine_phantom'}
     193    FileInfo.FieldType='image';
     194end
     195
  • trunk/src/read_civdata.m

    r1027 r1033  
    8080VelTypeOut=VelType;
    8181errormsg='';
    82 if ~exist(FileName,'file')
    83     errormsg=['input file ' FileName ' does not exist'];
    84     return
    85 end
    8682if ischar(FieldNames), FieldNames={FieldNames}; end;
    8783ProjModeRequest='';
     
    10298Data=nc2struct(FileName,'ListGlobalAttribute','CivStage');
    10399if isfield(Data,'Txt')
    104      erromsg=['error in read_civdata: ' Data.Txt];
     100     errormsg=['error in read_civdata: ' Data.Txt];
    105101    return
    106102end
     
    108104[varlist,role,VelTypeOut]=varcivx_generator(ProjModeRequest,VelType,Data.CivStage);
    109105if isempty(varlist)
    110     erromsg=['error in read_civdata: unknow velocity type ' VelType];
     106    errormsg=['error in read_civdata: unknow velocity type ' VelType];
    111107    return
    112108else
  • trunk/src/read_field.m

    r1032 r1033  
    4747Field=[];
    4848if ~exist('num','var')
     49    num=1;
     50end
     51if isempty(num)
    4952    num=1;
    5053end
     
    272275    case 'image_DaVis'
    273276        Input=readimx(FileName);
     277        if numel(Input.Frames)==1
     278            num=1;
     279        end
    274280        A=Input.Frames{num}.Components{1}.Planes{1}';
    275         %timestamps=double(Input.Attributes{1}.Value(2))/1000000;
    276         timestamps=str2num(Input.Frames{1}.Attributes{12}.Value(1:end-3))/1000000;
     281        for ilist=1:numel(Input.Frames{1}.Attributes)
     282            if strcmp(Input.Frames{1}.Attributes{ilist}.Name,'AcqTimeSeries')
     283        timestamps=str2num(Input.Frames{1}.Attributes{ilist}.Value(1:end-3))/1000000;
     284        break
     285            end
     286        end
    277287    case 'cine_phantom'
    278288        [A,FileInfo] = read_cine_phantom(FileName,num );
  • trunk/src/read_image.m

    r1027 r1033  
    4343    num=1;
    4444end
     45if isempty(num)
     46    num=1;
     47end
    4548A=[];
    4649ObjectOut=VideoObject;%default
     
    6871    case 'image_DaVis'
    6972                Input=readimx(FileName);
     73                if numel(Input.Frames)==1
     74                    A=Input.Frames{1}.Components{1}.Planes{1}';
     75                else
    7076        A=Input.Frames{num}.Components{1}.Planes{1}';
     77                end
    7178end
  • trunk/src/series.m

    r1030 r1033  
    175175    RunModeList=[RunModeList;{'cluster'}];
    176176    set(handles.MonitorCluster,'Visible','on'); % make visible button for access to Monika
    177     set(handles.num_CPUTime,'Visible','on'); % make visible button for access to Monika
    178     set(handles.CPUTime_txt,'Visible','on'); % make visible button for CPU time estimate for one ref index
     177    set(handles.num_CPUTime,'Visible','on'); % make visible button for CPU time estimate for one ref index
     178    set(handles.num_CPUTime,'String','1')% defqult CPU time estimate 1 minute
     179    set(handles.CPUTime_txt,'Visible','on'); % make visible button for CPU time title
    179180end
    180181% [s,w]=system('qstat -help'); % look for cluster system 'sge'
     
    15691570        NbCoreAdvised=SeriesData.SeriesParam.ClusterParam.NbCoreAdvised;
    15701571        NbCoreMax=SeriesData.SeriesParam.ClusterParam.NbCoreMax;
    1571         if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
    1572             warning_string=', preferably use .sh option to save Matlab licences';
     1572        if NbCoreMax~=1
     1573            if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
     1574                warning_string=', preferably use .sh option to save Matlab licences';
     1575            else
     1576                warning_string=')';
     1577            end
     1578            answer=msgbox_uvmat('INPUT_TXT',['Number of cores (max ' num2str(NbCoreMax) ', ' warning_string],num2str(NbCoreAdvised));
     1579            if isempty(answer)
     1580                errormsg='Action launch interrupted by user';
     1581                return
     1582            end
     1583            NbCore=str2double(answer);
    15731584        else
    1574             warning_string=')';
    1575         end
    1576         answer=msgbox_uvmat('INPUT_TXT',['Number of cores (max ' num2str(NbCoreMax) ', ' warning_string],num2str(NbCoreAdvised));
    1577         if isempty(answer)
    1578             errormsg='Action launch interrupted by user';
    1579             return
    1580         end
    1581         NbCore=str2double(answer);
    1582 %         extra_oar=answer{2};
    1583 %     case {'cluster_pbs', 'cluster_sge', 'cluster_qstat_unknown'}
    1584 %         if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
    1585 %             NbCore=1; % one core used only (limitation of Matlab licences)
    1586 %             answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
    1587 %             if ~strcmp(answer,'Yes')
    1588 %                 errormsg='Action launch interrupted';
    1589 %                 return
    1590 %             end
    1591 %             extra_oar='';
    1592 %         else
    1593 %             answer=inputdlg({'Number of jobs (max 1000)','Queue'},'qsub parameters',1,{'100','piv_debian'});
    1594 %             NbCore=str2double(answer{1});
    1595 %             qstat_Queue=answer{2};
    1596 %             %extra_oar=answer{2}; % TODO : fix this for LMFA cluster. Maybe
    1597 %             %extrs_oar and extra_pbs are not the best names
    1598 %         end
     1585            NbCore=1;
     1586        end
    15991587end
    16001588if ~isfield(Param.IndexRange,'NbSlice')
     
    21572145%------------------------------------------------------------------------
    21582146% --- Executes on selection change in ActionName.
    2159 function ActionName_Callback(hObject, eventdata, handles)
     2147function ActionName_Callback(hObject, ActionPath, handles)
    21602148%------------------------------------------------------------------------
    21612149
     
    21642152    answer= msgbox_uvmat('INPUT_Y-N','stop current Action process?');
    21652153    if strcmp(answer,'Yes')
    2166         STOP_Callback(hObject, eventdata, handles)
     2154        STOP_Callback(hObject, [], handles)
    21672155    else
    21682156        return
     
    21922180%% add a new function to the menu if 'more...' has been selected in the menu ActionName
    21932181if isequal(ActionName,'more...')
     2182    if isempty(ActionPath)
     2183        ActionPath=get(handles.ActionPath,'String');
     2184    end
    21942185    [FileName, PathName] = uigetfile( ...
    21952186        {'*.m', ' (*.m)';
    21962187        '*.m',  '.m files '; ...
    21972188        '*.*', 'All Files (*.*)'}, ...
    2198         'Pick a series processing function ',get(handles.ActionPath,'String'));
     2189        'Pick a series processing function ',ActionPath);
    21992190    if length(FileName)<2
    22002191        return
     
    22812272ActionName= ActionList{get(handles.ActionName,'Value')}; % selected function name
    22822273if ~exist(ActionPath,'dir')
    2283     msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
     2274    ActionName_Callback(handles.ActionName, ActionPath, handles)% update the function
     2275%     msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
    22842276    return
    22852277end
  • trunk/src/series/aver_stat.m

    r1027 r1033  
    167167
    168168%% determine the file type on each line from the first input file
    169 ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
    170169NcTypeOptions={'netcdf','civx','civdata'};
    171170for iview=1:NbView
     
    176175    [FileInfo{iview},MovieObject{iview}]=get_file_info(filecell{iview,1});
    177176    FileType{iview}=FileInfo{iview}.FileType;
    178     CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
     177    CheckImage{iview}=strcmp(FileInfo{iview}.FieldType,'image');% =1 for images
    179178    CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
    180179    if ~isempty(j1_series{iview})
  • trunk/src/series/beam_forming.m

    r1027 r1033  
    9393
    9494%% determine the file type on each line from the first input file
    95 ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
    9695NcTypeOptions={'netcdf','civx','civdata'};
    9796for iview=1:NbView
     
    102101    [FileInfo{iview},MovieObject{iview}]=get_file_info(filecell{iview,1});
    103102    FileType{iview}=FileInfo{iview}.FileType;
    104     CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
     103   CheckImage{iview}=strcmp(FileInfo{iview}.FieldType,'image');% =1 for images
    105104    CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
    106105    if ~isempty(j1_series{iview})
  • trunk/src/series/check_data_files.m

    r1027 r1033  
    109109
    110110%determine the file type on each line from the first input file
    111 ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
    112111NcTypeOptions={'netcdf','civx','civdata'};
    113112for iview=1:nbview
    114113    [FileInfo{iview},Object{iview}]=get_file_info(filecell{iview,1});
    115114    FileType{iview}=FileInfo{iview}.FileType;
    116     CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
     115    CheckImage{iview}=strcmp(FileInfo{iview}.FieldType,'image');% =1 for images
    117116    CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
    118117end
  • trunk/src/series/check_peaklock.m

    r1027 r1033  
    125125
    126126%determine the file type on each line from the first input file
    127 ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
    128127NcTypeOptions={'netcdf','civx','civdata'};
    129128for iview=1:nbview
     
    134133    [FileInfo{iview},MovieObject{iview}]=get_file_info(filecell{iview,1});
    135134    FileType{iview}=FileInfo{iview}.FileType;
    136     CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
     135    CheckImage{iview}=strcmp(FileInfo{iview}.FieldType,'image');% =1 for images
    137136    CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
    138137    if ~isempty(j1_series{iview})
  • trunk/src/series/civ_input.m

    r1027 r1033  
    8080    set(handles.num_CorrSmooth,'String',{'1';'2'})
    8181    set(handles.CheckThreshold,'Visible','on')
    82     set(handles.CheckDeformation,'Value',0)% desactivate (work in progress)
     82    set(handles.CheckDeformation,'Value',0)% desactivate
    8383end
    8484switch Param.Action.ActionName
     
    9595FileType='image';%fdefault
    9696FileInfo=[];
    97 if isfield(SeriesData,'FileType')&&isfield(SeriesData,'FileInfo')...
    98         &&numel(SeriesData.FileType)>=1&&numel(SeriesData.FileInfo)>=1
    99     FileType=SeriesData.FileType{1};%type of the first input file series
    100     FileInfo=SeriesData.FileInfo{1};% info on the first input file series
     97if isfield(SeriesData,'FileInfo')...
     98    FileType=SeriesData.FileInfo{1}.FileType;% info on the first input file series
     99    FieldType=SeriesData.FileInfo{1}.FieldType;% info on the first input file series
    101100else
    102101    set(hhseries.REFRESH,'BackgroundColor',[1 0 1])% indicate that the file input in series needs to be refreshed
     
    109108iview_image=1;%line # for the input images
    110109switch FileType
    111     case {'image','image_DaVis','multimage','video','mmreader','cine_phantom','netcdf'}
    112 %         NomTypeImaA=NomTypeInput;
    113 %         iview_image=1;%line # for the input images
    114110    case 'civdata'
    115111        if ~strcmp(Param.Action.ActionName,'civ_series')
     
    154150        return
    155151    otherwise
     152        if ~strcmp(FieldType,'image')
    156153        msgbox_uvmat('ERROR','civ_series needs images, scalar fields in netcdf format, or civ data as input')
    157154        return
     155        end
    158156end
    159157
     
    308306    end
    309307    if isfield(Param.ActionInput,'Civ2')
    310        CheckDeformation_Callback(hObject, eventdata, handles)
    311     end
    312 end
    313        if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ListCompareMode')&&...
    314                strcmp(Param.ActionInput.ListCompareMode,'displacement')
    315             set(handles.PairIndices,'Visible','off')
    316         end
     308        CheckDeformation_Callback(hObject, eventdata, handles)
     309    end
     310end
     311if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ListCompareMode')&&...
     312        strcmp(Param.ActionInput.ListCompareMode,'displacement')
     313    set(handles.PairIndices,'Visible','off')
     314        set(handles.CheckRefFile,'Visible','on')
     315else
     316    set(handles.CheckRefFile,'Visible','off')
     317end
    317318
    318319%% set the menu and default choice of civ pairs
     
    370371%% list the possible index pairs, depending on the option set in ListPairMode
    371372ListPairMode_Callback([], [], handles)
    372 %ListPairCiv1_Callback(hObject, eventdata, handles)
    373373
    374374%% set the GUI to modal: wait for OK to close
     
    714714    mode_selected=mode_list{mode_value};
    715715end
    716 % displ_num=[];%default
    717716ref_i=str2double(get(handles.ref_i,'String'));
    718 % last_i=str2num(get(handles.last_i,'String'));
    719717CivInputData=get(handles.civ_input,'UserData');
    720718TimeUnit=get(handles.TimeUnit,'String');
     
    725723nbfield2=siztime(2)-1;
    726724%indchosen=1;  %%first pair selected by default
    727 %displ_num used to define the indices of the civ_input pairs
    728725% in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices
    729726% are relative to the reference indices ref_i and ref_j respectively.
    730727if isequal(mode_selected,'pair j1-j2')
    731728    dt=1;
    732     displ='';
    733729    index=0;
    734730    numlist_a=[];
     
    751747    end
    752748    [dtsort,indsort]=sort(displ_dt);
    753     if ~isempty(numlist_a)
    754         displ_num(1,:)=numlist_a(indsort);
    755         displ_num(2,:)=numlist_b(indsort);
    756     end
    757     displ_num(3,:)=0;
    758     displ_num(4,:)=0;
    759749    enable_j(handles, 'off')
    760750elseif isequal(mode_selected,'series(Dj)') %| isequal(mode,'st_series(Dj)')
    761     index=1:200;
    762     displ_num(1,index)=-floor(index/2);
    763     displ_num(2,index)=ceil(index/2);
    764     displ_num(3:4,index)=zeros(2,200);
    765751    enable_j(handles, 'on')
    766752elseif isequal(mode_selected,'series(Di)') %| isequal(mode,'st_series(Di)')
    767 %     index=1:200;
    768 %     displ_num(1:2,index)=zeros(2,200);
    769 %     displ_num(3,index)=-floor(index/2);
    770 %     displ_num(4,index)=ceil(index/2);
    771753    enable_i(handles, 'on')
    772754    if nbfield2 > 1
     
    776758    end
    777759elseif isequal(mode_selected,'displacement')%the pairs have the same indices
    778     displ_num(1,1)=0;
    779     displ_num(2,1)=0;
    780     displ_num(3,1)=0;
    781     displ_num(4,1)=0;
    782760    if nbfield > 1 || nbfield==0
    783761        enable_i(handles, 'on')
     
    791769    end
    792770end
    793 %set(handles.ListPairCiv1,'UserData',displ_num);
    794771errormsg=find_netcpair_civ( handles,1);
    795     if ~isempty(errormsg)
     772if ~isempty(errormsg)
    796773    msgbox_uvmat('ERROR',errormsg)
    797     end
    798 % find_netcpair_civ2(handles)
    799 
     774end
     775
     776%------------------------------------------------------------------------
    800777function enable_i(handles, state)
    801778set(handles.itext,'Visible',state)
    802 % set(handles.MinIndex_i,'Visible',state)
    803 % set(handles.last_i,'Visible',state)
    804 % set(handles.incr_i,'Visible',state)
    805779set(handles.MaxIndex_i,'Visible',state)
    806780set(handles.ref_i,'Visible',state)
    807781
     782%------------------------------------------------------------------------
    808783function enable_j(handles, state)
    809784set(handles.jtext,'Visible',state)
    810 % set(handles.MinIndex_j,'Visible',state)
    811 % set(handles.last_j,'Visible',state)
    812 % set(handles.incr_j,'Visible',state)
    813785set(handles.MinIndex_j,'Visible',state)
    814786set(handles.MaxIndex_j,'Visible',state)
    815787set(handles.ref_j,'Visible',state)
    816 %hseries=findobj(allchild(0),'Tag','series');
    817 %hhseries=guidata(hseries);
    818 %series('enable_j',hhseries,state); %file input with xml reading  in uvmat, show the image in phys coordinates
    819 
    820 
    821788
    822789%------------------------------------------------------------------------
     
    874841errormsg='';
    875842CivInputData=get(handles.civ_input,'UserData');
    876 %browse=get(handles.RootPath,'UserData');
    877843compare_list=get(handles.ListCompareMode,'String');
    878844val=get(handles.ListCompareMode,'Value');
     
    896862menu_pair=get(handles.ListPairCiv2,'String');%previous menu of ListPairCiv1
    897863PairCiv2Init=menu_pair{get(handles.ListPairCiv2,'Value')};%previous choice of pair
    898 
    899 %% determine nom_type_nc, nomenclature type of the .nc files:
    900 %[nom_type_nc]=nomtype2pair(nom_type_ima,mode);
    901864
    902865%% reads .nc subdirectoy and image numbers from the interface
     
    924887nbpair=200;%default
    925888select=ones(size(1:nbpair));%flag for displayed pairs =1 for display
    926 %nbpair=200; %default
    927889
    928890%% determine the menu display in .ListPairCiv1
     
    991953        end
    992954    case 'displacement'
    993         displ_pair={'Di=Dj=0'};
    994         displ_pair_dt={'Di=Dj=0'};
    995 end
    996 if index==1
     955%         displ_pair={'Di=Dj=0'};
     956%         displ_pair_dt={'Di=Dj=0'};
     957        set(handles.PairIndices,'Visible','off')
     958end
     959if index==1 && ~strcmp(mode_selected,'displacement')
    997960    set(handles.ListPairCiv1,'String',displ_pair_dt');
    998961end
     
    1011974   set(handles.ListPairCiv1,'Value',1)
    1012975end
    1013 % if initial>nbpair || (numel(select)>=initial && ~isequal(select(initial),1))
    1014 %     set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
    1015 % end
    1016976
    1017977%% determine the default selection in the pair menu for Civ2
     978if ~strcmp(mode_selected,'displacement')
    1018979if strcmp(get(handles.ListPairCiv2,'Visible'),'on')
    1019980    end_pair=regexp(PairCiv2Init,' :dt=');
     
    1031992end
    1032993set(handles.ListPairCiv2,'String',displ_pair_dt');
     994end
    1033995set(gcf,'Pointer','arrow')% Indicate that the process is finished
    1034996
     
    23052267if ~isempty(filexml)
    23062268    Param=xml2struct(filexml);% read the input xml file as a Matlab structure
    2307 
    2308    % Param.Action.RUN=0; %desactivate the input RUN=1
    23092269    if ~isfield(Param,'InputTable')||~isfield(Param,'IndexRange')
    23102270        msgbox_uvmat('ERROR','invalid config file: open a file in a folder ''/0_XML''')
     
    23262286end
    23272287
     2288%------------------------------------------------------------------------
    23282289% --- Executes on selection change in CheckCiv3.
     2290%------------------------------------------------------------------------
    23292291function CheckCiv3_Callback(hObject, eventdata, handles)
    23302292
     2293%------------------------------------------------------------------------
    23312294% --- Executes on button press in CheckRefFile.
     2295%------------------------------------------------------------------------
    23322296function CheckRefFile_Callback(hObject, eventdata, handles)
    23332297
    2334     hseries=findobj(allchild(0),'Tag','series');
    2335     hhseries=guidata(hseries);
    2336     InputTable=get(hhseries.InputTable,'Data');
    2337     InputFile=fullfile(InputTable{1,1},InputTable{1,2},[InputTable{1,3} InputTable{1,5}]);
    2338  % browse for a reference file for displacement
    2339     fileref= uigetfile_uvmat('pick a reference image file:',InputFile);
    2340         if ~isempty(fileref)
    2341     set(handles.RefFile,'String',fileref)
    2342     set(handles.ConfigSource,'String','NEW')
    2343     set(handles.ConfigSource,'BackgroundColor',[1 0 1])
    2344         end
     2298hseries=findobj(allchild(0),'Tag','series');
     2299hhseries=guidata(hseries);
     2300InputTable=get(hhseries.InputTable,'Data');
     2301i1=str2num(get(hhseries.num_first_i,'String'));
     2302j1=str2num(get(hhseries.num_first_j,'String'));
     2303InputFile=fullfile_uvmat(InputTable{1,1},InputTable{1,2},InputTable{1,3},InputTable{1,5},InputTable{1,4},i1,[],j1);
     2304% browse for a reference file for displacement
     2305fileref= uigetfile_uvmat('pick a reference image file:',InputFile);
     2306if ~isempty(fileref)
     2307    FileInfo=get_file_info(fileref);
     2308    CheckImage=strcmp(FileInfo.FieldType,'image');% =1 for images
     2309    if ~CheckImage
     2310        msgbox_uvmat('ERROR',['invalid file type input for reference image: ' FileInfo.FileType ' not an image'])
     2311    else
     2312        if isfield (FileInfo,'NumberOfFrames')&& FileInfo.NumberOfFrames>1
     2313            set(handles.num_OriginIndex,'Visible','on')
     2314            set(handles.OriginIndex_title,'Visible','on')
     2315        else
     2316            set(handles.num_OriginIndex,'Visible','off')
     2317            set(handles.OriginIndex_title,'Visible','off')
     2318        end
     2319        set(handles.RefFile,'String',fileref)
     2320        set(handles.ConfigSource,'String','NEW')
     2321        set(handles.ConfigSource,'BackgroundColor',[1 0 1])
     2322    end
     2323end
    23452324
    23462325%------------------------------------------------------------------------
  • trunk/src/series/merge_proj.m

    r1030 r1033  
    134134
    135135%% determine the file type on each line from the first input file
    136 ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
    137136NcTypeOptions={'netcdf','civx','civdata'};
    138137for iview=1:NbView
     
    146145        FileType{iview}='netcdf';
    147146    end
    148     CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
     147    CheckImage{iview}=strcmp(FileInfo{iview}.FieldType,'image');% =1 for images
    149148    if CheckImage{iview}
    150149        ParamIn{iview}=MovieObject{iview};
  • trunk/src/series/sub_background.m

    r1032 r1033  
    107107
    108108    %% check the validity of  input file types
    109     ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom','image_DaVis'};%allowed input file types(images)
    110109    FileInfo=get_file_info(FirstFileName);
    111110    FileType=FileInfo.FileType;
    112     CheckImage=~isempty(find(strcmp(FileType,ImageTypeOptions), 1));% =1 for images
     111    CheckImage=strcmp(FileInfo.FieldType,'image');% =1 for images
    113112    if ~CheckImage
    114113        msgbox_uvmat('ERROR',['invalid file type input: ' FileType ' not an image'])
  • trunk/src/series/turb_stat.m

    r1032 r1033  
    114114
    115115%% determine the file type on each line from the first input file
    116 ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
    117116NcTypeOptions={'netcdf','civx','civdata'};
    118117for iview=1:NbView
     
    123122    [FileInfo{iview},MovieObject{iview}]=get_file_info(filecell{iview,1});
    124123    FileType{iview}=FileInfo{iview}.FileType;
    125     CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
    126124    CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
    127125    if ~isempty(j1_series{iview})
     
    153151 % EDIT FROM HERE
    154152
    155 %% check the validity of  input file types
    156 if CheckImage{1}
    157     FileExtOut='.png'; % write result as .png images for image inputs
    158 elseif CheckNc{1}
    159     FileExtOut='.nc';% write result as .nc files for netcdf inputs
    160 else
    161     msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}])
    162     return
    163 end
    164 
    165 
    166153%% settings for the output file
     154FileExtOut='.nc';% write result as .nc files for netcdf inputs
    167155NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file
    168156first_i=i1_series{1}(1);
  • trunk/src/set_grid.m

    r1027 r1033  
    241241end
    242242[FileInfo,VideoObject]=get_file_info(GUI.ImageA);
    243 switch FileInfo.FileType
    244     case {'image','multimage','video','mmreader'}% case of input image or movie OK
    245     otherwise
    246         msgbox_uvmat('ERROR',['error: ' GUI.ImageA ' is not an image type recognized by Matlab '])
    247         return
    248 end
     243if ~strcmp(FileInfo.FieldType,'image');% =1 for images
     244    msgbox_uvmat('ERROR',['error: ' GUI.ImageA ' is not an image type recognized by Matlab '])
     245    return
     246end
     247
    249248[RootPath,SubDir,RootFile,tild,tild,tild,tild,FileExt]=fileparts_uvmat(GUI.ImageA);
    250249
     
    336335        ImageB=fullfile(PathName,FileName);
    337336        [FileInfo,tild,VideoObject]=get_file_info(ImageB);
    338     switch FileInfo.FileType
    339         case {'image','multimage','video','mmreader'}% case of input image or movie OK
    340             set(handles.ImageB,'String',ImageB)
    341         otherwise
    342             msgbox_uvmat('ERROR',['error: ' imageB ' is not an image type recognized by Matlab '])
     337        if ~strcmp(FileInfo.FieldType,'image');% =1 for images
     338            msgbox_uvmat('ERROR',['error: ' imageB ' is not an image type recognised by Matlab '])
    343339            return
    344340    end
  • trunk/src/struct2nc.m

    r1027 r1033  
    121121                VarType='nc_int';
    122122            case 'logical'
    123                 VarType='nc_byte';
     123                VarType='nc_int';
     124                Data.(ListVarName{ivar})=uint8(Data.(ListVarName{ivar}));
    124125        end
    125126        if ~isempty(VarType)
  • trunk/src/sub_field.m

    r1027 r1033  
    9999ProjModeRequest=cell(size(Field.ListVarName));
    100100if isfield(Field,'VarAttribute')
    101 for ilist=1:numel(Field.VarAttribute)
    102     if isfield(Field.VarAttribute{ilist},'ProjModeRequest')
    103         ProjModeRequest{ilist}=Field.VarAttribute{ilist}.ProjModeRequest;
    104     end
    105 end
     101    for ilist=1:numel(Field.VarAttribute)
     102        if isfield(Field.VarAttribute{ilist},'ProjModeRequest')
     103            ProjModeRequest{ilist}=Field.VarAttribute{ilist}.ProjModeRequest;
     104        end
     105    end
    106106end
    107107ProjModeRequest_1=cell(size(Field_1.ListVarName));
  • trunk/src/transform_field/phys.m

    r1027 r1033  
    7979%% transform first field
    8080iscalar=0;% counter of scalar fields
     81checktransform=0;
    8182if  ~isempty(Calib{1})
    82     if ~isfield(Calib{1},'CalibrationType')||~isfield(Calib{1},'CoordUnit')
    83         return %bad calib parameter input
    84     end
    85     if ~(isfield(DataIn,'CoordUnit')&& strcmp(DataIn.CoordUnit,'pixel'))
    86         return % transform only fields in pixel coordinates
    87     end
    88     DataOut=phys_1(DataIn,Calib{1},ZIndex);% transform coordinates and velocity components
    89     %case of images or scalar: in case of two input fields, we need to project the transform  on the same regular grid
    90     if isfield(DataIn,'A') && isfield(DataIn,'Coord_x') && ~isempty(DataIn.Coord_x) && isfield(DataIn,'Coord_y')&&...
    91                                            ~isempty(DataIn.Coord_y) && length(DataIn.A)>1
    92         iscalar=1;
    93         A{1}=DataIn.A;
     83    if isfield(Calib{1},'CalibrationType')&& isfield(Calib{1},'CoordUnit') && isfield(DataIn,'CoordUnit')&& strcmp(DataIn.CoordUnit,'pixel')   
     84        DataOut=phys_1(DataIn,Calib{1},ZIndex);% transform coordinates and velocity components
     85        %case of images or scalar: in case of two input fields, we need to project the transform  on the same regular grid
     86        if isfield(DataIn,'A') && isfield(DataIn,'Coord_x') && ~isempty(DataIn.Coord_x) && isfield(DataIn,'Coord_y')&&...
     87                ~isempty(DataIn.Coord_y) && length(DataIn.A)>1
     88            iscalar=1;
     89            A{1}=DataIn.A;
     90        end
     91        checktransform=1;
    9492    end
    9593end
    9694
    9795%% document the selected  plane position and angle if relevant
    98 if isfield(Calib{1},'SliceCoord')&&size(Calib{1}.SliceCoord,1)>=ZIndex
     96if  checktransform && isfield(Calib{1},'SliceCoord')&&size(Calib{1}.SliceCoord,1)>=ZIndex
    9997    DataOut.PlaneCoord=Calib{1}.SliceCoord(ZIndex,:);% transfer the slice position corresponding to index ZIndex
    10098    if isfield(Calib{1},'SliceAngle') % transfer the slice rotation angles
     
    108106
    109107%% transform second field if relevant
     108checktransform_1=0;
    110109if ~isempty(DataOut_1)
    111110    if isfield(DataIn_1,'ZIndex') && ~isequal(DataIn_1.ZIndex,ZIndex)
     
    113112        return
    114113    end
    115     if ~isfield(Calib{2},'CalibrationType')||~isfield(Calib{2},'CoordUnit')
    116         return %bad calib parameter input
    117     end
    118     if (isfield(DataIn_1,'CoordUnit')&& strcmp(DataIn_1.CoordUnit,'pixel'))
     114    if isfield(Calib{2},'CalibrationType')&&isfield(Calib{2},'CoordUnit') && isfield(DataIn_1,'CoordUnit')&& strcmp(DataIn_1.CoordUnit,'pixel')
    119115        DataOut_1=phys_1(DataOut_1,Calib{2},ZIndex);
    120     end
    121     if isfield(Calib{1},'SliceCoord')
    122         if ~(isfield(Calib{2},'SliceCoord') && isequal(Calib{2}.SliceCoord,Calib{1}.SliceCoord))
    123             DataOut_1.Txt='different plane positions for the two input fields';
    124             return
    125         end
    126         DataOut_1.PlaneCoord=DataOut.PlaneCoord;% same plane position for the two input fields
    127         if isfield(Calib{1},'SliceAngle')
    128             if ~(isfield(Calib{2},'SliceAngle') && isequal(Calib{2}.SliceAngle,Calib{1}.SliceAngle))
    129                 DataOut_1.Txt='different plane angles for the two input fields';
     116        if isfield(Calib{1},'SliceCoord')
     117            if ~(isfield(Calib{2},'SliceCoord') && isequal(Calib{2}.SliceCoord,Calib{1}.SliceCoord))
     118                DataOut_1.Txt='different plane positions for the two input fields';
    130119                return
    131120            end
    132             DataOut_1.PlaneAngle=DataOut.PlaneAngle; % same plane angle for the two input fields
    133         end
    134     end
    135     if isfield(DataIn_1,'A')&&isfield(DataIn_1,'Coord_x')&&~isempty(DataIn_1.Coord_x) && isfield(DataIn_1,'Coord_y')&&...
    136             ~isempty(DataIn_1.Coord_y)&&length(DataIn_1.A)>1
    137         iscalar=iscalar+1;
    138         Calib{iscalar}=Calib{2};
    139         A{iscalar}=DataIn_1.A;
     121            DataOut_1.PlaneCoord=DataOut.PlaneCoord;% same plane position for the two input fields
     122            if isfield(Calib{1},'SliceAngle')
     123                if ~(isfield(Calib{2},'SliceAngle') && isequal(Calib{2}.SliceAngle,Calib{1}.SliceAngle))
     124                    DataOut_1.Txt='different plane angles for the two input fields';
     125                    return
     126                end
     127                DataOut_1.PlaneAngle=DataOut.PlaneAngle; % same plane angle for the two input fields
     128            end
     129        end
     130        if isfield(DataIn_1,'A')&&isfield(DataIn_1,'Coord_x')&&~isempty(DataIn_1.Coord_x) && isfield(DataIn_1,'Coord_y')&&...
     131                ~isempty(DataIn_1.Coord_y)&&length(DataIn_1.A)>1
     132            iscalar=iscalar+1;
     133            Calib{iscalar}=Calib{2};
     134            A{iscalar}=DataIn_1.A;
     135        end
     136        checktransform_1=1;
    140137    end
    141138end
    142139
    143140%% transform the scalar(s) or image(s)
    144 if iscalar~=0
     141if checktransform && iscalar~=0
    145142    [A,Coord_x,Coord_y]=phys_ima(A,XmlData,ZIndex);%TODO : introduire interp2_uvmat ds phys_ima
    146143    if iscalar==1 && ~isempty(DataOut_1) % case for which only the second field is a scalar
  • trunk/src/uvmat.m

    r1032 r1033  
    23032303    end
    23042304end
     2305if ~isempty(i1_series)
    23052306[ref_j,ref_i]=find(squeeze(i1_series(1,:,:)));
    23062307if ~isempty(j1_series)
     
    23322333     set(handles.scan_j,'Value',1)
    23332334     scan_j_Callback([],[], handles);
     2335end
    23342336end
    23352337set(handles.scan_j,'Visible',state_j)
     
    34703472    end
    34713473    test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged
    3472     if ~isequal(NomType_1,'*')&& isfield(UvData,'FileName_1')
    3473            test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ;
    3474     end
     3474%     if ~isequal(NomType_1,'*')&& isfield(UvData,'FileName_1')
     3475%            test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ;
     3476%     end
    34753477    if test_keepdata_1
    34763478        Field{2}=UvData.Field_1;% keep the stored field
     
    36903692if isempty(transform)
    36913693    UvData.Field=Field{1};
     3694    if numel(Field)==2
     3695        UvData.Field=sub_field(Field{1},[],Field{2});
     3696       % UvData.Field.(FieldName)=Field{1}.(FieldName)-Field{2}.(FieldName_1);
     3697    end     
    36923698else
    36933699    XmlData=[];%default
     
    46074613        GetFieldData=get_field(FileName,ParamIn);% inport field names from the GUI get_field
    46084614        FieldList={};
    4609         VecColorList={};
    46104615        switch GetFieldData.FieldOption
    46114616            case 'vectors'
    46124617                UName=GetFieldData.PanelVectors.vector_x;
    46134618                VName=GetFieldData.PanelVectors.vector_y;
    4614                 YName=GetFieldData.Coordinates.Coord_y;
     4619                if isfield(GetFieldData,'Coordinates')
     4620                    YName=GetFieldData.Coordinates.Coord_y;
     4621                    if isfield(GetFieldData.Coordinates,'Coord_z')
     4622                        ZName=GetFieldData.Coordinates.Coord_z;
     4623                    end
     4624                end
    46154625                CName=GetFieldData.PanelVectors.vec_color;
    46164626                FieldList={['vec(' UName ',' VName ')'];...
     
    46224632                    VecColorList=[{CName};VecColorList];
    46234633                end
     4634                 set(handles.ColorScalar,'Value',1)
     4635                 set(handles.ColorScalar,'String',VecColorList);
    46244636            case 'scalar'
     4637                set(handles.Scalar,'Visible','on')
     4638                ResizeFcn(gcbo,[],handles)
    46254639                AName=GetFieldData.PanelScalar.scalar;
    4626                 YName=GetFieldData.Coordinates.Coord_y;
     4640                if isfield(GetFieldData,'Coordinates')
     4641                    YName=GetFieldData.Coordinates.Coord_y;
     4642                    if isfield(GetFieldData.Coordinates,'Coord_z')
     4643                        ZName=GetFieldData.Coordinates.Coord_z;
     4644                    end
     4645                end
    46274646                FieldList={AName};
    46284647            case '1D plot'
    46294648                YName=GetFieldData.PanelOrdinate.ordinate;
     4649                FieldList={''};
    46304650            case 'civdata...'%reinitiate input, return to automatic civ data reading
    46314651                display_file_name(handles,FileName,1)
    4632         end
     4652        end     
    46334653        if ~strcmp(GetFieldData.FieldOption,'civdata...')
    46344654            XName=GetFieldData.Coordinates.Coord_x;
     
    46594679            set(handles.FieldName_1,'Value',1)
    46604680            set(handles.FieldName_1,'String',[FieldList; {'get_field...'}]);
    4661             set(handles.ColorScalar,'Value',1)
    4662             set(handles.ColorScalar,'String',VecColorList);
     4681           
    46634682            UvData.FileType{2}='netcdf';
    46644683            set(handles.uvmat,'UserData',UvData)
Note: See TracChangeset for help on using the changeset viewer.