Changeset 512
- Timestamp:
- Aug 3, 2012, 2:50:24 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/check_files.m
r506 r512 54 54 'fill_GUI';...% fill a GUI with a set of parameters from a Matlab structure 55 55 '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 structure56 'find_field_cells';...% group the variables of a 'field object' into 'field cells' and specify their structure 57 57 'find_file_series';...%check the content of an input file and find the corresponding file series 58 58 'find_imadoc';...% find the ImaDoc xml file associated with a given input file -
trunk/src/civ.m
r506 r512 533 533 else 534 534 set(handles.ImaDoc,'String',''); %xml file not used for timing 535 time=(i1_series(:,1)+0:size(i1_series, 1)-1);% time=index i535 time=(i1_series(:,1)+0:size(i1_series,3)-1);% time=index i 536 536 time=time'*ones(1,size(i1_series,2),1); %makes a time matrix with the same time for all j indices 537 537 TimeUnit='frame'; … … 2533 2533 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 2534 2534 [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 2538 2536 %check image nom type 2539 2537 if ~strcmp(nom_type_1,get(handles.NomType,'String')) -
trunk/src/find_file_series.m
r497 r512 290 290 end 291 291 end 292 293 292 i1_series=permute(i1_series,[3 2 1]);% permute dimensions 293 i2_series=permute(i2_series,[3 2 1]);% permute dimensions 294 j1_series=permute(j1_series,[3 2 1]);% permute dimensions 295 j2_series=permute(j2_series,[3 2 1]);% permute dimensions -
trunk/src/get_field.m
r503 r512 218 218 219 219 set(handles.scalar,'String', Txt ) 220 [CellVarIndex,NbDim,VarType,errormsg]=find_field_ indices(Field);220 [CellVarIndex,NbDim,VarType,errormsg]=find_field_cells(Field); 221 221 if ~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]) 223 223 return 224 224 end … … 301 301 variables_Callback(hObject, eventdata, handles) 302 302 end 303 [CellVarIndex,NbDim,VarType,errormsg]=find_field_ indices(Field);303 [CellVarIndex,NbDim,VarType,errormsg]=find_field_cells(Field); 304 304 for icell=1:numel(CellVarIndex) 305 305 VarIndex=CellVarIndex{icell}; -
trunk/src/mouse_down.m
r497 r512 110 110 tagaxes=get(hchild,'tag'); 111 111 if isfield(FigData,tagaxes) 112 eval(['Field=FigData.' tagaxes ';'])113 [CellVarIndex,NbDim,VarType]=find_field_ indices(Field);%analyse the physical fields contained in Field112 Field=FigData.(tagaxes); 113 [CellVarIndex,NbDim,VarType]=find_field_cells(Field);%analyse the physical fields contained in Field 114 114 for icell=1:numel(CellVarIndex)%look for all physical fields 115 115 if NbDim(icell)==2 % select 2D field -
trunk/src/mouse_motion.m
r441 r512 97 97 tagaxes=get(CurrentAxes,'tag'); 98 98 if isfield(FigData,tagaxes) 99 eval(['Field=FigData.' tagaxes ';'])99 Field=FigData.(tagaxes); 100 100 if isfield(Field,'ListVarName') 101 [CellVarIndex,NbDim,VarType]=find_field_ indices(Field);%analyse the physical fields contained in Field101 [CellVarIndex,NbDim,VarType]=find_field_cells(Field);%analyse the physical fields contained in Field 102 102 text_displ_1=''; 103 103 text_displ_2=''; -
trunk/src/plot_field.m
r511 r512 6 6 % 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). 7 7 % 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. 9 9 % The dimensionality of each block is obtained by this function 10 10 % considering the presence of variables with the attribute .Role='coord_x' … … 117 117 end 118 118 % check the cells of fields : 119 [CellVarIndex,NbDim,VarType,errormsg]=find_field_ indices(Data);119 [CellVarIndex,NbDim,VarType,errormsg]=find_field_cells(Data); 120 120 if ~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]); 122 122 return 123 123 end -
trunk/src/proj_field.m
r494 r512 36 36 % .VarAttribute: cell of structures s containing names and values of variable attributes (s.name=value) for each variable of .ListVarName 37 37 % .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) 39 39 % The variable attribute 'Role' is used to define the role for plotting: 40 40 % Role = 'scalar': (default) represents a scalar field … … 178 178 [ProjData,errormsg]=proj_heading(FieldData,ObjectData); 179 179 ProjData.NbDim=0; 180 [CellVarIndex,NbDimCell,VarTypeCell,errormsg]=find_field_ indices(FieldData);180 [CellVarIndex,NbDimCell,VarTypeCell,errormsg]=find_field_cells(FieldData); 181 181 if ~isempty(errormsg) 182 182 errormsg=['error in proj_field/proj_points:' errormsg]; … … 372 372 % DimVarIndex=0;%initilise list of indices for dimension variables 373 373 idimvar=0; 374 [CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_ indices(FieldData);374 [CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_cells(FieldData); 375 375 if ~isempty(errormsg) 376 376 errormsg=['error in proj_field/proj_patch:' errormsg]; … … 593 593 594 594 %% 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); 596 596 if ~isempty(errormsg) 597 597 errormsg=['error in proj_field/proj_line:' errormsg]; … … 1008 1008 idimvar=0; 1009 1009 1010 [CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_ indices(FieldData);1010 [CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_cells(FieldData); 1011 1011 if ~isempty(errormsg) 1012 1012 errormsg=['error in proj_field/proj_plane:' errormsg]; … … 1679 1679 %----------------------------------------------------------------- 1680 1680 idimvar=0; 1681 [CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_ indices(FieldData);1681 [CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_cells(FieldData); 1682 1682 if ~isempty(errormsg) 1683 1683 errormsg=['error in proj_field/proj_plane:' errormsg]; -
trunk/src/series.m
r495 r512 588 588 589 589 %% 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 index590 i_sum=sum(sum(i1_series,2),1);%sum of i1_series on the last index 591 591 MaxIndex_i=max(find(i_sum>0))-1;% max ref index i 592 592 MinIndex_i=min(find(i_sum>0))-1;% min ref index i 593 593 i2_min=[]; 594 594 if ~isempty(i2_series) 595 i2_min=i2_series(1,2 );595 i2_min=i2_series(1,2,2); 596 596 end 597 597 j1_min=[]; 598 598 if ~isempty(j1_series) 599 j1_min=j1_series(1,2 );599 j1_min=j1_series(1,2,2); 600 600 end 601 601 j2_min=[]; 602 602 if ~isempty(j2_series) 603 j2_min=j2_series(1,2 );603 j2_min=j2_series(1,2,2); 604 604 end 605 605 if isequal(MinIndex_i,1) &&... … … 607 607 MinIndex_i=0; 608 608 end 609 j_sum=sum(sum(j1_series,1), 3);609 j_sum=sum(sum(j1_series,1),1); 610 610 MaxIndex_j=max(find(j_sum>0))-1; 611 611 MinIndex_j=min(find(j_sum>0))-1; … … 793 793 nbview=numel(SeriesData.i1_series); 794 794 for 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)); 797 797 end 798 798 index_min=min(index_min); … … 808 808 ind_y=1+(iview-1)*range_y:iview*range_y; 809 809 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; 811 811 LineData(x_index)=1; 812 812 LineData=interp1(x,LineData,xI,'nearest'); … … 815 815 CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); 816 816 set(handles.FileStatus,'CData',CData); 817 818 %819 %820 % xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices821 % 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 color829 % file_ima=double((i1_series(:,:,1)>0)');830 % if numel(file_ima)>=2831 % if size(file_ima,1)==1832 % CLine=interp1(ind_i,file_ima,xima,'nearest');833 % CData(:,:,2)=ones(size(yima'))*CLine;834 % else835 % CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest');836 % end837 % set(handles.FileStatus,'CData',CData)838 % end839 % set(handles.FileStatus,'Units','normalized')840 817 841 818 … … 1077 1054 % end 1078 1055 for 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)); 1081 1058 end 1082 1059 [index_min,iview_min]=min(index_min); … … 2185 2162 yima=0.5:pos(4)-0.5; 2186 2163 [XIma,YIma]=meshgrid(xima,yima); 2187 nb_i=size(i1_series, 1);2164 nb_i=size(i1_series,3); 2188 2165 nb_j=size(i1_series,2); 2189 2166 ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i; -
trunk/src/sub_field.m
r494 r512 65 65 66 66 %% check the two input fields 67 [CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_ indices(Field);67 [CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_cells(Field); 68 68 if ~isempty(errormsg) 69 69 errormsg=['invalid first input to sub_field:' errormsg]; 70 70 return 71 71 end 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); 73 73 if ~isempty(errormsg) 74 74 errormsg=['invalid second input to sub_field:' errormsg]; -
trunk/src/uvmat.m
r511 r512 51 51 % 52 52 % 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: 71 59 % 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 % 86 85 % 87 86 %%%%%%%%%%%%%% SCALARS: %%%%%%%%%%%%??%%% … … 357 356 function MenuBrowse_Callback(hObject, eventdata, handles) 358 357 [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]; 359 oldfile=fullfile(RootPath,SubDir); 360 360 if isempty(oldfile)||isequal(oldfile,'') %loads the previously stored file name and set it as default in the file_input box 361 361 dir_perso=prefdir; … … 371 371 fileinput=[PathName FileName];%complete file name 372 372 if ~exist(fileinput,'file') 373 return %abandon of the browser is cancelled373 return %abandon if the browser is cancelled 374 374 end 375 375 … … 1014 1014 end 1015 1015 end 1016 [ref_ i,ref_j]=find(i1_series);1016 [ref_j,ref_i]=find(i1_series); 1017 1017 if ~isempty(j1_series) 1018 1018 state_j='on'; … … 1583 1583 if get(handles.scan_i,'Value')==1% case of scanning along index i 1584 1584 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)==01585 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 1586 1586 ref_i=ref_i+step; 1587 1587 end 1588 1588 else % case of scanning along index j (burst numbers) 1589 1589 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)==01590 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 1591 1591 ref_j=ref_j+step; 1592 1592 end … … 1597 1597 elseif ref_j<0 1598 1598 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) 1600 1600 errormsg='maximum i index reached (reload the input file to update the index bound)'; 1601 1601 elseif ref_j+1>size(UvData.i1_series{1},2) … … 1603 1603 end 1604 1604 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)); 1614 1617 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)); 1618 1619 end 1619 1620 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)); 1623 1622 end 1624 1623 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)); 1628 1625 end 1629 % case of a second file series 1626 % case of a second file series (TODO:revise) 1630 1627 if numel(UvData.i1_series)>=2 1631 1628 i1_subseries=UvData.i1_series{2}(ref_i+1,ref_j+1,:); … … 1705 1702 UvData=get(handles.uvmat,'UserData'); 1706 1703 if isequal(FieldName,'image') 1707 test_1=0;1704 index=1; 1708 1705 [RootPath,SubDir,RootFile,FileIndices,Ext]=read_file_boxes(handles); 1709 1706 NomType=get(handles.NomType,'String'); … … 1713 1710 FieldName=list_fields{index_fields}; % selected field 1714 1711 if isequal(FieldName,'image') 1715 test_1=1;1712 index=2; 1716 1713 [RootPath,tild,RootFile,FileIndex_1,Ext,NomType]=read_file_boxes_1(handles); 1717 1714 else … … 1739 1736 num_i2=num_i1;%repeat the index i1 by default 1740 1737 end 1741 % imaname_1=name_generator(filebase,num_i2,num_j2,Ext,NomType);1742 1738 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,Ext,NomType,num_i2,[],num_j2); 1739 if strcmp(NomType,'*') 1740 num_frame=num_i2; 1741 else 1742 num_frame=num_j2; 1743 end 1743 1744 if ~exist(imaname_1,'file') 1744 1745 msgbox_uvmat('ERROR',['second input open (-) ' imaname_1 ' not found']); … … 1748 1749 end 1749 1750 1751 %% get the first image 1752 %Field.AName='image'; 1753 if index==1 1754 Field_a=UvData.Field;% movie on the second field 1755 else 1756 Field_a=UvData.Field_1;% movie on the first field 1757 end 1758 1750 1759 %% 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 1760 MovieObject=[]; 1761 if numel(UvData.MovieObject)>=index 1762 MovieObject=UvData.MovieObject{index}; 1763 end 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 1803 1811 1804 1812 %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 ~ise qual(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 priority1812 Field_a=transform(Field_a,UvData.XmlData{2});%the first field has been stored without transform1813 Field_ b=transform(Field_b,UvData.XmlData{2});1814 elseif ~test_1 && isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'GeometryCalib')%use geometry calib1815 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'); 1817 transform=get(handles.path_transform,'UserData'); 1818 if ~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}); 1816 1824 end 1817 1825 end … … 2249 2257 %% store the current open names, fields and vel types in uvmat interface 2250 2258 UvData.FileName_1=FileName_1; 2259 UvData.ParamOut_1=ParamOut_1; 2260 if numel(Field)==2 2261 UvData.Field_1=Field{2}; %store the second field for possible use at next RUN 2262 end 2251 2263 2252 2264 %% apply coordinate transform or other user fct … … 2262 2274 end 2263 2275 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}); 2278 2293 end 2279 2294 end … … 2293 2308 check_tps=1;%tps needed to get the requested field 2294 2309 end 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}];2310 if (check_tps ||check_proj_tps)&&~isfield(UvData.Field,'Coord_tps') 2311 UvData.Field=calc_tps(UvData.Field); 2312 end 2313 UvData.Field.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 2299 2314 2300 2315 %% calculate scalar … … 2302 2317 &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut.FieldName,'get_field...') 2303 2318 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); 2305 2320 end 2306 2321 end … … 2314 2329 end 2315 2330 2316 %% combine the two input fields (e.g. substract velocity fields)2317 if numel(Field)==22318 [UvData.Field,errormsg]=sub_field(Field{1},Field{2});2319 UvData.Field_1=Field{2}; %store the second field for possible use at next RUN2320 UvData.ParamOut_1=ParamOut_1;2321 else2322 UvData.Field=Field{1};2323 end2324 if ~isempty(errormsg)2325 errormsg=['error in uvmat/refresh_field/sub_field:' errormsg];2326 return2327 end2328 %UvData.Field.FieldList={FieldName}; % TODO: to generalise, used for proj_field with tps interpolation2329 2331 2330 2332 %% analyse input field … … 2336 2338 return 2337 2339 end 2338 [CellVarIndex,NbDim,VarType,errormsg]=find_field_ indices(UvData.Field);% analyse the input field structure2340 [CellVarIndex,NbDim,VarType,errormsg]=find_field_cells(UvData.Field);% analyse the input field structure 2339 2341 if ~isempty(errormsg) 2340 errormsg=['error in uvmat/refresh_field/find_field_ indices: ' errormsg];% display error2342 errormsg=['error in uvmat/refresh_field/find_field_cells: ' errormsg];% display error 2341 2343 return 2342 2344 end … … 3513 3515 3514 3516 %% create the function handle of the selected fct 3517 3515 3518 if isempty(list_path{ichoice})% case of no selected fct 3516 3519 transform_handle=[]; … … 3527 3530 set(handles.path_transform,'String',list_path{ichoice}) 3528 3531 set(handles.path_transform,'UserData',transform_handle) 3532 set(handles.transform_fct,'UserData',list_path) 3529 3533 3530 3534 %% update the ToolTip string of the menu transform_fct with the first line of the selected fct file … … 4806 4810 ProjectDir = uigetdir(fileparts(fileparts(RootPath)), 'select the project source directory'); 4807 4811 datatree_browser(ProjectDir) 4812 4813 4814 % -------------------------------------------------------------------- 4815 function MenuBrowseProject_Callback(hObject, eventdata, handles) 4816 RootPath=get(handles.RootPath,'String'); 4817 ProjectDir = uigetdir(fileparts(fileparts(RootPath)), 'select the project directory'); 4818 datatree_browser(ProjectDir)
Note: See TracChangeset
for help on using the changeset viewer.