Changeset 512


Ignore:
Timestamp:
Aug 3, 2012, 2:50:24 PM (12 years ago)
Author:
sommeria
Message:

various cleaning

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_files.m

    r506 r512  
    5454    'fill_GUI';...%  fill a GUI with a set of parameters from a Matlab structure
    5555    'filter_tps';...% find the thin plate spline coefficients for interpolation-smoothing
    56     'find_field_indices';...% group the variables of a 'field object' into 'field cells' and specify their structure
     56    'find_field_cells';...% group the variables of a 'field object' into 'field cells' and specify their structure
    5757    'find_file_series';...%check the content of an input file and find the corresponding file series
    5858    'find_imadoc';...% find the ImaDoc xml file associated with a given input file
  • trunk/src/civ.m

    r506 r512  
    533533else
    534534    set(handles.ImaDoc,'String',''); %xml file not used for timing
    535     time=(i1_series(:,1)+0:size(i1_series,1)-1);% time=index i
     535    time=(i1_series(:,1)+0:size(i1_series,3)-1);% time=index i
    536536    time=time'*ones(1,size(i1_series,2),1); %makes a time matrix with the same time for all j indices
    537537    TimeUnit='frame';
     
    25332533% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
    25342534[RootPath,SubDir,RootFile_1,i1_series,i2_series,j1_series,j2_series,nom_type_1,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName Ext]);
    2535        
    2536        % [tild,tild,RootFile_1,tild,tild,tild,tild,tild,nom_type_1]=fileparts_uvmat(fileinput);
    2537         %[RootFile_1,i1_series,tild,j1_series,tild,nom_type_1,FileType,Object]=find_file_series(PathName,FileName);
     2535
    25382536        %check image nom type
    25392537        if ~strcmp(nom_type_1,get(handles.NomType,'String'))
  • trunk/src/find_file_series.m

    r497 r512  
    290290    end
    291291end
    292 
    293 
     292i1_series=permute(i1_series,[3 2 1]);% permute dimensions
     293i2_series=permute(i2_series,[3 2 1]);% permute dimensions
     294j1_series=permute(j1_series,[3 2 1]);% permute dimensions
     295j2_series=permute(j2_series,[3 2 1]);% permute dimensions
  • trunk/src/get_field.m

    r503 r512  
    218218
    219219set(handles.scalar,'String', Txt )
    220 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Field);
     220[CellVarIndex,NbDim,VarType,errormsg]=find_field_cells(Field);
    221221if ~isempty(errormsg) 
    222     msgbox_uvmat('ERROR',['error in get_field/Field_input/find_field_indices: ' errormsg])
     222    msgbox_uvmat('ERROR',['error in get_field/Field_input/find_field_cells: ' errormsg])
    223223    return
    224224end 
     
    301301    variables_Callback(hObject, eventdata, handles)
    302302end
    303 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Field);
     303[CellVarIndex,NbDim,VarType,errormsg]=find_field_cells(Field);
    304304for icell=1:numel(CellVarIndex)
    305305    VarIndex=CellVarIndex{icell};
  • trunk/src/mouse_down.m

    r497 r512  
    110110                        tagaxes=get(hchild,'tag');
    111111                        if isfield(FigData,tagaxes)
    112                             eval(['Field=FigData.' tagaxes ';'])
    113                             [CellVarIndex,NbDim,VarType]=find_field_indices(Field);%analyse the physical fields contained in Field
     112                            Field=FigData.(tagaxes);
     113                            [CellVarIndex,NbDim,VarType]=find_field_cells(Field);%analyse the physical fields contained in Field
    114114                            for icell=1:numel(CellVarIndex)%look for all physical fields
    115115                                if NbDim(icell)==2 % select 2D field
  • trunk/src/mouse_motion.m

    r441 r512  
    9797            tagaxes=get(CurrentAxes,'tag');
    9898            if isfield(FigData,tagaxes)
    99                 eval(['Field=FigData.' tagaxes ';'])
     99                Field=FigData.(tagaxes);
    100100                if isfield(Field,'ListVarName')
    101                     [CellVarIndex,NbDim,VarType]=find_field_indices(Field);%analyse the physical fields contained in Field
     101                    [CellVarIndex,NbDim,VarType]=find_field_cells(Field);%analyse the physical fields contained in Field
    102102                    text_displ_1='';
    103103                    text_displ_2='';
  • trunk/src/plot_field.m

    r511 r512  
    66%     2D vector fields are represented by arrows, 2D scalar fields by grey scale images or contour plots, 1D fields are represented by usual plot with (abscissa, ordinate).
    77%  The input field structure is first tested by check_field_structure.m,
    8 %  then split into blocks of related variables  by find_field_indices.m.
     8%  then split into blocks of related variables  by find_field_cells.m.
    99%  The dimensionality of each block is obtained  by this function
    1010%  considering the presence of variables with the attribute .Role='coord_x'
     
    117117end
    118118% check the cells of fields :
    119 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data);
     119[CellVarIndex,NbDim,VarType,errormsg]=find_field_cells(Data);
    120120if ~isempty(errormsg)
    121     msgbox_uvmat('ERROR',['input of plot_field/find_field_indices: ' errormsg]);
     121    msgbox_uvmat('ERROR',['input of plot_field/find_field_cells: ' errormsg]);
    122122    return
    123123end
  • trunk/src/proj_field.m

    r494 r512  
    3636%           .VarAttribute: cell of structures s containing names and values of variable attributes (s.name=value) for each variable of .ListVarName
    3737%        .Var1, .Var2....: variables (Matlab arrays) with names listed in .ListVarName
    38 % The variables are grouped in 'fields', made of a set of variables with common dimensions (using the function find_field_indices)
     38% The variables are grouped in 'fields', made of a set of variables with common dimensions (using the function find_field_cells)
    3939% The variable attribute 'Role' is used to define the role for plotting:
    4040%       Role = 'scalar':  (default) represents a scalar field
     
    178178[ProjData,errormsg]=proj_heading(FieldData,ObjectData);
    179179ProjData.NbDim=0;
    180 [CellVarIndex,NbDimCell,VarTypeCell,errormsg]=find_field_indices(FieldData);
     180[CellVarIndex,NbDimCell,VarTypeCell,errormsg]=find_field_cells(FieldData);
    181181if ~isempty(errormsg)
    182182    errormsg=['error in proj_field/proj_points:' errormsg];
     
    372372% DimVarIndex=0;%initilise list of indices for dimension variables
    373373idimvar=0;
    374 [CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_indices(FieldData);
     374[CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_cells(FieldData);
    375375if ~isempty(errormsg)
    376376    errormsg=['error in proj_field/proj_patch:' errormsg];
     
    593593
    594594%% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
    595 [CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_indices(FieldData);
     595[CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_cells(FieldData);
    596596if ~isempty(errormsg)
    597597    errormsg=['error in proj_field/proj_line:' errormsg];
     
    10081008idimvar=0;
    10091009
    1010 [CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_indices(FieldData);
     1010[CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_cells(FieldData);
    10111011if ~isempty(errormsg)
    10121012    errormsg=['error in proj_field/proj_plane:' errormsg];
     
    16791679%-----------------------------------------------------------------
    16801680idimvar=0;
    1681 [CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_indices(FieldData);
     1681[CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_cells(FieldData);
    16821682if ~isempty(errormsg)
    16831683    errormsg=['error in proj_field/proj_plane:' errormsg];
  • trunk/src/series.m

    r495 r512  
    588588
    589589%% display the min and max indices for all the file series
    590 i_sum=sum(sum(i1_series,2),3);%sum of i1_series on the last index
     590i_sum=sum(sum(i1_series,2),1);%sum of i1_series on the last index
    591591MaxIndex_i=max(find(i_sum>0))-1;% max ref index i
    592592MinIndex_i=min(find(i_sum>0))-1;% min ref index i
    593593i2_min=[];
    594594if ~isempty(i2_series)
    595     i2_min=i2_series(1,2);
     595    i2_min=i2_series(1,2,2);
    596596end
    597597j1_min=[];
    598598if ~isempty(j1_series)
    599     j1_min=j1_series(1,2);
     599    j1_min=j1_series(1,2,2);
    600600end
    601601j2_min=[];
    602602if ~isempty(j2_series)
    603     j2_min=j2_series(1,2);
     603    j2_min=j2_series(1,2,2);
    604604end
    605605if isequal(MinIndex_i,1) &&...
     
    607607    MinIndex_i=0;
    608608end
    609 j_sum=sum(sum(j1_series,1),3);
     609j_sum=sum(sum(j1_series,1),1);
    610610MaxIndex_j=max(find(j_sum>0))-1;
    611611MinIndex_j=min(find(j_sum>0))-1;
     
    793793nbview=numel(SeriesData.i1_series);
    794794for iview=1:nbview
    795     index_min(iview)=min(find(SeriesData.i1_series{iview}(2:end,2:end,1)>0));
    796     index_max(iview)=max(find(SeriesData.i1_series{iview}(2:end,2:end,1)>0));
     795    index_min(iview)=min(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0));
     796    index_max(iview)=max(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0));
    797797end
    798798index_min=min(index_min);
     
    808808    ind_y=1+(iview-1)*range_y:iview*range_y;
    809809    LineData=zeros(1,range_index);
    810     x_index=find(SeriesData.i1_series{iview}(2:end,2:end,1)>0)-index_min+1;
     810    x_index=find(SeriesData.i1_series{iview}(1,2:end,2:end)>0)-index_min+1;
    811811    LineData(x_index)=1;
    812812    LineData=interp1(x,LineData,xI,'nearest');
     
    815815CData=cat(3,zeros(size(CData)),CData,zeros(size(CData)));
    816816set(handles.FileStatus,'CData',CData);
    817 
    818 %
    819 %
    820 % xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices
    821 % yima=0.5:pos(4)-0.5;
    822 % [XIma,YIma]=meshgrid(xima,yima);
    823 % nb_i=size(i1_series,1);
    824 % nb_j=size(i1_series,2);
    825 % ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i;
    826 % ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j;
    827 % [Ind_i,Ind_j]=meshgrid(ind_i,ind_j);
    828 % CData=zeros([size(XIma) 3]);%black color
    829 % file_ima=double((i1_series(:,:,1)>0)');
    830 % if numel(file_ima)>=2
    831 % if size(file_ima,1)==1
    832 %     CLine=interp1(ind_i,file_ima,xima,'nearest');
    833 %     CData(:,:,2)=ones(size(yima'))*CLine;
    834 % else
    835 %     CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest');
    836 % end
    837 % set(handles.FileStatus,'CData',CData)
    838 % end
    839 % set(handles.FileStatus,'Units','normalized')
    840817
    841818
     
    10771054% end
    10781055for iview=1:numel(SeriesData.i1_series)
    1079     index_min(iview)=min(find(SeriesData.i1_series{iview}(2:end,2:end,1)>0));
    1080     index_max(iview)=max(find(SeriesData.i1_series{iview}(2:end,2:end,1)>0));
     1056    index_min(iview)=min(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0));
     1057    index_max(iview)=max(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0));
    10811058end
    10821059[index_min,iview_min]=min(index_min);
     
    21852162yima=0.5:pos(4)-0.5;
    21862163[XIma,YIma]=meshgrid(xima,yima);
    2187 nb_i=size(i1_series,1);
     2164nb_i=size(i1_series,3);
    21882165nb_j=size(i1_series,2);
    21892166ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i;
  • trunk/src/sub_field.m

    r494 r512  
    6565
    6666%% check the two input fields     
    67 [CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_indices(Field);
     67[CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_cells(Field);
    6868if ~isempty(errormsg)
    6969    errormsg=['invalid  first input to sub_field:' errormsg];
    7070    return
    7171end
    72 [CellVarIndex_1,NbDim_1,VarTypeCell_1,errormsg]=find_field_indices(Field_1);
     72[CellVarIndex_1,NbDim_1,VarTypeCell_1,errormsg]=find_field_cells(Field_1);
    7373if ~isempty(errormsg)
    7474    errormsg=['invalid second input to sub_field:' errormsg];
  • trunk/src/uvmat.m

    r511 r512  
    5151%
    5252% 1) Input filenames are determined by MenuBrowse (first field), MenuBrowse_1
    53 % (second field), or by the stored file names under  Browse, or as an input of uvmat.
    54 % 2) These functions call 'display_file_name.m' which detects the file series, and fills the file index boxes
    55 % 3) Then 'update_rootinfo.m' Updates information about a new field series (indices to scan, timing, calibration from an xml file)
    56 % 4) Then fields are opened and visualised by the main sub-function 'refresh_field.m'
    57 % The function first reads the name of the input file from the edit boxes  of the GUI
    58 % A second input file can be introduced for file comparison
    59 % It then reads the input file(s) with the appropriate function, read for
    60 % images, read_civxdata.m for CIVx PIV data, nc2struct for other netcdf
    61 % files.
    62 %               Main input open   second input open(_1)        second image (pair animation)
    63 %            |                 |                             
    64 %            |                 |                                               
    65 %                     Field{1}         Field{2}               
    66 %                                                                         |
    67 % coord transform (phys.m) or other user defined  fct acting on Field{i}  |
    68 %                                                                   Field{i}
    69 %                                                                    |
    70 % calc_field.m: calculate scalar or other derived fields (vort, div..).
     53% (second field), or by the stored file name .FileName_1, or as an input of uvmat.
     54% 2) These functions call 'uvmat/display_file_name.m' which detects the file series, and fills the file index boxes
     55% 3) Then 'uvmat/update_rootinfo.m' Updates information about a new field series (indices to scan, timing, calibration from an xml file)
     56% 4) Then fields are opened and visualised by the main sub-function 'uvmat/refresh_field.m'
     57% The function first reads the name of the input file(s) (one or two) from the edit boxes  of the GUI
     58% It then reads the input file(s) with the function read_field.m and perform the following list of operations:
    7159%
    72 % sub_field.m: combine the input Field{i} in a single set of fields (vector + scalar):
    73 %              Field{i=1->3}.X --> UvData.X                          |
    74 %                                                                    |
    75 %                                                                 UvData
    76 %                                                                    |
    77 % plot histograms of the whole  field
    78 % proj_field.m: project the set of fields on the current projection objects defined by UvData.Object
    79 %                                                                    |                                                                          |
    80 %                                                                ObjectData
    81 %                                                                    |
    82 % plot_field.m: plot the projected fields and store them as          |
    83 % UvData.PlotAxes                                        |
    84 %                                                                    |
    85 %                                                                AxeData
     60%    %%%%%%%%  structure of uvmat/refresh_field.m %%%%%%%%
     61%
     62%           Main input open       second input open_1       
     63%                    |                   | 
     64%             read_field.m            read_field.m
     65%                    |                   |
     66%                 Field{1}            Field{2}               
     67%                    |                   |                                 
     68%                    --->transform fct<---             transform (e.g. phys.m) and combine input fields 
     69%                            |                                   
     70%                        (calc_tps.m)               calculate tps coefficients (for filter projection or spatial derivatives).
     71%                            |
     72%                       (calc_field.m)               calculate field
     73%                            |
     74%                       UvData.Field-------------->histogram
     75%               _____________|____________
     76%              |                          |                   
     77%        proj_field.m               proj_field.m       project the field on the projection objects             
     78%              |                          |
     79%         UvData.PlotAxes          ViewData.PlotAxes (on view_field)
     80%              |                          |
     81%       plot_field.m (uvmat)       plot_field.m (view_field)      plot the projected fields
     82%
     83% rmq: calc_field can be performed instead at the level of proj_field when needed
     84%
    8685%
    8786%%%%%%%%%%%%%%    SCALARS: %%%%%%%%%%%%??%%%
     
    357356function MenuBrowse_Callback(hObject, eventdata, handles)
    358357[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    359 oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
     358%oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
     359oldfile=fullfile(RootPath,SubDir);
    360360if isempty(oldfile)||isequal(oldfile,'') %loads the previously stored file name and set it as default in the file_input box
    361361         dir_perso=prefdir;
     
    371371fileinput=[PathName FileName];%complete file name
    372372if ~exist(fileinput,'file')
    373     return %abandon of the browser is cancelled
     373    return %abandon if the browser is cancelled
    374374end
    375375
     
    10141014    end
    10151015end
    1016 [ref_i,ref_j]=find(i1_series);
     1016[ref_j,ref_i]=find(i1_series);
    10171017if ~isempty(j1_series)
    10181018        state_j='on';
     
    15831583        if get(handles.scan_i,'Value')==1% case of scanning along index i
    15841584            ref_i=ref_i+step;
    1585             while ref_i>=0  && size(UvData.i1_series{1},1)>=ref_i+1 && UvData.i1_series{1}(ref_i+1,ref_j+1,1)==0
     1585            while ref_i>=0  && size(UvData.i1_series{1},3)>=ref_i+1 && UvData.i1_series{1}(1,ref_j+1,ref_i+1)==0
    15861586                ref_i=ref_i+step;
    15871587            end
    15881588        else % case of scanning along index j (burst numbers)
    15891589            ref_j=ref_j+step;
    1590             while ref_j>=0  && size(UvData.i1_series{1},2)>=ref_j+1 && UvData.i1_series{1}(ref_i+1,ref_j+1,1)==0
     1590            while ref_j>=0  && size(UvData.i1_series{1},2)>=ref_j+1 && UvData.i1_series{1}(1,ref_j+1,ref_i+1)==0
    15911591                ref_j=ref_j+step;
    15921592            end
     
    15971597    elseif ref_j<0
    15981598        errormsg='minimum j index reached';
    1599     elseif ref_i+1>size(UvData.i1_series{1},1)
     1599    elseif ref_i+1>size(UvData.i1_series{1},3)
    16001600        errormsg='maximum i index reached (reload the input file to update the index bound)';
    16011601    elseif ref_j+1>size(UvData.i1_series{1},2)
     
    16031603    end
    16041604    if ~isempty(errormsg),return,end
    1605     i1_subseries=UvData.i1_series{1}(ref_i+1,ref_j+1,:);
    1606     i1_subseries=i1_subseries(i1_subseries>0);
    1607     if isempty(i1_subseries)% case of pairs
    1608         i1_subseries=UvData.i1_series{1}(ref_i+1,:,:);
    1609     end
    1610     if isempty(i1_subseries),errormsg='no next frame: set num_IndexIncrement =''*'' to reach the next existing file';return
    1611     else
    1612         i1=i1_subseries(end);
    1613     end
     1605    siz=size(UvData.i1_series{1});
     1606    ref_indices=ref_i*siz(1)*siz(2)+ref_j*siz(1)+1:ref_i*siz(1)*siz(2)+(ref_j+1)*siz(1);   
     1607    i1_subseries=UvData.i1_series{1}(ref_indices);
     1608    ref_indices=ref_indices(i1_subseries>0);
     1609    if isempty(ref_indices)% case of pairs (free index i)
     1610        ref_indices=ref_i*siz(1)*siz(2)+1:(ref_i+1)*siz(1)*siz(2);
     1611        i1_subseries=UvData.i1_series{1}(ref_indices);
     1612        ref_indices=ref_indices(i1_subseries>0);
     1613    end
     1614    if isempty(ref_indices),errormsg='no next frame: set num_IndexIncrement =''*'' to reach the next existing file';return
     1615    end
     1616    i1=UvData.i1_series{1}(ref_indices(end));
    16141617    if ~isempty(UvData.i2_series{1})
    1615         i2_subseries=UvData.i2_series{1}(ref_i+1,ref_j+1,:);
    1616         i2_subseries=i2_subseries(i2_subseries>0);
    1617         i2=i2_subseries(end);
     1618        i2=UvData.i2_series{1}(ref_indices(end));
    16181619    end
    16191620    if ~isempty(UvData.j1_series{1})
    1620         j1_subseries=UvData.j1_series{1}(ref_i+1,ref_j+1,:);
    1621         j1_subseries=j1_subseries(j1_subseries>0);
    1622         j1=j1_subseries(end);
     1621        j1=UvData.j1_series{1}(ref_indices(end));
    16231622    end
    16241623    if ~isempty(UvData.j2_series{1})
    1625         j2_subseries=UvData.j2_series{1}(ref_i+1,ref_j+1,:);
    1626         j2_subseries=j2_subseries(j2_subseries>0);
    1627         j2=j2_subseries(end);
     1624        j2=UvData.j2_series{1}(ref_indices(end));
    16281625    end 
    1629     % case of a second file series
     1626    % case of a second file series (TODO:revise)
    16301627    if numel(UvData.i1_series)>=2
    16311628        i1_subseries=UvData.i1_series{2}(ref_i+1,ref_j+1,:);
     
    17051702UvData=get(handles.uvmat,'UserData');
    17061703if isequal(FieldName,'image')
    1707     test_1=0;
     1704    index=1;
    17081705    [RootPath,SubDir,RootFile,FileIndices,Ext]=read_file_boxes(handles);
    17091706    NomType=get(handles.NomType,'String');
     
    17131710    FieldName=list_fields{index_fields}; % selected field
    17141711    if isequal(FieldName,'image')
    1715         test_1=1;
     1712        index=2;
    17161713        [RootPath,tild,RootFile,FileIndex_1,Ext,NomType]=read_file_boxes_1(handles);
    17171714    else
     
    17391736    num_i2=num_i1;%repeat the index i1 by default
    17401737end
    1741 % imaname_1=name_generator(filebase,num_i2,num_j2,Ext,NomType);
    17421738imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,Ext,NomType,num_i2,[],num_j2);
     1739if strcmp(NomType,'*')
     1740    num_frame=num_i2;
     1741else
     1742    num_frame=num_j2;
     1743end
    17431744if ~exist(imaname_1,'file')
    17441745      msgbox_uvmat('ERROR',['second input open (-)  ' imaname_1 ' not found']);
     
    17481749end
    17491750
     1751%% get the first image
     1752%Field.AName='image';
     1753if index==1
     1754    Field_a=UvData.Field;% movie on the second field
     1755else
     1756    Field_a=UvData.Field_1;% movie on the first field
     1757end
     1758
    17501759%% read the second image
    1751 Field.AName='image';
    1752 if test_1
    1753     Field_a=UvData.Field_1;
    1754 else
    1755     Field_a=UvData.Field;
    1756 end
    1757 Field_b.AX=Field_a.AX;
    1758 Field_b.AY=Field_a.AY;
    1759 % z index
    1760 nbslice=str2double(get(handles.num_NbSlice,'String'));
    1761 if ~isempty(nbslice)
    1762     Field_b.ZIndex=mod(num_i2-1,nbslice)+1;
    1763 end
    1764 Field_b.CoordUnit='pixel';
    1765 
    1766 %% determine the input file type
    1767 if (test_1 && isfield(UvData,'MovieObject')&& numel(UvData.MovieObject>=2))||(~test_1 && ~isempty(UvData.MovieObject{1}))
    1768     FileType='movie';
    1769 elseif isequal(lower(Ext),'.avi')
    1770     FileType='avi';
    1771 elseif isequal(lower(Ext),'.vol')
    1772     FileType='vol';
    1773 else
    1774    form=imformats(Ext(2:end));
    1775    if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
    1776        if isequal(NomType,'*');
    1777            FileType='multimage';
    1778        else
    1779            FileType='image';
    1780        end
    1781    end
    1782 end
    1783 switch FileType
    1784         case 'movie'
    1785             if test_1
    1786                 Field_b.A=read(UvData.MovieObject{2},num_i2);
    1787             else
    1788                 Field_b.A=read(UvData.MovieObject{1},num_i2);
    1789             end
    1790         case 'avi'
    1791             mov=aviread(imaname_1,num_i2);
    1792             Field_b.A=frame2im(mov(1));
    1793         case 'vol'
    1794             Field_b.A=imread(imaname_1);
    1795         case 'multimage'
    1796             Field_b.A=imread(imaname_1,num_i2);
    1797         case 'image'
    1798             Field_b.A=imread(imaname_1);
    1799 end
    1800 if get(handles.slices,'Value')
    1801     Field.ZIndex=str2double(get(handles.z_index,'String'));
    1802 end
     1760MovieObject=[];
     1761if numel(UvData.MovieObject)>=index
     1762    MovieObject=UvData.MovieObject{index};
     1763end
     1764[Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileType{index},MovieObject,num_frame)
     1765% Field_b.AX=Field_a.AX;
     1766% Field_b.AY=Field_a.AY;
     1767% % z index
     1768% nbslice=str2double(get(handles.num_NbSlice,'String'));
     1769% if ~isempty(nbslice)
     1770%     Field_b.ZIndex=mod(num_i2-1,nbslice)+1;
     1771% end
     1772% Field_b.CoordUnit='pixel';
     1773%
     1774% %% determine the input file type
     1775% if (test_1 && isfield(UvData,'MovieObject')&& numel(UvData.MovieObject>=2))||(~test_1 && ~isempty(UvData.MovieObject{1}))
     1776%     FileType='movie';
     1777% elseif isequal(lower(Ext),'.avi')
     1778%     FileType='avi';
     1779% elseif isequal(lower(Ext),'.vol')
     1780%     FileType='vol';
     1781% else
     1782%    form=imformats(Ext(2:end));
     1783%    if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
     1784%        if isequal(NomType,'*');
     1785%            FileType='multimage';
     1786%        else
     1787%            FileType='image';
     1788%        end
     1789%    end
     1790% end
     1791% switch FileType
     1792%         case 'movie'
     1793%             if test_1
     1794%                 Field_b.A=read(UvData.MovieObject{2},num_i2);
     1795%             else
     1796%                 Field_b.A=read(UvData.MovieObject{1},num_i2);
     1797%             end
     1798%         case 'avi'
     1799%             mov=aviread(imaname_1,num_i2);
     1800%             Field_b.A=frame2im(mov(1));
     1801%         case 'vol'
     1802%             Field_b.A=imread(imaname_1);
     1803%         case 'multimage'
     1804%             Field_b.A=imread(imaname_1,num_i2);
     1805%         case 'image'
     1806%             Field_b.A=imread(imaname_1);
     1807% end
     1808% if get(handles.slices,'Value')
     1809%     Field.ZIndex=str2double(get(handles.z_index,'String'));
     1810% end
    18031811
    18041812%px to phys or other transform on field
    1805 menu_transform=get(handles.transform_fct,'String');
    1806 choice_value=get(handles.transform_fct,'Value');
    1807 transform_name=menu_transform{choice_value};%name of the transform fct  given by the menu 'transform_fct'
    1808 transform_list=get(handles.transform_fct,'UserData');
    1809 transform=transform_list{choice_value};
    1810 if  ~isequal(transform_name,'') && ~isequal(transform_name,'px')
    1811     if test_1 && isfield(UvData,'XmlData') && numel(UvData.XmlData)==2 && isfield(UvData.XmlData{2},'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
    1812         Field_a=transform(Field_a,UvData.XmlData{2});%the first field has been stored without transform
    1813         Field_b=transform(Field_b,UvData.XmlData{2});
    1814     elseif ~test_1 && isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'GeometryCalib')%use geometry calib
    1815         Field_b=transform(Field_b,UvData.XmlData{1});
     1813% menu_transform=get(handles.transform_fct,'String');
     1814% choice_value=get(handles.transform_fct,'Value');
     1815% transform_name=menu_transform{choice_value};%name of the transform fct  given by the menu 'transform_fct'
     1816% transform_list=get(handles.transform_fct,'UserData');
     1817transform=get(handles.path_transform,'UserData');
     1818if  ~isempty(transform)
     1819    if isfield(UvData,'XmlData') && numel(UvData.XmlData)>=index %use geometry calib recorded from the ImaDoc xml file as first priority
     1820        if index==2
     1821        Field_a=transform(Field_a,UvData.XmlData{index});%the first field has been stored without transform
     1822        end
     1823        Field_b=transform(Field_b,UvData.XmlData{index});
    18161824    end
    18171825end
     
    22492257%% store the current open names, fields and vel types in uvmat interface
    22502258UvData.FileName_1=FileName_1;
     2259UvData.ParamOut_1=ParamOut_1;
     2260if numel(Field)==2
     2261UvData.Field_1=Field{2}; %store the second field for possible use at next RUN
     2262end
    22512263
    22522264%% apply coordinate transform or other user fct
     
    22622274    end
    22632275    transform=get(handles.path_transform,'UserData');
    2264     nbre_arg=nargin(transform);
    2265     if length(Field)==2
    2266         if nbre_arg==4
    2267             [Field{1},Field{2}]=transform(Field{1},XmlData,Field{2},XmlData_1);
    2268         else
    2269             Field{1}=transform(Field{1},XmlData);
    2270             Field(2)=[];
    2271         end
    2272     else
    2273         if nbre_arg==1
    2274             Field{1}=transform(Field{1});%transform which does not need input parameter
    2275         else
    2276             Field{1}=transform(Field{1},XmlData);
    2277         end
     2276    switch nargin(transform)
     2277        case 4
     2278            if length(Field)==2
     2279                UvData.Field=transform(Field{1},XmlData,Field{2},XmlData_1);
     2280            else
     2281                UvData.Field=transform(Field{1},XmlData);
     2282            end
     2283        case 3
     2284            if length(Field)==2
     2285                UvData.Field=transform(Field{1},XmlData,Field{2});
     2286            else
     2287                UvData.Field=transform(Field{1},XmlData);
     2288            end
     2289        case 2
     2290            UvData.Field=transform(Field{1},XmlData);
     2291        case 1
     2292            UvData.Field=transform(Field{1});
    22782293    end
    22792294end
     
    22932308       check_tps=1;%tps needed to get the requested field
    22942309end
    2295 if (check_tps ||check_proj_tps)&&~isfield(Field{1},'Coord_tps')
    2296     Field{1}=calc_tps(Field{1});
    2297 end
    2298 Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}];
     2310if (check_tps ||check_proj_tps)&&~isfield(UvData.Field,'Coord_tps')
     2311    UvData.Field=calc_tps(UvData.Field);
     2312end
     2313UvData.Field.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    22992314
    23002315%% calculate scalar
     
    23022317         &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut.FieldName,'get_field...')
    23032318    if ~check_proj_tps
    2304         Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});
     2319        UvData.Field=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],UvData.Field);
    23052320    end
    23062321end
     
    23142329end
    23152330
    2316 %% combine the two input fields (e.g. substract velocity fields)
    2317 if numel(Field)==2
    2318    [UvData.Field,errormsg]=sub_field(Field{1},Field{2}); 
    2319    UvData.Field_1=Field{2}; %store the second field for possible use at next RUN
    2320    UvData.ParamOut_1=ParamOut_1;
    2321 else
    2322    UvData.Field=Field{1};
    2323 end
    2324 if ~isempty(errormsg)
    2325     errormsg=['error in uvmat/refresh_field/sub_field:' errormsg];
    2326     return
    2327 end
    2328 %UvData.Field.FieldList={FieldName}; % TODO: to generalise, used for proj_field with tps interpolation
    23292331
    23302332%% analyse input field
     
    23362338    return
    23372339end
    2338 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(UvData.Field);% analyse  the input field structure
     2340[CellVarIndex,NbDim,VarType,errormsg]=find_field_cells(UvData.Field);% analyse  the input field structure
    23392341if ~isempty(errormsg)
    2340     errormsg=['error in uvmat/refresh_field/find_field_indices: ' errormsg];% display error
     2342    errormsg=['error in uvmat/refresh_field/find_field_cells: ' errormsg];% display error
    23412343    return
    23422344end
     
    35133515
    35143516%% create the function handle of the selected fct
     3517
    35153518if isempty(list_path{ichoice})% case of no selected fct
    35163519    transform_handle=[];
     
    35273530set(handles.path_transform,'String',list_path{ichoice})
    35283531set(handles.path_transform,'UserData',transform_handle)
     3532set(handles.transform_fct,'UserData',list_path)
    35293533
    35303534%% update the ToolTip string of the menu transform_fct with the first line of the selected fct file
     
    48064810ProjectDir = uigetdir(fileparts(fileparts(RootPath)), 'select the project source directory');
    48074811datatree_browser(ProjectDir)
     4812
     4813
     4814% --------------------------------------------------------------------
     4815function MenuBrowseProject_Callback(hObject, eventdata, handles)
     4816RootPath=get(handles.RootPath,'String');
     4817ProjectDir = uigetdir(fileparts(fileparts(RootPath)), 'select the project directory');
     4818datatree_browser(ProjectDir)
Note: See TracChangeset for help on using the changeset viewer.