Changeset 1009 for trunk


Ignore:
Timestamp:
Jul 22, 2017, 7:20:02 PM (7 years ago)
Author:
sommeria
Message:

various bugs fixed

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_field_cells.m

    r977 r1009  
    7575for ilist=1:numel(Data.ListVarName)
    7676    if ~isfield(Data,Data.ListVarName{ilist})
    77         check_var=0;% dimensions of data defined, data not needed for this function
     77        check_var=0;% dimensions of array defined, but the corresponding array is not given
    7878        break
    7979    end
    8080end
    81 if ~check_var &&  ~(isfield(Data,'ListDimName')&& isfield(Data,'DimValue')&&isequal(numel(Data.ListDimName),numel(Data.DimValue)))
    82     errormsg=['missing variable or values of dimensions' Data.ListVarName{ilist}];
    83     return
    84 end
     81% if ~check_var &&  ~(isfield(Data,'ListDimName')&& isfield(Data,'DimValue')&& isequal(numel(Data.ListDimName),numel(Data.DimValue)))
     82%     errormsg=['missing dimension values'];
     83%     return
     84% end
    8585
    8686
  • trunk/src/find_file_series.m

    r977 r1009  
    1111% NomType: nomenclature type corrected after checking the first file (problem of 0 before the number string)
    1212% FileInfo: structure containing info on the input files (assumed identical on the whole series)
    13     % FileInfo.FileType: type of file, =
    14     %       = 'image', usual image as recognised by Matlab
    15     %       = 'multimage', image series stored in a single file
    16     %       = 'civx', netcdf file with civx convention
    17     %       = 'civdata', civ data with new convention
    18     %       = 'netcdf' other netcdf files
    19     %       = 'video': movie recognised by VideoReader (e;g. avi)
     13% FileInfo.FileType: type of file, =
     14%       = 'image', usual image as recognised by Matlab
     15%       = 'multimage', image series stored in a single file
     16%       = 'civx', netcdf file with civx convention
     17%       = 'civdata', civ data with new convention
     18%       = 'netcdf' other netcdf files
     19%       = 'video': movie recognised by VideoReader (e;g. avi)
    2020% MovieObject: video object (=[] otherwise
    2121% i1_input,i2_input,j1_input,j2_input: indices of the input file, or of the first file in the series if the input file does not exist
     
    2323%INPUT
    2424% FilePath: path to the directory to be scanned
    25 % fileinput: name (without path) of the input file sample 
     25% fileinput: name (without path) of the input file sample
    2626% checkxml: =1(default) take into account xml file existence to possibly include indexes in RootFile
    2727%           =0: do not take into account xml file existence
     
    5353
    5454%% check for particular file types: images, movies, civ data
    55 checkfileindexing=0;
    5655if isfield(FileInfo,'FileIndexing') && strcmp(FileInfo.FileIndexing,'on')
    5756    [RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput);
    58     if ~isempty(regexp(SubDir,'^level\d+$')) && exist([RootPath '.xml'],'file')
    59         NomType='level';
    60     end
     57    %     if ~isempty(regexp(SubDir,'^level\d+$')) && exist([RootPath '.xml'],'file')
     58    %         NomType='level';
     59    %     end
    6160    i1_series=zeros(1,1,1);
    6261    i2_series=zeros(1,1,1);
     
    7574        return
    7675    end
     76    checkfileindexing=0;
    7777end
    7878if ~exist(FilePath,'dir')
     
    173173            end
    174174        end
    175         if strcmp(NomType,'level')
    176             star_string=[RootFile '*' FileExt];
    177             detect_string=['^' RootFile '(?<i1>\d+)' FileExt '$'];%string used in regexp to detect file indices
    178              wd=pwd;%current working directory
    179             cd (FilePath)% move to the local dir to save time in the operation dir.
    180             dirpair=dir(star_string);% look for relevant files in the file directory
    181             cd(wd)% back to the working directory
    182             nbpair=numel(dirpair);
    183             i1_series=zeros(1,nbpair);
    184             if nbpair==0% no detected file
    185                 RootFile='';
    186             end
    187             % scan the list of relevant files, extract the indices
    188             for ifile=1:nbpair
    189                 rr=regexp(dirpair(ifile).name,detect_string,'names');
    190                 if ~isempty(rr)
    191                     i1_series(ifile)=str2num(rr.i1);                 
    192                 end
    193             end
    194             % look for the list of subfolders level#
    195             cd (RootPath)% move to the local dir to save time in the operation dir.
    196             dirpair=dir('level*');% look for relevant subfolders named with leve#
    197             cd(wd)
    198             [RootPath,SubDir]=fileparts(RootPath);
    199             nbpair=numel(dirpair);
    200             jfile=0;
    201             for ifile=1:nbpair
    202                 rr=regexp(dirpair(ifile).name,'^level(?<i1>\d+)$','names');
    203                 if ~isempty(rr)
    204                     jfile=jfile+1;
    205                     j1_series(jfile)=str2num(rr.i1);             
    206                 end
    207             end
    208             [j1_series,i1_series]=meshgrid(j1_series,i1_series);
    209 %             i1_series=reshape(i1_series,1,[]);
    210 %             j1_series=reshape(j1_series,1,[]);
     175        %         if strcmp(NomType,'level')
     176        %             star_string=[RootFile '*' FileExt];
     177        %             detect_string=['^' RootFile '(?<i1>\d+)' FileExt '$'];%string used in regexp to detect file indices
     178        %             wd=pwd;%current working directory
     179        %             cd (FilePath)% move to the local dir to save time in the operation dir.
     180        %             dirpair=dir(star_string);% look for relevant files in the file directory
     181        %             cd(wd)% back to the working directory
     182        %             nbpair=numel(dirpair);
     183        %             i1_series=zeros(1,nbpair);
     184        %             if nbpair==0% no detected file
     185        %                 RootFile='';
     186        %             end
     187        %             % scan the list of relevant files, extract the indices
     188        %             for ifile=1:nbpair
     189        %                 rr=regexp(dirpair(ifile).name,detect_string,'names');
     190        %                 if ~isempty(rr)
     191        %                     i1_series(ifile)=str2num(rr.i1);
     192        %                 end
     193        %             end
     194        %             % look for the list of subfolders level#
     195        %             cd (RootPath)% move to the local dir to save time in the operation dir.
     196        %             dirpair=dir('level*');% look for relevant subfolders named with leve#
     197        %             cd(wd)
     198        %             [RootPath,SubDir]=fileparts(RootPath);
     199        %             nbpair=numel(dirpair);
     200        %             jfile=0;
     201        %             for ifile=1:nbpair
     202        %                 rr=regexp(dirpair(ifile).name,'^level(?<i1>\d+)$','names');
     203        %                 if ~isempty(rr)
     204        %                     jfile=jfile+1;
     205        %                     j1_series(jfile)=str2num(rr.i1);
     206        %                 end
     207        %             end
     208        %             [j1_series,i1_series]=meshgrid(j1_series,i1_series);
     209        %         else
     210        detect_string=['^' RootFile sep1 i1_str i2_str sep2 j1_str j2_str FileExt '$'];%string used in regexp to detect file indices
     211        %find the string used to extract the relevant files with the command dir
     212        star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt];
     213        wd=pwd;%current working directory
     214        cd (FilePath)% move to the local dir to save time in the operation dir.
     215        dirpair=dir(star_string);% look for relevant files in the file directory
     216        cd(wd)
     217        nbpair=numel(dirpair);
     218        ref_i_list=zeros(1,nbpair);
     219        ref_j_list=zeros(1,nbpair);
     220        if nbpair==0% no detected file
     221            RootFile='';
     222        end
     223        % scan the list of relevant files, extract the indices
     224        for ifile=1:nbpair
     225            rr=regexp(dirpair(ifile).name,detect_string,'names');
     226            if ~isempty(rr)
     227                i1=str2num(rr.i1);
     228                i2=str2num(regexprep(rr.i2,'^-',''));
     229                j1=stra2num(regexprep(rr.j1,'^_',''));
     230                j2=stra2num(regexprep(rr.j2,'^-',''));
     231                ref_i=i1;
     232                if isempty(i2_input)
     233                    if ~isempty(i2)% invalid file name if i2 does not exist in the input file
     234                        break
     235                    end
     236                else
     237                    ref_i=floor((i1+i2)/2);
     238                end
     239                ref_j=1;
     240                if isempty(j1_input)
     241                    if  ~isempty(j1)% invalid file name if j1 does not exist in the input file
     242                        break
     243                    end
     244                else %j1_input is not empty
     245                    if isempty(j1)% the detected name does not fit with the input
     246                        break
     247                    else
     248                        ref_j=j1;
     249                        if isempty(j2_input)
     250                            if  ~isempty(j2)% invalid file name if j2 does not exist in the input file
     251                                break
     252                            end
     253                        else
     254                            ref_j=floor((j1+j2)/2);
     255                        end
     256                    end
     257                end
     258                % update the detected index series
     259                if ~isempty(ref_i)&&~isempty(ref_j)
     260                    ref_i_list(ifile)=ref_i;
     261                    ref_j_list(ifile)=ref_j;
     262                    nb_pairs=0;
     263                    if ~isempty(i2_input)|| ~isempty(j2_input) %deals with  pairs
     264                        if size(i1_series,1)>=ref_i+1 && size(i1_series,2)>=ref_j+1
     265                            nb_pairs=numel(find(i1_series(ref_i+1,ref_j+1,:)~=0));
     266                        end
     267                    end
     268                    if i1==0
     269                        i1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
     270                    end
     271                    if j1==0
     272                        j1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
     273                    end
     274                    i1_series(ref_i+1,ref_j+1,nb_pairs+1)=i1;
     275                    if ~isempty(i2_input)
     276                        i2_series(ref_i+1,ref_j+1,nb_pairs+1)=i2;
     277                    end
     278                    if ~isempty(j1_input)
     279                        j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1;
     280                    end
     281                    if ~isempty(j2_input)
     282                        j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1;
     283                        j2_series(ref_i+1,ref_j+1,nb_pairs+1)=j2;
     284                    end
     285                end
     286            end
     287        end
     288        % look for the numerical string of the first files to update the NomType (take into account the 0 before the number)
     289        max_j=max(ref_j_list);
     290        if isempty(max_j)
     291            ref_ij=ref_i_list;
    211292        else
    212             detect_string=['^' RootFile sep1 i1_str i2_str sep2 j1_str j2_str FileExt '$'];%string used in regexp to detect file indices
    213             %find the string used to extract the relevant files with the command dir
    214             star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt];
    215             wd=pwd;%current working directory
    216             cd (FilePath)% move to the local dir to save time in the operation dir.
    217             dirpair=dir(star_string);% look for relevant files in the file directory
    218             cd(wd)
    219             nbpair=numel(dirpair);
    220             ref_i_list=zeros(1,nbpair);
    221             ref_j_list=zeros(1,nbpair);
    222             if nbpair==0% no detected file
    223                 RootFile='';
    224             end
    225             % scan the list of relevant files, extract the indices
    226             for ifile=1:nbpair
    227                 rr=regexp(dirpair(ifile).name,detect_string,'names');
    228                 if ~isempty(rr)
    229                     i1=str2num(rr.i1);
    230                     i2=str2num(regexprep(rr.i2,'^-',''));
    231                     j1=stra2num(regexprep(rr.j1,'^_',''));
    232                     j2=stra2num(regexprep(rr.j2,'^-',''));
    233                     ref_i=i1;
    234                     if isempty(i2_input)
    235                         if ~isempty(i2)% invalid file name if i2 does not exist in the input file
    236                             break
    237                         end
    238                     else
    239                         ref_i=floor((i1+i2)/2);
    240                     end
    241                     ref_j=1;
    242                     if isempty(j1_input)
    243                         if  ~isempty(j1)% invalid file name if j1 does not exist in the input file
    244                             break
    245                         end
    246                     else %j1_input is not empty
    247                         if isempty(j1)% the detected name does not fit with the input
    248                             break
    249                         else
    250                             ref_j=j1;
    251                             if isempty(j2_input)
    252                                 if  ~isempty(j2)% invalid file name if j2 does not exist in the input file
    253                                     break
    254                                 end
    255                             else
    256                                 ref_j=floor((j1+j2)/2);
    257                             end
    258                         end
    259                     end
    260                     % update the detected index series
    261                     if ~isempty(ref_i)&&~isempty(ref_j)
    262                         ref_i_list(ifile)=ref_i;
    263                         ref_j_list(ifile)=ref_j;
    264                         nb_pairs=0;
    265                         if ~isempty(i2_input)|| ~isempty(j2_input) %deals with  pairs
    266                             if size(i1_series,1)>=ref_i+1 && size(i1_series,2)>=ref_j+1
    267                                 nb_pairs=numel(find(i1_series(ref_i+1,ref_j+1,:)~=0));
    268                             end
    269                         end
    270                         if i1==0
    271                             i1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
    272                         end
    273                         if j1==0
    274                             j1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
    275                         end
    276                         i1_series(ref_i+1,ref_j+1,nb_pairs+1)=i1;
    277                         if ~isempty(i2_input)
    278                             i2_series(ref_i+1,ref_j+1,nb_pairs+1)=i2;
    279                         end
    280                         if ~isempty(j1_input)
    281                             j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1;
    282                         end
    283                         if ~isempty(j2_input)
    284                             j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1;
    285                             j2_series(ref_i+1,ref_j+1,nb_pairs+1)=j2;
    286                         end
    287                     end
    288                 end
    289             end
    290             % look for the numerical string of the first files to update the NomType (take into account the 0 before the number)
    291             max_j=max(ref_j_list);
    292             if isempty(max_j)
    293                 ref_ij=ref_i_list;
    294             else
    295                 ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i.
    296             end
    297             ind_select=find(ref_ij>0);
    298            
    299             if ~isempty(ind_select)
    300                 [tild,ifile_min]=min(ref_ij(ind_select));
    301                 [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ind_select(ifile_min)).name);% update the representation of indices (number of 0 before the number)
    302                 NomType=regexprep(NomType,['^' NomTypePref],'');
    303                 %% update the file type if the input file does not exist (pb of 0001)
    304                 if isempty(FileInfo.FileType)
    305                     [FileInfo,MovieObject]=get_file_info(fullfile(FilePath,dirpair(ifile_min).name));
    306                 end
    307             end
    308         end
    309     end
    310 
    311 %% set to empty array the irrelevant index series
    312 if isequal(i1_series,0), i1_series=[]; end
    313 if isequal(i2_series,0), i2_series=[]; end
    314 if isequal(j1_series,0), j1_series=[]; end
    315 if isequal(j2_series,0), j2_series=[]; end
     293            ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i.
     294        end
     295        ind_select=find(ref_ij>0);
     296       
     297        if ~isempty(ind_select)
     298            [tild,ifile_min]=min(ref_ij(ind_select));
     299            [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ind_select(ifile_min)).name);% update the representation of indices (number of 0 before the number)
     300            NomType=regexprep(NomType,['^' NomTypePref],'');
     301            %% update the file type if the input file does not exist (pb of 0001)
     302            if isempty(FileInfo.FileType)
     303                [FileInfo,MovieObject]=get_file_info(fullfile(FilePath,dirpair(ifile_min).name));
     304            end
     305        end
     306        %         end
     307    end
     308   
     309    %% set to empty array the irrelevant index series
     310    if isequal(i1_series,0), i1_series=[]; end
     311    if isequal(i2_series,0), i2_series=[]; end
     312    if isequal(j1_series,0), j1_series=[]; end
     313    if isequal(j2_series,0), j2_series=[]; end
     314   
     315    %% case of isolated input file, not member of an  indexed series
     316    if isempty(i1_series)
     317        [PathDir,RootFile]=fileparts(fullfileinput);
     318        [RootPath,SubDir,DirExt]=fileparts(PathDir);
     319        SubDir=[SubDir DirExt];% include part after . in the name (considered as a file extension)
     320        NomType='*';
     321        i2_series=[];j1_series=[];j2_series=[];
     322%         i1_input=1;i2_input=[];j1_input=[];j2_input=[];
     323        if ~exist(fullfileinput,'file')
     324            RootFile='';
     325            return
     326        end
     327    end
    316328end
    317329% %% detect rdvision format
     
    332344    else  % if there is a file index, j denotes the frame index while i denotes the file index
    333345        if ~isempty(regexp(NomType,'ab$', 'once'))% recognized as a pair
    334             RootFile=fullfile_uvmat('','',RootFile,'',NomType,i1_input,i2_input,j1_input,j2_input);% restitute the root name without the detected indices       
     346            RootFile=fullfile_uvmat('','',RootFile,'',NomType,i1_input,i2_input,j1_input,j2_input);% restitute the root name without the detected indices
    335347            i1_series=zeros(FileInfo.NumberOfFrames+1,2);% first column =0
    336348            i1_series(:,2)=(0:FileInfo.NumberOfFrames)'; % second column=frame index -1
     
    388400    end
    389401end
    390 i1_series=permute(i1_series,[3 2 1]);% permute dimensions 
     402i1_series=permute(i1_series,[3 2 1]);% permute dimensions
    391403i2_series=permute(i2_series,[3 2 1]);% permute dimensions
    392 j1_series=permute(j1_series,[3 2 1]);% permute dimensions 
     404j1_series=permute(j1_series,[3 2 1]);% permute dimensions
    393405j2_series=permute(j2_series,[3 2 1]);% permute dimensions
  • trunk/src/geometry_calib.m

    r1008 r1009  
    220220
    221221%% Apply calibration
    222 [GeometryCalib,index,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
     222[GeometryCalib,index,ind_removed,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
    223223
    224224%% record the coordinate unit
     
    238238answer=msgbox_uvmat('INPUT_Y-N',{'store calibration data';...
    239239    ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
    240     ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']});
     240    ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels'];
     241    [num2str(numel(ind_removed)) ' points removed']});
    241242if strcmp(answer,'Yes') %store the calibration data
    242243    if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration
     
    334335
    335336%% Apply calibration
    336 [GeometryCalib,index,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
     337[GeometryCalib,index,ind_removed,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
    337338
    338339
     
    353354answer=msgbox_uvmat('INPUT_Y-N',{'store calibration data';...
    354355    ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
    355     ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']});
     356    ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels'];...
     357    [num2str(numel(ind_removed)) ' points removed']});
    356358if strcmp(answer,'Yes') %store the calibration data
    357359    if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration
     
    395397%------------------------------------------------------------------------
    396398% --- activate calibration and store parameters in ouputfile .
    397 function [GeometryCalib,index,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic)
     399function [GeometryCalib,ind_max,ind_removed,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic)
    398400%------------------------------------------------------------------------
    399401
    400402index=[];
    401 
     403GeometryCalib=[];
    402404% apply the calibration, whose type is selected in  handles.calib_type
    403405if ~isempty(Coord)
    404406    GeometryCalib=feval(CalibFcn,Coord,Intrinsic);
    405407else
    406     GeometryCalib=[];
    407408    msgbox_uvmat('ERROR','No calibration points, abort')
    408409end
     
    411412end
    412413Z_plane=[];
    413 if ~isempty(Coord)
    414     %check error
     414
     415% estimate calibration error rms and max
     416X=Coord(:,1);
     417Y=Coord(:,2);
     418Z=Coord(:,3);
     419x_ima=Coord(:,4);
     420y_ima=Coord(:,5);
     421[Xpoints,Ypoints]=px_XYZ(GeometryCalib,X,Y,Z);
     422GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima)));
     423GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima)));
     424[ErrorMax(1),index(1)]=max(abs(Xpoints-x_ima));
     425[ErrorMax(2),index(2)]=max(abs(Ypoints-y_ima));
     426[tild,ind_dim]=max(ErrorMax);
     427ind_max=index(ind_dim); % mark the index with maximum deviation
     428
     429% detect bad calibration points, marked by indices ind_bad, if the
     430% difference of actual image coordinates and those given by calibration is
     431% greater than 2 pixels and greater than 4 rms.
     432check_x=abs(Xpoints-x_ima)>max(2,3*GeometryCalib.ErrorRms(1));
     433check_y=abs(Ypoints-y_ima)>max(2,3*GeometryCalib.ErrorRms(2));
     434ind_removed=find(check_x | check_y)
     435% repeat calibration without the excluded points:
     436if ~isempty(ind_removed)
     437    Coord(ind_removed,:)=[];
     438    GeometryCalib=feval(CalibFcn,Coord,Intrinsic);
    415439    X=Coord(:,1);
    416440    Y=Coord(:,2);
     
    420444    [Xpoints,Ypoints]=px_XYZ(GeometryCalib,X,Y,Z);
    421445    GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima)));
    422     [GeometryCalib.ErrorMax(1),index(1)]=max(abs(Xpoints-x_ima));
    423446    GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima)));
    424     [GeometryCalib.ErrorMax(2),index(2)]=max(abs(Ypoints-y_ima));
    425     [tild,ind_dim]=max(GeometryCalib.ErrorMax);
    426     index=index(ind_dim);
    427     %set the Z position of the reference plane used for calibration
    428     if isequal(max(Z),min(Z))%Z constant
    429         Z_plane=Z(1);
    430         GeometryCalib.NbSlice=1;
    431         GeometryCalib.SliceCoord=[0 0 Z_plane];
    432     end
     447end
     448GeometryCalib.ErrorMax=ErrorMax;
     449%set the Z position of the reference plane used for calibration
     450if isequal(max(Z),min(Z))%Z constant
     451    Z_plane=Z(1);
     452    GeometryCalib.NbSlice=1;
     453    GeometryCalib.SliceCoord=[0 0 Z_plane];
    433454end
    434455
  • trunk/src/get_field.m

    r977 r1009  
    1515% INPUT:
    1616% FileName: name (including path) of the netcdf file to open
     17% ParmIn: structure containing parameters for preselecting menus:
     18%   .Title: set the title of the GUI get_field
     19%   .SwitchVarIndexTime='file index','variable' or 'matrix index': select the default option for 'time'
     20%   .TimeAttrName: preselect the name of a global attribute for time
     21%   .SeriesInput=1 if get_field is called by the GUI series,=0 otherwise (plot options provided in the latter case)
     22%   .Coord_x,.Coord_y,.Coord_z, names of the variables used as the three coordinates
     23%   .scalar : set the default choise of the scale variable
     24%   .vector_x, .vector_y : set the default choise for the variables used for the x and y vector components
    1725
    1826%=======================================================================
     
    8593end
    8694if ~exist('ParamIn','var')
    87     ParamIn=[];
     95    ParamIn.Coord_z='';
    8896end
    8997
     
    151159    time_index=find(~cellfun('isempty',regexp(Field.Display.ListGlobalAttribute,'Time')),1);% look for global attribute containing name 'Time'
    152160end
    153 if ~isempty(time_index)
     161if isempty(time_index)
     162    set(handles.SwitchVarIndexTime,'Value',1);
     163else
    154164    set(handles.SwitchVarIndexTime,'Value',2);
    155165    set(handles.TimeName,'UserData',time_index)
    156 else
    157     set(handles.SwitchVarIndexTime,'Value',1);
    158166end
    159167set(handles.SwitchVarIndexTime,'String',ListSwitchVarIndexTime)
     
    230238    CoordIndex=CellInfo{imax}.CoordIndex;
    231239    if numel(CoordIndex)==2
     240        if isfield(ParamIn,'Coord_x')&& isfield(ParamIn,'Coord_y')
     241            YName=ParamIn.Coord_y;
     242            XName=ParamIn.Coord_x;
     243        else
    232244        YName=Field.ListVarName{CoordIndex(1)};
    233245        XName=Field.ListVarName{CoordIndex(2)};
     246        end
    234247        ListCoord=get(handles.Coord_x,'String');
    235248        XIndex=find(strcmp(XName,ListCoord));
     
    259272
    260273%% set z coordinate menu if relevant
    261 if Field.MaxDim>=3 && prod(Field.DimValue)<10^8; % 3D field (with memory content smaller than 400 Mo)
     274if Field.MaxDim>=3 && prod(Field.DimValue)<10^8 && ~isempty(ParamIn.Coord_z); % 3D field (with memory content smaller than 400 Mo)
    262275    set(handles.Check3D,'Value',1)
    263276else
  • trunk/src/get_file_info.m

    r1007 r1009  
    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%      .FileIndexing='on' for data files (when series of indexed files are  expected)
    89%      .Height: image height in pixels
    910%      .Width:  image width in pixels
  • trunk/src/mouse_motion.m

    r977 r1009  
    129129    if isfield(FigData,tagaxes)
    130130        Field=FigData.(tagaxes); % the current field is sought as substructure of FigData with key tagaxes
     131
    131132        if isfield(Field,'ListVarName')
    132133            [CellInfo,NbDimArray]=find_field_cells(Field);%analyse the physical fields contained in Field
  • trunk/src/proj_field.m

    r1002 r1009  
    730730                        if  strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x');
    731731                            ivar_U=nbvar+ivar;
    732                         elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');TriScatteredInterp
     732                        elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');
    733733                            ivar_V=nbvar+ivar;
    734734                        end
     
    738738            elseif isequal(ProjMode,'interp_lin')  %filtering %linear interpolation:
    739739                if ~check_abscissa
    740                     XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
    741                     ProjData.ListVarName=[ProjData.ListVarName {XName}];TriScatteredInterp
     740                    %XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
     741                    XName='X';
     742                    ProjData.ListVarName=[ProjData.ListVarName {XName}];
    742743                    ProjData.VarDimName=[ProjData.VarDimName {XName}];
    743744                    nbvar=numel(ProjData.ListVarName);
  • trunk/src/series.m

    r1008 r1009  
    642642        RootFile='';
    643643    else %scan the input folder
     644        InputTable{iview,3}(1)=[];
    644645            [RootPath,~,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=...
    645646                find_file_series(fullfile(InputTable{iview,1},InputTable{iview,2}),[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}]);
  • trunk/src/series/stereo_civ.m

    r985 r1009  
    453453        Data.Civ1_FF(ind_good)=FFres;
    454454        Data.CivStage=3;
    455              
    456        
    457        
    458        
    459 %               
    460 %          % get z from u and v (displacements)
    461 %       
    462 %         tempXmid=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ1_X-0.5)/(Npx-1);%temporary coordinate (velocity taken at the point middle from imgae 1 and 2)
    463 %         tempYmid=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ1_Y-0.5)/(Npy-1);%temporary coordinate (velocity taken at the point middle from imgae 1 and 2)
    464 %         tempUphys=Data.Civ1_U_smooth*(Rangx(2)-Rangx(1))/(Npx-1);
    465 %         tempVphys=Data.Civ1_V_smooth*(Rangy(2)-Rangy(1))/(Npy-1);
    466 %         [tempZphys,tempXphys,tempYphys,tempCiv3_E]=shift2z(tempXmid,tempYmid,tempUphys,tempVphys,XmlData); %Data.Xphys and Data.Xphys are real coordinate (geometric correction more accurate than xtemp/ytemp)
    467 %         temp=find(Data.Civ1_FF~=0);
    468 %         tempXmid(temp)=[];
    469 %         tempYmid(temp)=[];
    470 %         tempZphys(temp)=[];
    471 %             
     455               
    472456    end
    473457   
     
    651635        par_civ3.ImageA=par_civ1.ImageA;
    652636        par_civ3.ImageB=par_civ1.ImageB;
    653         %         if ~isfield(Param.Civ1,'ImageA')
    654 %         i1=i1_series_Civ3(ifield);
    655 %         i2=i1;
    656 %         if ~isempty(i2_series_Civ3)
    657 %             i2=i2_series_Civ3(ifield);
    658 %         end
    659 %         j1=1;
    660 %         if ~isempty(j1_series_Civ3)
    661 %             j1=j1_series_Civ3(ifield);
    662 %         end
    663 %         j2=j1;
    664 %         if ~isempty(j2_series_Civ3)
    665 %             j2=j2_series_Civ3(ifield);
    666 %         end
    667637        par_civ3.ImageWidth=size(par_civ3.ImageA,2);
    668638        par_civ3.ImageHeight=size(par_civ3.ImageA,1);
     
    844814%     else
    845815       % store only phys data
    846         Data_light.ListVarName={'Xphys','Yphys','Zphys','Civ3_C','Xmid','Ymid','Uphys','Vphys','Error'};
    847         Data_light.VarDimName={'nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3'};
    848         temp=find(Data.Civ3_FF==0);
    849         Data_light.Zphys=Data.Zphys(temp);
    850         Data_light.Yphys=Data.Yphys(temp);
    851         Data_light.Xphys=Data.Xphys(temp);
    852         Data_light.Civ3_C=Data.Civ3_C(temp);
    853         Data_light.Xmid=Data.Xmid(temp);
    854         Data_light.Ymid=Data.Ymid(temp);
    855         Data_light.Uphys=Data.Uphys(temp);
    856         Data_light.Vphys=Data.Vphys(temp);
    857         Data_light.Error=Data.Error(temp);
     816       % Data_light.ListVarName={'Xphys','Yphys','Zphys','Civ3_C','Xmid','Ymid','Uphys','Vphys','Error'};
     817       % Data_light.VarDimName={'nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3'};
     818        Data_light.ListVarName={'Xphys','Yphys','Zphys','Civ3_C','DX','DY','Error'};
     819        Data_light.VarDimName={'nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3'};
     820        Data_light.VarAttribute{1}.Role='coord_x';
     821         Data_light.VarAttribute{2}.Role='coord_y';
     822         Data_light.VarAttribute{3}.Role='scalar';
     823         Data_light.VarAttribute{5}.Role='vector_x';
     824         Data_light.VarAttribute{6}.Role='vector_y';
     825        ind_good=find(Data.Civ3_FF==0);
     826        Data_light.Zphys=Data.Zphys(ind_good);
     827        Data_light.Yphys=Data.Yphys(ind_good);
     828        Data_light.Xphys=Data.Xphys(ind_good);
     829        Data_light.Civ3_C=Data.Civ3_C(ind_good);
     830%         Data_light.Xmid=Data.Xmid(ind_good);
     831%         Data_light.Ymid=Data.Ymid(ind_good);
     832        Data_light.DX=Data.Uphys(ind_good);
     833        Data_light.DY=Data.Vphys(ind_good);
     834        Data_light.Error=Data.Error(ind_good);
    858835       if exist('ncfile2','var')
    859836            errormsg=struct2nc(ncfile2,Data_light);
  • trunk/src/uvmat.m

    r1002 r1009  
    17481748[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
    17491749errormsg='';
    1750 if isempty(i1_series)
     1750if isempty(RootFile)
    17511751    fileinput=uigetfile_uvmat('pick an input file',fullfile(RootPath,SubDir));
    17521752    hh=dir(fileinput);
     
    38193819    end
    38203820
     3821    %% introduce default  projection objects in 3D
     3822    for imap=1:numel(IndexObj)
     3823        iobj=IndexObj(imap);
     3824        if numel(UvData.ProjObject)<iobj
     3825            break
     3826        end
     3827        if UvData.Field.NbDim==3
     3828            UvData.ProjObject{iobj}.NbDim=3;%test for 3D objects
     3829            if ~isfield(UvData.ProjObject{iobj},'RangeZ')
     3830            UvData.ProjObject{iobj}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
     3831            end
     3832            if iobj==1 && ~(isfield(UvData.ProjObject{iobj},'Coord') && size(UvData.ProjObject{iobj}.Coord,2)>=3 && UvData.ProjObject{iobj}.Coord(1,3)<UvData.Field.ZMax && UvData.ProjObject{iobj}.Coord(1,3)>UvData.Field.ZMin)
     3833                 UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
     3834            end
     3835        end
     3836    end
     3837   
     3838    set(handles.uvmat,'UserData',UvData)
     3839   
    38213840    %% loop on the projection objects: one or two
    38223841    for imap=1:numel(IndexObj)
     
    38243843        if numel(UvData.ProjObject)<iobj
    38253844            break
    3826         end
    3827         if UvData.Field.NbDim==3
    3828             UvData.ProjObject{iobj}.NbDim=3;%test for 3D objects
    3829             if ~isfield(UvData.ProjObject{iobj},'RangeZ')
    3830             UvData.ProjObject{iobj}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
    3831             end
    3832             if iobj==1 && ~(isfield(UvData.ProjObject{iobj},'Coord') && size(UvData.ProjObject{iobj}.Coord,2)>=3 && UvData.ProjObject{iobj}.Coord(1,3)<UvData.Field.ZMax && UvData.ProjObject{iobj}.Coord(1,3)>UvData.Field.ZMin)
    3833                  UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
    3834             end
    38353845        end
    38363846        [ObjectData,errormsg]=proj_field(UvData.Field,UvData.ProjObject{iobj});% project field on the object
     
    38723882            ObjectData.A=feval(AClass,ObjectData.A);
    38733883        end
    3874         set(handles.uvmat,'UserData',UvData)
     3884
    38753885        if ~isempty(ObjectData)
    38763886            if imap==2 && isempty(view_field_handle)
     
    43624372                    ParamIn.vec_color='Civ2_C';
    43634373            end
     4374        else
     4375            ParamIn.TimeAttrName=get(handles.TimeName,'String');
     4376            ParamIn.Coord_x=get(handles.Coord_x,'String');
     4377            ParamIn.Coord_y=get(handles.Coord_y,'String');
     4378            ParamIn.Coord_z=get(handles.Coord_z,'String');
    43644379        end
    43654380
  • trunk/src/view_field.m

    r977 r1009  
    336336    FigName=get(ListFig(ilist),'name');
    337337    if isempty(FigName)
    338         FigName=['figure ' num2str(ListFig(ilist))];
     338        FigName=['figure ' num2str(ListFig(ilist).Number)];
    339339    end
    340340    if ~strcmp(FigName,'uvmat')
Note: See TracChangeset for help on using the changeset viewer.