- Timestamp:
- Jan 17, 2020, 8:13:53 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/get_field.m
r1071 r1072 317 317 318 318 %% set z coordinate menu if relevant 319 if Field.MaxDim>=3 && prod(Field.DimValue)<10^8 && ~ isempty(ParamIn.Coord_z);% 3D field (with memory content smaller than 400 Mo)319 if Field.MaxDim>=3 && prod(Field.DimValue)<10^8 && ~(isfield(ParamIn,'Coord_z') && isempty(ParamIn.Coord_z)) % 3D field (with memory content smaller than 400 Mo) 320 320 set(handles.Check3D,'Value',1) 321 321 else -
trunk/src/mouse_down.m
r1071 r1072 288 288 289 289 %% selection of an existing projection object (third priority) 290 if test_edit 290 if test_edit && ~strcmp(get(hcurrentobject,'Type'),'figure') 291 291 testdeform=0; 292 292 if ~(isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'create')) … … 360 360 end 361 361 end 362 % if testdeform==0363 % AxeData.Drawing='translate';364 % set(AxeData.CurrentObject,'Selected','on')365 % set(gcbo,'Pointer','fleur');366 % end367 362 else 368 363 if strcmp(get(hCurrentGUI,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field … … 433 428 h_set_object=findobj(allchild(0),'Tag','set_object'); 434 429 hh_set_object=guidata(h_set_object); 435 if strcmp(ObjectData.Type,'plane_z')&& ~isempty(ObjectData.Coord) 436 Delta_x=(xy(1,1)-ObjectData.Coord(1,1));%displacement along x 437 Delta_y=(xy(1,2)-ObjectData.Coord(1,2));%displacement along y 438 ObjectData.Angle(1)=(180/pi)*angle(Delta_x+i*Delta_y); 439 ObjectData.Angle(2)=90; 440 set(hh_set_object.num_Angle_1,'String',num2str(ObjectData.Angle(1))) 441 set(hh_set_object.num_Angle_2,'String',num2str(ObjectData.Angle(2))) 442 drawing_status='off'; 430 if strcmp(ObjectData.Type,'plane') 431 if isempty(ObjectData.Coord)||(isfield(ObjectData,'RangeX') && size(ObjectData.RangeX,2)==2)% draw a new plane 432 ObjectData.Coord=xy(1,1:2);% record the coordinates marked by the mouse as origin of the new plane 433 set(hh_set_object.Coord,'Data',ObjectData.Coord);%append the current mouse cordinates in the GUI set_object 434 set(hh_set_object.num_RangeX_2,'String','') 435 set(hh_set_object.num_Angle_1,'String','0') 436 drawing_status='create'; 437 else 438 Delta_x=(xy(1,1)-ObjectData.Coord(1,1));%displacement along x 439 Delta_y=(xy(1,2)-ObjectData.Coord(1,2));%displacement along y 440 ObjectData.Angle(1)=(180/pi)*angle(Delta_x+i*Delta_y); 441 ObjectData.Angle(2)=90; 442 ObjectData.RangeX(1)=0; 443 ObjectData.RangeX(2)=abs(Delta_x+i*Delta_y); 444 set(hh_set_object.num_Angle_1,'String',num2str(ObjectData.Angle(1))) 445 set(hh_set_object.num_Angle_2,'String',num2str(ObjectData.Angle(2))) 446 set(hh_set_object.num_RangeX_1,'String',num2str(ObjectData.RangeX(1))) 447 set(hh_set_object.num_RangeX_2,'String',num2str(ObjectData.RangeX(2))) 448 drawing_status='off'; 449 end 443 450 else 444 451 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object -
trunk/src/mouse_motion.m
r1071 r1072 402 402 if isequal(AxeData.Drawing,'create') && isfield(AxeData,'CurrentOrigin') && ~isempty(AxeData.CurrentOrigin) 403 403 switch ObjectData.Type 404 case {'line','polyline','polygon','points' ,'plane_z'}404 case {'line','polyline','polygon','points'} 405 405 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)]; 406 406 % ObjectData.Coord(end,:)=xy(1,:); -
trunk/src/mouse_up.m
r1071 r1072 95 95 else 96 96 switch ObjectData.Type 97 case {'line','plane _z'}97 case {'line','plane'} 98 98 if size(ObjectData.Coord,1)==1 % this is the mouse up for the first point, continue until next click 99 99 check_multiple=1; … … 106 106 check_multiple=1;% pass to next mous up if width of height=0 107 107 end 108 case 'plane' %case of 'plane', TODO: NOT ACTIVATED109 DX=(xy(1,1)-ObjectData.Coord(1,1));110 DY=(xy(1,2)-ObjectData.Coord(1,2));111 ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width112 if isfield(ObjectData,'RangeX')113 XMax=sqrt(DX*DX+DY*DY);114 if XMax>max(ObjectData.RangeX)115 ObjectData.RangeX=[min(ObjectData.RangeX) XMax];116 end117 end108 % case 'plane' %case of 'plane', TODO: NOT ACTIVATED 109 % DX=(xy(1,1)-ObjectData.Coord(1,1)); 110 % DY=(xy(1,2)-ObjectData.Coord(1,2)); 111 % ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width 112 % if isfield(ObjectData,'RangeX') 113 % XMax=sqrt(DX*DX+DY*DY); 114 % if XMax>max(ObjectData.RangeX) 115 % ObjectData.RangeX=[min(ObjectData.RangeX) XMax]; 116 % end 117 % end 118 118 otherwise 119 119 check_multiple=1; -
trunk/src/proj_field.m
r1071 r1072 999 999 end 1000 1000 PlaneAngle=(pi/180)*ObjectData.Angle; 1001 if PlaneAngle==0 1002 PlaneAngle=[0 0]; 1003 end 1001 1004 % om=norm(PlaneAngle);%norm of rotation angle in radians 1002 1005 % OmAxis=PlaneAngle/om; %unit vector marking the rotation axis … … 1009 1012 % norm_plane(3)=OmAxis(3)*coeff+cos_om; 1010 1013 1011 M1=[cos(PlaneAngle(1)) sin(PlaneAngle(1)) 0;-sin(PlaneAngle(1)) cos(PlaneAngle(1)) 0;0 0 1];1014 M1=[cos(PlaneAngle(1)) -sin(PlaneAngle(1)) 0;sin(PlaneAngle(1)) cos(PlaneAngle(1)) 0;0 0 1]; 1012 1015 M=M1; 1013 1016 if checkM2 1014 M2=[1 0 0;0 cos(PlaneAngle(2)) sin(PlaneAngle(2));0 -sin(PlaneAngle(2)) cos(PlaneAngle(2))];1015 M=M 2*M1;% first rotate in the x,y plane with angle PlaneAngle(1), then slant around the new x axis0 with angle PlaneAngle(2)1017 M2=[1 0 0;0 cos(PlaneAngle(2)) -sin(PlaneAngle(2));0 sin(PlaneAngle(2)) cos(PlaneAngle(2))]; 1018 M=M1*M2;% first rotate in the x,y plane with angle PlaneAngle(1), then slant around the new x axis0 with angle PlaneAngle(2) 1016 1019 end 1017 1020 norm_plane=M*[0 0 1]'; … … 1038 1041 end 1039 1042 InterpMesh=min(DX,DY);%mesh used for interpolation in a slanted plane 1040 % if strcmp(ObjectData.Type,'plane_z')1041 % InterpMesh=10*InterpMesh;%TODO: temporary, to shorten computation1042 % end1043 1043 1044 1044 %% extrema along each axis … … 1126 1126 % end 1127 1127 icell_grid=[];% field cell index which defines the grid 1128 if ~strcmp(ObjectData.ProjMode,'projection')&& ~strcmp(ObjectData.Type,'plane_z')% TODO:rationalize 1129 %% define the new coordinates in case of interpolation on a imposed grid 1130 if ~testYMin 1131 errormsg='min Y value not defined for the projection grid';return 1132 end 1133 if ~testYMax 1134 errormsg='max Y value not defined for the projection grid';return 1135 end 1136 if ~testXMin 1137 errormsg='min X value not defined for the projection grid';return 1138 end 1139 if ~testXMax 1140 errormsg='max X value not defined for the projection grid';return 1141 end 1142 else 1128 if strcmp(ObjectData.ProjMode,'projection') 1143 1129 %% case of a grid requested by the input field 1144 1130 for icell=1:numel(CellInfo)% TODO: recalculate coordinates here to get the bounds in the rotated coordinates … … 1162 1148 end 1163 1149 end 1164 if ~isempty(find(check_grid ))% if a grid is requested by the input field1150 if ~isempty(find(check_grid,1))% if a grid is requested by the input field 1165 1151 if isempty(icell_grid)% if the grid is not given by cell #icell_grid 1166 1152 if ~isfield(FieldData,'XMax') … … 1169 1155 end 1170 1156 end 1171 end 1172 if ~isempty(find(check_grid))||~strcmp(ObjectData.ProjMode,'projection')%no existing gridded data used 1157 else 1158 %% define the new coordinates in case of interpolation on a imposed grid 1159 if ~testYMin 1160 errormsg='min Y value not defined for the projection grid';return% %%%%%%%%%%%%%%%% A REVOIR 1161 1162 end 1163 if ~testYMax 1164 errormsg='max Y value not defined for the projection grid';return 1165 end 1166 if ~testXMin 1167 errormsg='min X value not defined for the projection grid';return 1168 end 1169 if ~testXMax 1170 errormsg='max X value not defined for the projection grid';return 1171 end 1172 end 1173 if ~isempty(find(check_grid,1))||~strcmp(ObjectData.ProjMode,'projection')%no existing gridded data used 1173 1174 if isempty(icell_grid)||~strcmp(ObjectData.ProjMode,'projection')%no existing gridded data used 1174 1175 AYName='coord_y'; 1175 1176 AXName='coord_x'; 1176 if strcmp(ObjectData.ProjMode,'projection')||strcmp(ObjectData.Type,'plane _z')1177 if strcmp(ObjectData.ProjMode,'projection')||strcmp(ObjectData.Type,'plane') 1177 1178 ProjData.coord_y=[FieldData.YMin FieldData.YMax];%note that if projection is done on a grid, the Min and Max along each direction must have been defined 1178 1179 ProjData.coord_x=[FieldData.XMin FieldData.XMax]; … … 1472 1473 end 1473 1474 1474 if isequal(ProjMode{icell},'projection')% && (~testangle || test90y || test90x)1475 if strcmp(ProjMode{icell},'projection')% && (~testangle || test90y || test90x) 1475 1476 if NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax% no range restriction 1476 1477 ListVarName=[ListVarName FieldData.ListVarName(VarIndex)]; … … 1653 1654 if isfield(FieldData,'VarAttribute')&&length(FieldData.VarAttribute)>=ivar 1654 1655 VarAttribute{length(ListVarName)+nbcoord}=FieldData.VarAttribute{ivar}; 1655 end ;1656 end 1656 1657 ProjData.(FFName)=isnan(ProjData.(VarName));%detact NaN (points outside the interpolation range) 1657 1658 ProjData.(VarName)(ProjData.(FFName))=0; %set to 0 the NaN data … … 1661 1662 VarDimName=[VarDimName {DimCell}]; 1662 1663 VarAttribute{numel(ListVarName)}.Role='errorflag'; 1663 elseif ~testangle 1664 elseif ~testangle % 3Dcase without change of angle 1664 1665 % unstructured z coordinate 1665 1666 test_sup=(Coord{1}>=ObjectData.Coord(1,3)); … … 1683 1684 % determine the boundaries of the projected field, 1684 1685 % first find the 8 summits of the initial volume in the 1685 PlaneAngle=ObjectData.Angle*pi/180; 1686 PlaneAngle=[0 0 0];% default 1687 PlaneAngle(1:numel(ObjectData.Angle))=ObjectData.Angle*pi/180; 1686 1688 % new coordinates 1687 1689 Coord{1}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)});%initial z coordinates 1688 1690 Coord{2}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)});%initial y coordinates 1689 1691 Coord{3}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(3)});%initial x coordinates 1690 summit=zeros(3,8);% initialize summit coordinates1691 summit(1,1:4)=[Coord{3}(1) Coord{3}(end) Coord{3}(1) Coord{3}(end)];%square1692 summit(2,1:4)=[Coord{2}(1) Coord{2}(1) Coord{2}(end) Coord{2}(end)];% square at z= Coord{1}(1)1693 summit(1:2,5:8)=summit(1:2,1:4);1694 summit(3,:)=[Coord{1}(1)*ones(1,4) Coord{1}(end)*ones(1,4)];1695 %Mrot_inv=rodrigues(-PlaneAngle);1696 newsummit=zeros(3,8);% initialize the rotated summit coordinates1692 % summit=zeros(3,8);% initialize summit coordinates 1693 % summit(1,1:4)=[Coord{3}(1) Coord{3}(end) Coord{3}(1) Coord{3}(end)];%square 1694 % summit(2,1:4)=[Coord{2}(1) Coord{2}(1) Coord{2}(end) Coord{2}(end)];% square at z= Coord{1}(1) 1695 % summit(1:2,5:8)=summit(1:2,1:4); 1696 % summit(3,:)=[Coord{1}(1)*ones(1,4) Coord{1}(end)*ones(1,4)]; 1697 % %Mrot_inv=rodrigues(-PlaneAngle); 1698 % newsummit=zeros(3,8);% initialize the rotated summit coordinates 1697 1699 ObjectData.Coord=ObjectData.Coord';% set ObjectData.Coord as a vertical vector 1698 1700 if size(ObjectData.Coord,1)<3 … … 1700 1702 end 1701 1703 1702 M1=[cos(PlaneAngle(1)) sin(PlaneAngle(1)) 0;-sin(PlaneAngle(1)) cos(PlaneAngle(1)) 0;0 0 1];1703 M2=[1 0 0;0 cos(PlaneAngle(2)) sin(PlaneAngle(2));0 -sin(PlaneAngle(2)) cos(PlaneAngle(2))];1704 M=M2*M1;1704 % M1=[cos(PlaneAngle(1)) sin(PlaneAngle(1)) 0;-sin(PlaneAngle(1)) cos(PlaneAngle(1)) 0;0 0 1]; 1705 % M2=[1 0 0;0 cos(PlaneAngle(2)) sin(PlaneAngle(2));0 -sin(PlaneAngle(2)) cos(PlaneAngle(2))]; 1706 % M=M1*M2; 1705 1707 M_inv=inv(M); 1706 1708 1707 for isummit=1:8% TODO: introduce a function for rotation of n points (to use also for scattered data) 1708 newsummit(:,isummit)=M*(summit(:,isummit)-(ObjectData.Coord)); 1709 end 1710 coord_x_proj=min(newsummit(1,:)):InterpMesh: max(newsummit(1,:));% set of coordinqtes in the projection plane 1711 coord_y_proj=min(newsummit(2,:)):InterpMesh: max(newsummit(2,:)); 1712 coord_z_proj=-width:width; 1709 % for isummit=1:8% TODO: introduce a function for rotation of n points (to use also for scattered data) 1710 % newsummit(:,isummit)=M*(summit(:,isummit)-(ObjectData.Coord)); 1711 % end 1712 % coord_x_proj=min(newsummit(1,:)):InterpMesh: max(newsummit(1,:));% set of coordinqtes in the projection plane 1713 % coord_y_proj=min(newsummit(2,:)):InterpMesh: max(newsummit(2,:)); 1714 % coord_z_proj=-width:width; 1715 coord_x_proj=ObjectData.RangeX(1):InterpMesh:ObjectData.RangeX(2);% set of coordinqtes in the projection plane 1716 coord_y_proj=ObjectData.RangeY(1):InterpMesh:ObjectData.RangeY(2); 1717 coord_z_proj=-floor(ObjectData.RangeInterp/InterpMesh):InterpMesh:floor(ObjectData.RangeInterp/InterpMesh); 1713 1718 %Mrot=rodrigues(PlaneAngle);% inverse rotation matrix 1714 Origin=M_inv*[coord_x_proj(1);coord_y_proj(1);coord_z_proj(1)]+ObjectData.Coord;1719 %Origin=M_inv*[coord_x_proj(1);coord_y_proj(1);coord_z_proj(1)]+ObjectData.Coord; 1715 1720 npx=numel(coord_x_proj); 1716 1721 npy=numel(coord_y_proj); … … 1722 1727 iX=[coord_x_proj(end)-coord_x_proj(1);0;0]/(npx-1); 1723 1728 iY=[0;coord_y_proj(end)-coord_y_proj(1);0]/(npy-1); 1729 if npz==1 1730 iZ=[0;0;0]; 1731 else 1724 1732 iZ=[0;0;coord_z_proj(end)-coord_z_proj(1)]/(npz-1); 1733 end 1725 1734 % iX(1:2)=[cosphi -sinphi;sinphi cosphi]*iX(1:2); 1726 1735 % iY(1:2)=[-cosphi -sinphi;sinphi cosphi]*iY(1:2); … … 1731 1740 1732 1741 [Grid_x,Grid_y,Grid_z]=meshgrid(0:npx-1,0:npy-1,0:npz-1); 1742 %[Grid_x,Grid_y,Grid_z]=meshgrid(0:npz-1,0:npy-1,0:npx-1); 1733 1743 if ismatrix(Grid_x)% add a singleton in case of a single z value 1734 1744 Grid_x=shiftdim(Grid_x,-1); … … 1736 1746 Grid_z=shiftdim(Grid_z,-1); 1737 1747 end 1738 XI=O rigin(1)+ix(1)*Grid_x+iy(1)*Grid_y+iz(1)*Grid_z;1739 YI=O rigin(2)+ix(2)*Grid_x+iy(2)*Grid_y+iz(2)*Grid_z;1740 ZI=O rigin(3)+ix(3)*Grid_x+iy(3)*Grid_y+iz(3)*Grid_z;1741 [X,Y,Z]=meshgrid(Coord{3},Coord{2},Coord{1});% mesh in theinitial coordinates1748 XI=ObjectData.Coord(1)+ix(1)*Grid_x+iy(1)*Grid_y+iz(1)*Grid_z; 1749 YI=ObjectData.Coord(2)+ix(2)*Grid_x+iy(2)*Grid_y+iz(2)*Grid_z; 1750 ZI=ObjectData.Coord(3)+ix(3)*Grid_x+iy(3)*Grid_y+iz(3)*Grid_z; 1751 % [X,Y,Z]=meshgrid(Coord{3},Coord{2},Coord{1});% grid of initial coordinates 1742 1752 for ivar=VarIndex 1743 1753 VarName=FieldData.ListVarName{ivar}; … … 1745 1755 VarDimName=[VarDimName {{'coord_y','coord_x'}}]; 1746 1756 VarAttribute{length(ListVarName)}=FieldData.VarAttribute{ivar}; %reproduce the variable attributes 1747 FieldData.(VarName)=permute(FieldData.(VarName),[2 3 1]); 1757 FieldData.(VarName)=permute(FieldData.(VarName),[2 3 1]); %coordinate permutation needed to use interp3 1758 indexnan=isnan(FieldData.(VarName)); 1759 FieldData.(VarName)(indexnan)=0;%set to zero the undefined values 1748 1760 ProjData.coord_x=coord_x_proj; 1749 1761 ProjData.coord_y=coord_y_proj; 1750 ProjData.(VarName)=interp3( X,Y,Z,double(FieldData.(VarName)),XI,YI,ZI,'*linear');1751 ProjData.(VarName)=nanmean(ProjData.(VarName), 3);1762 ProjData.(VarName)=interp3(Coord{3},Coord{2},Coord{1},double(FieldData.(VarName)),ZI,YI,XI,'*linear'); 1763 ProjData.(VarName)=nanmean(ProjData.(VarName),1); 1752 1764 ProjData.(VarName)=squeeze(ProjData.(VarName)); 1753 1765 end -
trunk/src/series.m
r1071 r1072 1452 1452 Param.TransformInput=SeriesData.TransformInput; 1453 1453 end 1454 if isfield(SeriesData,'ProjObject') 1455 Param.ProjObject=SeriesData.ProjObject; 1456 end 1454 1457 if ~isfield(SeriesData,'i1_series') 1455 1458 errormsg='The input field series needs to be refreshed: press REFRESH'; … … 1602 1605 NbExp=1;% initiate the number of experiments set by the GUI browse_data, =1 otherwise 1603 1606 if get(handles.Replicate,'Value') 1604 set(handles.Replicate,'BackgroundColor',[1 1 0])%paint Relicate button in yellow1605 1607 hh=findobj(allchild(0),'Tag','browse_data'); 1606 BrowseData=guidata(hh); 1607 SourceDir=get(BrowseData.SourceDir,'String'); 1608 ListExp=get(BrowseData.ListExperiments,'String'); 1609 ExpIndices=get(BrowseData.ListExperiments,'Value'); 1610 ListExp=ListExp(ExpIndices); 1611 ListDevices=get(BrowseData.ListDevices,'String'); 1612 DeviceIndices=get(BrowseData.ListDevices,'Value'); 1613 ListDevices=ListDevices(DeviceIndices); 1614 ListDataSeries=get(BrowseData.DataSeries,'String'); 1615 DataSeriesIndices=get(BrowseData.DataSeries,'Value'); 1616 ListDataSeries=ListDataSeries(DataSeriesIndices); 1617 NbExp=0; % counter of the number of experiments set by the GUI browse_data 1618 for iexp=1:numel(ListExp) 1619 if ~isempty(regexp(ListExp{iexp},'^\+/'))% if it is a folder 1620 if strcmp(get(BrowseData.DataSeries,'enable'),'off');%case of a multiple input line for series 1621 NbExp=NbExp+1; 1622 ExpIndex{NbExp}=iexp; 1623 for idevice=1:numel(ListDevices) 1624 lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),... 1625 regexprep(ListDevices{idevice},'^\+/','')); 1626 ldir=regexprep(ListDataSeries{idevice},'^\+/',''); 1627 ListPath{idevice,NbExp}=lpath; 1628 ListSubdir{idevice,NbExp}=ldir; 1629 end 1630 else 1631 for idevice=1:numel(ListDevices) 1632 if ~isempty(regexp(ListDevices{idevice},'^\+/'))% if it is a folder 1633 for isubdir=1:numel(ListDataSeries) 1634 if ~isempty(regexp(ListDataSeries{isubdir},'^\+/'))% if it is a folder 1635 lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),... 1636 regexprep(ListDevices{idevice},'^\+/','')); 1637 ldir= regexprep(ListDataSeries{isubdir},'^\+/',''); 1638 if exist(fullfile(lpath,ldir),'dir') 1639 NbExp=NbExp+1; 1640 ExpIndex{NbExp}=iexp; 1641 ListPath{NbExp}=lpath; 1642 ListSubdir{NbExp}=ldir; 1608 if isempty(hh) 1609 set(handles.Replicate,'Value',0) 1610 else 1611 set(handles.Replicate,'BackgroundColor',[1 1 0])%paint Relicate button in yellow 1612 BrowseData=guidata(hh); 1613 SourceDir=get(BrowseData.SourceDir,'String'); 1614 ListExp=get(BrowseData.ListExperiments,'String'); 1615 ExpIndices=get(BrowseData.ListExperiments,'Value'); 1616 ListExp=ListExp(ExpIndices); 1617 ListDevices=get(BrowseData.ListDevices,'String'); 1618 DeviceIndices=get(BrowseData.ListDevices,'Value'); 1619 ListDevices=ListDevices(DeviceIndices); 1620 ListDataSeries=get(BrowseData.DataSeries,'String'); 1621 DataSeriesIndices=get(BrowseData.DataSeries,'Value'); 1622 ListDataSeries=ListDataSeries(DataSeriesIndices); 1623 NbExp=0; % counter of the number of experiments set by the GUI browse_data 1624 for iexp=1:numel(ListExp) 1625 if ~isempty(regexp(ListExp{iexp},'^\+/'))% if it is a folder 1626 if strcmp(get(BrowseData.DataSeries,'enable'),'off');%case of a multiple input line for series 1627 NbExp=NbExp+1; 1628 ExpIndex{NbExp}=iexp; 1629 for idevice=1:numel(ListDevices) 1630 lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),... 1631 regexprep(ListDevices{idevice},'^\+/','')); 1632 ldir=regexprep(ListDataSeries{idevice},'^\+/',''); 1633 ListPath{idevice,NbExp}=lpath; 1634 ListSubdir{idevice,NbExp}=ldir; 1635 end 1636 else 1637 for idevice=1:numel(ListDevices) 1638 if ~isempty(regexp(ListDevices{idevice},'^\+/'))% if it is a folder 1639 for isubdir=1:numel(ListDataSeries) 1640 if ~isempty(regexp(ListDataSeries{isubdir},'^\+/'))% if it is a folder 1641 lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),... 1642 regexprep(ListDevices{idevice},'^\+/','')); 1643 ldir= regexprep(ListDataSeries{isubdir},'^\+/',''); 1644 if exist(fullfile(lpath,ldir),'dir') 1645 NbExp=NbExp+1; 1646 ExpIndex{NbExp}=iexp; 1647 ListPath{NbExp}=lpath; 1648 ListSubdir{NbExp}=ldir; 1649 end 1643 1650 end 1644 1651 end … … 1648 1655 end 1649 1656 end 1650 end1651 answer=msgbox_uvmat('INPUT_Y-N-Cancel',['replicate the processing on ' num2str(NbExp) ' data series']);1652 if strcmp(answer,'Cancel')||strcmp(answer,'No')1653 return1657 answer=msgbox_uvmat('INPUT_Y-N-Cancel',['replicate the processing on ' num2str(NbExp) ' data series']); 1658 if strcmp(answer,'Cancel')||strcmp(answer,'No') 1659 return 1660 end 1654 1661 end 1655 1662 end … … 1678 1685 Param.IndexRange.last_i=str2num(get(handles.num_last_i,'String')); 1679 1686 1680 %% create the output data directory if needed, after ch cking its existence1687 %% create the output data directory if needed, after checking its existence 1681 1688 OutputDir=''; 1682 1689 answer=''; … … 2654 2661 ProjObjectVisible='off'; 2655 2662 end 2656 set(handles.ProjObject ,'Visible',ProjObjectVisible)2663 set(handles.ProjObjectName,'Visible',ProjObjectVisible) 2657 2664 set(handles.DeleteObject,'Visible',ProjObjectVisible) 2658 2665 set(handles.ViewObject,'Visible',ProjObjectVisible) … … 3074 3081 end 3075 3082 ProjObject=read_GUI(hset_object); 3076 set(handles.ProjObject ,'String',ProjObject.Name); % display the object name3083 set(handles.ProjObjectName,'String',ProjObject.Name); % display the object name 3077 3084 SeriesData=get(handles.series,'UserData'); 3078 3085 SeriesData.ProjObject=ProjObject; … … 3082 3089 set(handles.DeleteObject,'Visible','on'); 3083 3090 set(handles.ViewObject,'Visible','on'); 3084 set(handles.ProjObject ,'Visible','on');3091 set(handles.ProjObjectName,'Visible','on'); 3085 3092 else 3086 3093 set(handles.EditObject,'Visible','off'); … … 3090 3097 set(handles.ViewObject,'Value',0); 3091 3098 end 3092 set(handles.ProjObject ,'Visible','off');3099 set(handles.ProjObjectName,'Visible','off'); 3093 3100 end 3094 3101 … … 3131 3138 SeriesData.ProjObject=[]; 3132 3139 set(handles.series,'UserData',SeriesData) 3133 set(handles.ProjObject ,'String','')3134 set(handles.ProjObject ,'Visible','off')3140 set(handles.ProjObjectName,'String','') 3141 set(handles.ProjObjectName,'Visible','off') 3135 3142 set(handles.CheckObject,'Value',0) 3136 3143 set(handles.ViewObject,'Visible','off') … … 3389 3396 set(handles.series,'UserData',SeriesData) 3390 3397 if isfield(Param,'CheckObject') && isequal(Param.CheckObject,1) 3391 set(handles.ProjObject ,'String',Param.ProjObject.Name)3398 set(handles.ProjObjectName,'String',Param.ProjObject.Name) 3392 3399 set(handles.ViewObject,'Visible','on') 3393 3400 set(handles.EditObject,'Visible','on') 3394 3401 set(handles.DeleteObject,'Visible','on') 3395 3402 else 3396 set(handles.ProjObject ,'String','')3397 set(handles.ProjObject ,'Visible','off')3403 set(handles.ProjObjectName,'String','') 3404 set(handles.ProjObjectName,'Visible','off') 3398 3405 set(handles.ViewObject,'Visible','off') 3399 3406 set(handles.EditObject,'Visible','off') … … 3874 3881 end 3875 3882 end 3883 3884 3885 -
trunk/src/set_object.m
r1071 r1072 100 100 101 101 % fill the interface as set in the input data: 102 if exist('data','var') 102 if exist('data','var') 103 103 if isfield(data,'Coord') 104 104 set(handles.Coord,'Data',data.Coord) 105 105 if size(data.Coord,2)==3 106 set(handles.z_slider,'Visible','on')106 set(handles.z_slider,'Visible','on') 107 107 end 108 108 else … … 114 114 if isfield(data,'ProjModeMenu') 115 115 set(handles.ProjMode,'UserData',data.ProjModeMenu)% data.ProjModeMenu as default menu (used in Type_Callback) 116 end 116 end 117 117 errormsg=fill_GUI(data,handles.set_object); 118 118 if ~isempty(errormsg) … … 120 120 return 121 121 end 122 Type_Callback(hObject, eventdata, handles)% update the GUI set_object depending on the object type 122 Type_Callback(hObject, eventdata, handles)% update the GUI set_object depending on the object type 123 123 set(handles.REFRESH,'BackgroundColor',[1 0 0]) 124 124 if isfield(data,'RangeZ') … … 151 151 set(handles.num_RangeY_1,'String',num2str(min(data.RangeY),3)) 152 152 end 153 if isfield(data,'RangeZ') && ~strcmp(data.Type,'plane_z')%TODO: generalise153 if isfield(data,'RangeZ')%&& ~strcmp(data.Type,'plane_z')%TODO: generalise 154 154 if ischar(data.RangeZ) 155 155 data.RangeZ=str2num(data.RangeZ); … … 159 159 set(handles.num_RangeZ_1,'String',num2str(min(data.RangeZ),3)) 160 160 end 161 end 161 end 162 162 if ~isfield(data,'Angle') 163 163 data.Angle=[0 0]; 164 164 end 165 % if isfield(data,'Angle') && isequal(numel(data.Angle),3)166 set(handles.num_Angle_1,'String',num2str(data.Angle(1)))167 % set(handles.num_Angle_2,'String',num2str(data.Angle(2)))168 % set(handles.num_Angle_3,'String',num2str(data.Angle(3)))169 %end165 set(handles.num_Angle_1,'String',num2str(data.Angle(1))) 166 if numel(data.Angle)==2 167 set(handles.num_Angle_2,'Visible','on') 168 set(handles.num_Angle_2,'String',num2str(data.Angle(2))) 169 end 170 170 end 171 171 set(get(handles.set_object,'children'),'enable','off') 172 172 set(handles.SAVE,'enable','on') 173 % set(handles.REFRESH,'enable','off')174 173 175 174 … … 245 244 end 246 245 case {'rectangle','ellipse','plane','volume'} 246 if ~isempty(Coord) 247 247 Coord=Coord(1,:); 248 end 248 249 end 249 250 set(handles.Coord,'Data',Coord) -
trunk/src/uvmat.m
r1071 r1072 1007 1007 data.RangeY=UvData.Field.CoordMesh; 1008 1008 case 'plane_z' 1009 data.Type='plane'; 1010 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax') 1011 data.RangeY=[UvData.Field.ZMin UvData.Field.ZMax]; 1012 else 1013 msgbox_uvmat('ERROR','The input field is not 3D: no vertical plane projection') 1014 return 1015 end 1009 1016 data.Angle=[0 90]; 1010 1017 data.DX=UvData.Field.CoordMesh; 1011 1018 data.DY=UvData.Field.CoordMesh; 1012 data.RangeZ=UvData.Field.CoordMesh; 1019 data.RangeZ=UvData.Field.CoordMesh; 1013 1020 data.Coord=[]; 1014 1021 otherwise … … 1021 1028 end 1022 1029 end 1023 1030 hset_object=findobj(allchild(0),'Tag','set_object'); 1031 if ~isempty(hset_object) 1032 delete(hset_object)%delete existing GUI set_object 1033 end 1024 1034 hset_object=set_object(data,handles);% call the GUI set_object 1025 1035 hchild=get(hset_object,'children'); … … 1438 1448 end 1439 1449 if numel(find(select_line))<2 1440 msgbox_uvmat('ERROR',{'li ght rays must be defined by at least two lines created by Projection object/line in the menu bar'; ...1441 ' use a third line to get a reference luminosity profile accross the illumination beam'});1450 msgbox_uvmat('ERROR',{'lines must be defined by Projection object in the upper menu bar: ';'1-two lines following the illumination rays'; ... 1451 '2-a reference line near the fluid boundary receiving the illumination beam';'a mask polygon to select the area in which the exponential decay is fitted'}); 1442 1452 return 1443 1453 else … … 1457 1467 blackoffset=XmlData.LIFCalib.BlackOffset ;% image value for black background, to be determined by taking images with a cover on the objective lens 1458 1468 end 1459 answer=msgbox_uvmat('INPUT_TXT','camera offset value in the absence of illumination:', num2str(blackoffset)); 1469 1470 prompt = {'offset luminosity value in the absence of illumination';'smoothing length for the reference line (in pixels)'}; 1471 dlg_title = 'set the parameters for LIF'; 1472 num_lines= 2; 1473 def = { '0';'20'}; 1474 answer = inputdlg(prompt,dlg_title,num_lines,def); 1475 1460 1476 if strcmp(answer,'Cancel') 1461 1477 return 1462 1478 else 1463 XmlData.LIFCalib.BlackOffset=str2num(answer) ;% image value for black background, to be determined by taking images with a cover on the objective lens 1479 XmlData.LIFCalib.BlackOffset=str2num(answer{1}) ;% image value for black background, to be determined by taking images with a cover on the objective lens 1480 XmlData.LIFCalib.SmoothingLength=str2num(answer{2}) ;% smoothing length used for the reference line 1464 1481 end 1465 1482 … … 1491 1508 1492 1509 %% use the third line for reference luminosity, renormalize the image intensity along each ray to get a uniform brightness along this line 1510 %UvData.Field.CoordMesh 1493 1511 if numel(find(select_line))==3 1494 1512 x_ref=linspace(LineData{3}.Coord(1,1),LineData{3}.Coord(2,1),10); … … 1508 1526 line_nan= isnan(dist_source); 1509 1527 dist_source_pixel(line_nan)=1; 1510 width= 20; %number of pixels used for reference1528 width=XmlData.LIFCalib.SmoothingLength; %number of pixels used for reference 1511 1529 DataPol.A=double(DataPol.A)-XmlData.LIFCalib.BlackOffset;% black background substracted 1512 1530 Anorm=zeros(size(DataPol.A)); … … 1516 1534 end 1517 1535 lum(line_nan)=NaN; 1536 XmlData.LIFCalib.RefLineAzimuth=DataPol.Coord_y; 1537 XmlData.LIFCalib.RefLineRadius=dist_source; 1538 XmlData.LIFCalib.RefLineLum=lum; 1518 1539 figure(11) 1519 1540 plot(1:size(DataPol.A,1),lum) … … 1554 1575 [XLine,YLine] = pol2cart(ThetaLine,RLine); 1555 1576 XLine=XLine+x0; 1556 YLine=YLine+y0; 1577 YLine=YLine+y0; 1557 1578 if ~isempty(index_mask) 1558 1579 ind_good=inpolygon(XLine,YLine,MaskData.Coord(:,1),MaskData.Coord(:,2)); 1559 1580 if numel(find(ind_good))>100 1560 ALine=ALine(ind_good);1561 RLine=RLine(ind_good);1581 ALine=ALine(ind_good); 1582 RLine=RLine(ind_good); 1562 1583 else 1563 1584 continue … … 1565 1586 end 1566 1587 p = polyfit(RLine,ALine,1); 1567 1588 gamma_coeff(iY)=-p(1); 1568 1589 end 1569 1590 … … 1578 1599 ylabel('decay coeff(m-1)') 1579 1600 1601 %% keep the average of gamma_coeff 1602 XmlData.LIFCalib.DecayRate=mean(gamma_coeff(gamma_coeff>0)); 1603 1580 1604 %% record the calibration data in the xml file 1581 1605 XmlFileName=find_imadoc(get(handles.RootPath,'String'),get(handles.SubDir,'String'),get(handles.RootFile,'String'),get(handles.FileExt,'String')); 1582 answer=msgbox_uvmat('INPUT_Y-N','save the illumination originin the current xml file?');1606 answer=msgbox_uvmat('INPUT_Y-N','save the LIF parameters in the current xml file?'); 1583 1607 if strcmp(answer,'Yes') 1584 1608 t=xmltree(XmlFileName); %read the file … … 1605 1629 end 1606 1630 uid_origin=find(t,'ImaDoc/LIFCalib/LightOrigin'); 1607 if ~isempty(uid_origin) %if GeometryCalib does not already exists, create it1608 1631 if ~isempty(uid_origin) %if LightOrigin already exists, delete it 1632 t=delete(t,uid_origin); 1609 1633 end 1610 1634 uid_line=find(t,'ImaDoc/LIFCalib/Ray1Coord'); 1611 if ~isempty(uid_line) %if GeometryCalib does not already exists, create it 1612 t=delete(t,uid_line); 1613 end 1614 uid_line=find(t,'ImaDoc/LIFCalib/Ray2Coord'); 1615 if ~isempty(uid_line) %if GeometryCalib does not already exists, create it 1616 t=delete(t,uid_line); 1617 end 1618 uid_mask=find(t,'ImaDoc/LIFCalib/MaskPolygonCoord'); 1619 if ~isempty(uid_mask) %if GeometryCalib does not already exists, create it 1620 t=delete(t,uid_mask); 1621 end 1622 uid_BlackOffset=find(t,'ImaDoc/LIFCalib/BlackOffset'); 1623 if ~isempty(uid_BlackOffset) %if GeometryCalib does not already exists, create it 1624 t=delete(t,uid_BlackOffset); 1625 end 1635 if ~isempty(uid_line) %if Ray1Coord already exists, delete it 1636 t=delete(t,uid_line); 1637 end 1638 uid_line=find(t,'ImaDoc/LIFCalib/Ray2Coord'); 1639 if ~isempty(uid_line) %if Ray2Coord already exists, delete it 1640 t=delete(t,uid_line); 1641 end 1642 uid_line=find(t,'ImaDoc/LIFCalib/RefLineCoord'); 1643 if ~isempty(uid_line) %if RefLineCoord already exists, delete it 1644 t=delete(t,uid_line); 1645 end 1646 uid_mask=find(t,'ImaDoc/LIFCalib/MaskPolygonCoord'); 1647 if ~isempty(uid_mask) %if MaskPolygonCoord already exists, delete it 1648 t=delete(t,uid_mask); 1649 end 1650 uid_BlackOffset=find(t,'ImaDoc/LIFCalib/BlackOffset'); 1651 if ~isempty(uid_BlackOffset) %if BlackOffset already exists, delete it 1652 t=delete(t,uid_BlackOffset); 1653 end 1654 uid_DecayRate=find(t,'ImaDoc/LIFCalib/DecayRate'); 1655 if ~isempty(uid_DecayRate) %if DecayRate already exists, delete it 1656 t=delete(t,uid_DecayRate); 1657 end 1658 uid_RefLineRadius=find(t,'ImaDoc/LIFCalib/RefLineRadius'); 1659 if ~isempty(uid_RefLineRadius) %if RefLineLum already exists, delete it 1660 t=delete(t,uid_RefLineRadius); 1661 end 1662 uid_RefLineLum=find(t,'ImaDoc/LIFCalib/RefLineLum'); 1663 if ~isempty(uid_RefLineLum) %if RefLineLum already exists, delete it 1664 t=delete(t,uid_RefLineLum); 1665 end 1666 uid_RefLineAzimuth=find(t,'ImaDoc/LIFCalib/RefLineAzimuth'); 1667 if ~isempty(uid_RefLineAzimuth) %if RefLineLum already exists, delete it 1668 t=delete(t,uid_RefLineAzimuth); 1669 end 1670 1626 1671 % save the LIF calibration data 1627 1672 t=struct2xml(XmlData.LIFCalib,t,uid_illumination); 1628 1673 save(t,XmlFileName); 1629 end 1630 1631 1632 1633 1674 1675 % display the concentration in uvmat 1676 InputFileREFRESH_Callback(hObject, eventdata, handles);% refresh the current xml file to apply 'ima2concentration' 1677 transform_list=get(handles.TransformName,'String'); 1678 ichoice=find(strcmp('ima2concentration',transform_list),1);%look for the selected fct in the existing menu 1679 if isempty(ichoice)% if the item is not found, add it to the menu (before 'more...' and select it) 1680 transform_list=transform_list(1:end-1); 1681 ichoice=numel(transform_list)-1; 1682 end 1683 set(handles.TransformName,'Value',ichoice) 1684 TransformName_Callback(hObject, eventdata, handles) 1685 end 1634 1686 1635 1687 … … 3149 3201 set(handles.Dt_txt,'String','')% the time interval indication is suppressed 3150 3202 return 3151 end 3152 3153 %% check the input file indexing: 3154 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 3155 NomType=get(handles.NomType,'String'); 3156 if ~isempty(find(regexp(NomType,'-'))) 3157 msgbox_uvmat('ERROR','The movie pair requires file series with a single index on the first input line') 3158 return 3159 end 3160 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line) 3161 3162 set(handles.movie_pair,'BusyAction','queue')% 3163 set(handles.CheckFixPair,'Value',1)% impose fixed pair (needed for function runpm) 3164 set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity 3165 set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity 3166 drawnow 3167 % list_fields=get(handles.FieldName,'String');% list menu fields 3168 % index_fields=get(handles.FieldName,'Value');% selected string index 3169 % FieldName=list_fields{index_fields}; % selected field 3170 3171 3172 % if isequal(FieldName,'image') 3173 % index=1; 3174 3175 % else 3176 % list_fields=get(handles.FieldName_1,'String');% list menu fields 3177 % index_fields=get(handles.FieldName_1,'Value');% selected string index 3178 % FieldName=list_fields{index_fields}; % selected field 3179 % if isequal(FieldName,'image') 3180 % index=2; 3181 % [RootPath,SubDir,RootFile,FileIndex_1,Ext,NomType]=read_file_boxes_1(handles);% get info from the second input line 3182 % else 3183 % msgbox_uvmat('ERROR','an image or movie must be first introduced as input') 3184 % set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 3185 % set(handles.movie_pair,'Value',0) 3186 % return 3187 % end 3188 % end 3189 num_i1=str2num(get(handles.i1,'String')); 3190 num_j1=stra2num(get(handles.j1,'String')); 3191 num_i2=str2num(get(handles.i2,'String')); 3192 num_j2=stra2num(get(handles.j2,'String')); 3193 3194 %% determine the name 'imaname_1' of the second file in the pair 3195 imaname_1=''; 3196 if isempty(num_j2)% no second j index indicated 3197 if isempty(num_i2) 3198 if strcmp(get(handles.j2,'Visible'),'on') %if the j box is visible 3199 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1,[],num_j1+1); 3200 end 3201 if exist(imaname_1,'file') 3202 num_j2=num_j1+1;% look by default for the next j index as the second file 3203 set(handles.j2,'String',num2stra(num_j2,NomType)); 3204 else 3205 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1+1,[],num_j1); 3206 if exist(imaname_1,'file') 3207 num_i2=num_i1+1; 3208 set(handles.i2,'String',num2str(num_i2)); 3209 else 3210 msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie') 3211 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 3212 set(handles.movie_pair,'Value',0) 3213 return 3214 end 3215 end 3216 else 3217 num_j2=num_j1;%repeat the index i1 by default 3218 end 3219 end 3220 if isempty(num_i2) 3221 num_i2=num_i1;%repeat the index i1 by default 3222 end 3223 if isempty(num_j1) 3224 num_j1=1; 3225 end 3226 if isempty(num_j2) 3227 num_j2=num_j1;%repeat the index i1 by default 3228 end 3229 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i2,[],num_j2); 3230 if strcmp(NomType,'*') 3231 num_frame=num_i2; 3232 else 3233 num_frame=num_j2; 3234 end 3235 if ~exist(imaname_1,'file') 3236 msgbox_uvmat('ERROR',['second input open (-) ' imaname_1 ' not found']); 3237 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 3238 set(handles.movie_pair,'Value',0) 3239 return 3240 end 3241 3242 %% display the first field in the pair (including possibly a background field from second line input filename_1) 3243 filename_1='';%default 3244 FileIndex_1=''; 3245 if get(handles.SubField,'Value') 3246 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 3247 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 3248 end 3249 % num_i1=stra2num(get(handles.i1,'String')); 3250 % num_i2=stra2num(get(handles.i2,'String')); 3251 % num_j1=stra2num(get(handles.j1,'String')); 3252 % num_j2=stra2num(get(handles.j2,'String')); 3253 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1);% get the indices of the second series from the string FileIndex_1 3254 if isempty(j1_1)% case of movies, the index is not given by file index 3255 j1_1=num_j1; 3256 end 3257 3258 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1); 3259 3260 if isempty(errormsg) 3261 set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull 3262 else 3263 msgbox_uvmat('ERROR',errormsg); 3264 set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull 3265 end 3266 UvData=get(handles.uvmat,'UserData'); 3267 Field_a=UvData.Field;% movie on the field defined by the second input line 3268 3269 %% display time interval for the image pair 3270 if isfield(UvData,'XmlData')&&isfield(UvData.XmlData{1},'Time')... 3271 && size(UvData.XmlData{1}.Time,1)>=num_i2+1 && size(UvData.XmlData{1}.Time,2)>=num_j2+1 3272 dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1)); 3273 if isfield(UvData,'TimeUnit') 3274 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' UvData.TimeUnit] ) 3275 else 3276 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' 10^(-3)'] ) 3277 end 3278 else 3279 set(handles.Dt_txt,'String','') 3280 end 3281 3282 %% read the second field 3283 if isempty(UvData.MovieObject) 3284 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{index}.FileType,[],num_frame); 3285 else 3286 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{1}.FileType,UvData.MovieObject{1},num_frame); 3287 end 3288 if ~isempty(errormsg) 3289 msgbox_uvmat('ERROR',['Error in reading second image: ' errormsg]) 3290 return 3291 end 3292 3293 %% apply phys or other transform on the two input fields 3294 transform=get(handles.TransformPath,'UserData'); 3295 if ~isempty(transform) 3296 if isfield(UvData,'XmlData') && ~isempty(UvData.XmlData) %use geometry calib recorded from the ImaDoc xml file as first priority 3297 if nargin(transform)>=2 3298 Field_b=transform(Field_b,UvData.XmlData{1}); 3299 else 3300 Field_b=transform(Field_b); 3301 end 3302 end 3203 else 3204 set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow 3205 drawnow 3206 end 3207 3208 increment=str2double(get(handles.num_IndexIncrement,'String')); %get the field increment d 3209 if isnan(increment)% case of free increment: move to next available field index 3210 increment='+'; 3303 3211 end 3304 3212 … … 3308 3216 set(handles.speed,'Visible','on') 3309 3217 set(handles.speed_txt,'Visible','on') 3218 set(handles.movie_pair,'BusyAction','queue') 3310 3219 while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') % enable STOP command 3311 3220 % read and plot the series of images in non erase mode 3312 set(hima,'CData',Field_b.A); %TODO: generalise to other kinds of fields 3221 errormsg=runpm(hObject,eventdata,handles,increment); 3222 if ~isempty(errormsg) 3223 msgbox_uvmat('ERROR',errormsg); 3224 end 3225 3226 % set(hima,'CData',Field_b.A); %TODO: generalise to other kinds of fields 3313 3227 pause(1.02-get(handles.speed,'Value'));% wait for next image 3314 set(hima,'CData',Field_a.A); 3228 errormsg=runpm(hObject,eventdata,handles,-increment); 3229 3230 % set(hima,'CData',Field_a.A); 3315 3231 pause(1.02-get(handles.speed,'Value'));% wait for next image 3316 3232 end … … 3318 3234 set(handles.movie_pair,'Value',0) 3319 3235 set(handles.Dt_txt,'String','') 3236 3237 3238 3239 3240 set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button back in red 3241 3242 % 3243 % set(handles.runmin,'BackgroundColor',[1 1 0])%paint the command button in yellow 3244 % drawnow 3245 % increment=-str2double(get(handles.num_IndexIncrement,'String')); %get the field increment d 3246 % if isnan(increment)% case of free increment: move to previous available field index 3247 % increment='-'; 3248 % end 3249 % errormsg=runpm(hObject,eventdata,handles,increment); 3250 % if ~isempty(errormsg) 3251 % msgbox_uvmat('ERROR',errormsg); 3252 % end 3253 % set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button back in red 3254 % 3255 % %% check the input file indexing: 3256 % [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 3257 % NomType=get(handles.NomType,'String'); 3258 % if ~isempty(find(regexp(NomType,'-'))) 3259 % msgbox_uvmat('ERROR','The movie pair requires file series with a single index on the first input line') 3260 % return 3261 % end 3262 % filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line) 3263 % 3264 % set(handles.movie_pair,'BusyAction','queue')% 3265 % set(handles.CheckFixPair,'Value',1)% impose fixed pair (needed for function runpm) 3266 % set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity 3267 % set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity 3268 % drawnow 3269 % 3270 % num_i1=str2num(get(handles.i1,'String')); 3271 % num_j1=stra2num(get(handles.j1,'String')); 3272 % num_i2=str2num(get(handles.i2,'String')); 3273 % num_j2=stra2num(get(handles.j2,'String')); 3274 % 3275 % %% determine the name 'imaname_1' of the second file in the pair 3276 % imaname_1=''; 3277 % if isempty(num_j2)% no second j index indicated 3278 % if isempty(num_i2) 3279 % if strcmp(get(handles.j2,'Visible'),'on') %if the j box is visible 3280 % imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1,[],num_j1+1); 3281 % end 3282 % if exist(imaname_1,'file') 3283 % num_j2=num_j1+1;% look by default for the next j index as the second file 3284 % set(handles.j2,'String',num2stra(num_j2,NomType)); 3285 % else 3286 % imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1+1,[],num_j1); 3287 % if exist(imaname_1,'file') 3288 % num_i2=num_i1+1; 3289 % set(handles.i2,'String',num2str(num_i2)); 3290 % else 3291 % msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie') 3292 % set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 3293 % set(handles.movie_pair,'Value',0) 3294 % return 3295 % end 3296 % end 3297 % else 3298 % num_j2=num_j1;%repeat the index i1 by default 3299 % end 3300 % end 3301 % if isempty(num_i2) 3302 % num_i2=num_i1;%repeat the index i1 by default 3303 % end 3304 % if isempty(num_j1) 3305 % num_j1=1; 3306 % end 3307 % if isempty(num_j2) 3308 % num_j2=num_j1;%repeat the index i1 by default 3309 % end 3310 % imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i2,[],num_j2); 3311 % if strcmp(NomType,'*') 3312 % num_frame=num_i2; 3313 % else 3314 % num_frame=num_j2; 3315 % end 3316 % if ~exist(imaname_1,'file') 3317 % msgbox_uvmat('ERROR',['second input open (-) ' imaname_1 ' not found']); 3318 % set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 3319 % set(handles.movie_pair,'Value',0) 3320 % return 3321 % end 3322 % 3323 % %% display the first field in the pair (including possibly a background field from second line input filename_1) 3324 % filename_1='';%default 3325 % FileIndex_1=''; 3326 % if get(handles.SubField,'Value') 3327 % [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 3328 % filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 3329 % end 3330 % [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1);% get the indices of the second series from the string FileIndex_1 3331 % if isempty(j1_1)% case of movies, the index is not given by file index 3332 % j1_1=num_j1; 3333 % end 3334 % 3335 % errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1); 3336 % 3337 % if isempty(errormsg) 3338 % set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull 3339 % else 3340 % msgbox_uvmat('ERROR',errormsg); 3341 % set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull 3342 % end 3343 % UvData=get(handles.uvmat,'UserData'); 3344 % Field_a=UvData.Field;% movie on the field defined by the second input line 3345 % 3346 % %% display time interval for the image pair 3347 % if isfield(UvData,'XmlData')&&isfield(UvData.XmlData{1},'Time')... 3348 % && size(UvData.XmlData{1}.Time,1)>=num_i2+1 && size(UvData.XmlData{1}.Time,2)>=num_j2+1 3349 % dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1)); 3350 % if isfield(UvData,'TimeUnit') 3351 % set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' UvData.TimeUnit] ) 3352 % else 3353 % set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' 10^(-3)'] ) 3354 % end 3355 % else 3356 % set(handles.Dt_txt,'String','') 3357 % end 3358 % 3359 % %% read the second field 3360 % if isempty(UvData.MovieObject) 3361 % [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{index}.FileType,[],num_frame); 3362 % else 3363 % [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{1}.FileType,UvData.MovieObject{1},num_frame); 3364 % end 3365 % if ~isempty(errormsg) 3366 % msgbox_uvmat('ERROR',['Error in reading second image: ' errormsg]) 3367 % return 3368 % end 3369 % 3370 % %% apply phys or other transform on the two input fields 3371 % transform=get(handles.TransformPath,'UserData'); 3372 % if ~isempty(transform) 3373 % if isfield(UvData,'XmlData') && ~isempty(UvData.XmlData) %use geometry calib recorded from the ImaDoc xml file as first priority 3374 % if nargin(transform)>=2 3375 % Field_b=transform(Field_b,UvData.XmlData{1}); 3376 % else 3377 % Field_b=transform(Field_b); 3378 % end 3379 % end 3380 % end 3381 % 3382 % %% make movie until movie speed is set to 0 or STOP is activated 3383 % hima=findobj(handles.PlotAxes,'Tag','ima');% %handles.PlotAxes =main plotting window (A GENERALISER) 3384 % set(handles.STOP,'Visible','on') 3385 % set(handles.speed,'Visible','on') 3386 % set(handles.speed_txt,'Visible','on') 3387 % while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') % enable STOP command 3388 % % read and plot the series of images in non erase mode 3389 % set(hima,'CData',Field_b.A); %TODO: generalise to other kinds of fields 3390 % pause(1.02-get(handles.speed,'Value'));% wait for next image 3391 % set(hima,'CData',Field_a.A); 3392 % pause(1.02-get(handles.speed,'Value'));% wait for next image 3393 % end 3394 % set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 3395 % set(handles.movie_pair,'Value',0) 3396 % set(handles.Dt_txt,'String','') 3320 3397 3321 3398 %------------------------------------------------------------------------ … … 5925 6002 set(hhset_object.SAVE,'Enable','on') 5926 6003 end 6004 else 6005 delete(hset_object) 5927 6006 end 5928 6007
Note: See TracChangeset
for help on using the changeset viewer.