Changeset 1001


Ignore:
Timestamp:
Feb 27, 2017, 9:28:27 AM (7 years ago)
Author:
sommeria
Message:

tubcorrelation added, compilation improved to accept tranform fct

Location:
trunk/src
Files:
2 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r993 r1001  
    168168% --- Executes on button press APPLY (used to launch the calibration).
    169169function APPLY_Callback(hObject, eventdata, handles)
     170set(handles.CheckEnableMouse,'Value',0)% desactivate mouse (to avoid spurious creation of new points)
     171
    170172%------------------------------------------------------------------------
    171173%% look for the GUI uvmat and check for an image as input
     
    173175huvmat=findobj(allchild(0),'Name','uvmat');% look for the GUI uvmat
    174176hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
     177if ~strcmp(get(hhuvmat.Scalar,'Visible'),'on')
     178    msgbox_uvmat('ERROR','An image needs to be opened in uvmat for calibration')
     179  return
     180end
    175181
    176182RootPath='';
     
    186192    outputfile=answer{1};
    187193end
    188 [GeometryCalib,index]=calibrate(handles,hhuvmat);% apply calibration
     194
     195%% read coordinates of the calibration poinnts: Coord(:,1-3) in phys, Coord(:,4-5) image
     196Coord=get(handles.ListCoord,'Data');
     197
     198 
     199%% read the type of calibration
     200calib_cell=get(handles.calib_type,'String');
     201val=get(handles.calib_type,'Value');
     202CalibFcn=['calib_' calib_cell{val}];
     203
     204%% read the intrinsic parameters
     205Intrinsic.Npx=str2num(get(hhuvmat.num_Npx,'String'));
     206Intrinsic.Npy=str2num(get(hhuvmat.num_Npy,'String'));
     207Intrinsic.coord_files=get(handles.ListCoordFiles,'String');
     208Intrinsic.f1=str2num(get(handles.fx,'String'));
     209Intrinsic.f2=str2num(get(handles.fy,'String'));
     210Intrinsic.k=str2num(get(handles.kc,'String'));
     211Intrinsic.Cx=str2num(get(handles.Cx,'String'));
     212Intrinsic.Cy=str2num(get(handles.Cy,'String'));
     213if isempty(Intrinsic.k)
     214    Intrinsic.k=0;
     215end
     216if isempty(Intrinsic.Cx)||isempty(Intrinsic.Cy)
     217    Intrinsic.Cx=Intrinsic.Npx/2;
     218    Intrinsic.Cy=Intrinsic.Npy/2;
     219end 
     220
     221%% Apply calibration
     222[GeometryCalib,index,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
     223
     224%% record the coordinate unit
     225unitlist=get(handles.CoordUnit,'String');
     226unit=unitlist{get(handles.CoordUnit,'value')};
     227GeometryCalib.CoordUnit=unit;
     228
     229%% record the coordinates of the calibration points
     230GeometryCalib.SourceCalib.PointCoord=Coord;
     231
     232%% display calibration results on the GUI geometry_calib
     233display_intrinsic(GeometryCalib,handles)%display calibration intrinsic parameters
     234display_extrinsic(GeometryCalib,handles)%display calibration extrinsic parameters
     235%     (rotation and translation of camera with  respect to the phys coordinates)
     236
     237%% store the calibration data, by default in the xml file of the currently displayed image
     238answer=msgbox_uvmat('INPUT_Y-N',{'store calibration data';...
     239    ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
     240    ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']});
     241if strcmp(answer,'Yes') %store the calibration data
     242    if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration
     243        msgbox_uvmat('CONFIRMATION',{['The current image series is assumed by default in the plane of the calib points z=' num2str(Z_plane) ] ; 'can be modified by MenuSetSlice in the upper bar menu of uvmat'})
     244        GeometryCalib.SliceCoord=Z_plane'*[0 0 1];
     245    end   
     246else
     247    GeometryCalib=[];
     248    index=1;
     249end
    189250
    190251if isempty(GeometryCalib) % if calibration cancelled
     
    228289function REPLICATE_Callback(hObject, eventdata, handles)
    229290%------------------------------------------------------------------------
     291set(handles.CheckEnableMouse,'Value',0)% desactivate mouse (to avoid spurious creation of new points)
    230292
    231293%% look for the GUI uvmat and check for an image as input
    232294huvmat=findobj(allchild(0),'Name','uvmat');
    233295hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
    234 GeometryCalib=calibrate(handles,hhuvmat);% apply calibration
     296
     297%% read coordinates of the calibration poinnts: Coord(:,1-3) in phys, Coord(:,4-5) image
     298Coord=get(handles.ListCoord,'Data');
     299 
     300%% read the type of calibration
     301calib_cell=get(handles.calib_type,'String');
     302val=get(handles.calib_type,'Value');
     303CalibFcn=['calib_' calib_cell{val}];
     304
     305%% read the intrinsic parameters
     306Intrinsic.Npx=str2num(get(hhuvmat.num_Npx,'String'));
     307Intrinsic.Npy=str2num(get(hhuvmat.num_Npy,'String'));
     308Intrinsic.coord_files=get(handles.ListCoordFiles,'String');
     309Intrinsic.f1=str2num(get(handles.fx,'String'));
     310Intrinsic.f2=str2num(get(handles.fy,'String'));
     311Intrinsic.k=str2num(get(handles.kc,'String'));
     312Intrinsic.Cx=str2num(get(handles.Cx,'String'));
     313Intrinsic.Cy=str2num(get(handles.Cy,'String'));
     314if isempty(Intrinsic.k)
     315    Intrinsic.k=0;
     316end
     317if isempty(Intrinsic.Cx)||isempty(Intrinsic.Cy)
     318    Intrinsic.Cx=Intrinsic.Npx/2;
     319    Intrinsic.Cy=Intrinsic.Npy/2;
     320end
     321
     322%% apply to cropped images if requested
     323answer=msgbox_uvmat('INPUT_Y-N','apply to cropped images?');
     324if strcmp(answer,'Yes')
     325    prompt = {'npy_lower'};
     326    dlg_title = 'remove image the npy_lower image lines (removal of the upper linedoes not change calibration)';
     327    num_lines= 1;
     328    def     = {'0'};
     329    answer = inputdlg(prompt,dlg_title,num_lines,def);
     330    npy_crop=str2num(answer{1});
     331    Intrinsic.Npy=Intrinsic.Npy-npy_crop; %size of the filtering window
     332    Coord(:,5)=Coord(:,5)-npy_crop;% shift the image ordinates of the calibration points by removing the lower band
     333end
     334
     335%% Apply calibration
     336[GeometryCalib,index,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
     337
     338
     339%% record the coordinate unit
     340unitlist=get(handles.CoordUnit,'String');
     341unit=unitlist{get(handles.CoordUnit,'value')};
     342GeometryCalib.CoordUnit=unit;
     343
     344%% record the coordinates of the calibration points
     345GeometryCalib.SourceCalib.PointCoord=Coord;
     346
     347%% display calibration results on the GUI geometry_calib
     348display_intrinsic(GeometryCalib,handles)%display calibration intrinsic parameters
     349display_extrinsic(GeometryCalib,handles)%display calibration extrinsic parameters
     350%     (rotation and translation of camera with  respect to the phys coordinates)
     351
     352%% store the calibration data, by default in the xml file of the currently displayed image
     353answer=msgbox_uvmat('INPUT_Y-N',{'store calibration data';...
     354    ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
     355    ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']});
     356if strcmp(answer,'Yes') %store the calibration data
     357    if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration
     358        msgbox_uvmat('CONFIRMATION',{['The current image series is assumed by default in the plane of the calib points z=' num2str(Z_plane) ] ; 'can be modified by MenuSetSlice in the upper bar menu of uvmat'})
     359        GeometryCalib.SliceCoord=Z_plane'*[0 0 1];
     360    end   
     361else
     362    GeometryCalib=[];
     363    index=1;
     364end
    235365
    236366%% open the GUI browse_data
     
    265395%------------------------------------------------------------------------
    266396% --- activate calibration and store parameters in ouputfile .
    267 function [GeometryCalib,index]=calibrate(handles,hhuvmat)
    268 %------------------------------------------------------------------------
    269 set(handles.CheckEnableMouse,'Value',0)% desactivate mouse (to avoid spurious creation of new points)
    270 %% read the current calibration points
     397function [GeometryCalib,index,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic)
     398%------------------------------------------------------------------------
     399
    271400index=[];
    272 Coord=get(handles.ListCoord,'Data');
    273 Coord(:,6)=[];
     401
    274402% apply the calibration, whose type is selected in  handles.calib_type
    275 GeometryCalib=[];
    276403if ~isempty(Coord)
    277     calib_cell=get(handles.calib_type,'String');
    278     val=get(handles.calib_type,'Value');
    279     GeometryCalib=feval(['calib_' calib_cell{val}],Coord,handles);
     404    GeometryCalib=feval(CalibFcn,Coord,Intrinsic);
    280405else
     406    GeometryCalib=[];
    281407    msgbox_uvmat('ERROR','No calibration points, abort')
    282408end
     
    306432    end
    307433end
    308 %set the coordinate unit
    309 unitlist=get(handles.CoordUnit,'String');
    310 unit=unitlist{get(handles.CoordUnit,'value')};
    311 GeometryCalib.CoordUnit=unit;
    312 %record the points
    313 GeometryCalib.SourceCalib.PointCoord=Coord;
    314 display_intrinsic(GeometryCalib,handles)%display calibration intrinsic parameters
    315 
    316 % Display extrinsinc parameters (rotation and translation of camera with  respect to the phys coordiantes)
    317 set(handles.Tx,'String',num2str(GeometryCalib.Tx_Ty_Tz(1),4))
    318 set(handles.Ty,'String',num2str(GeometryCalib.Tx_Ty_Tz(2),4))
    319 set(handles.Tz,'String',num2str(GeometryCalib.Tx_Ty_Tz(3),4))
    320 set(handles.Phi,'String',num2str(GeometryCalib.omc(1),4))
    321 set(handles.Theta,'String',num2str(GeometryCalib.omc(2),4))
    322 set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4))
    323 
    324 %% store the calibration data, by default in the xml file of the currently displayed image
    325 answer=msgbox_uvmat('INPUT_Y-N',{'store calibration data';...
    326     ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
    327     ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']});
    328 if strcmp(answer,'Yes') %store the calibration data
    329     if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration
    330         msgbox_uvmat('CONFIRMATION',{['The current image series is assumed by default in the plane of the calib points z=' num2str(Z_plane) ] ; 'can be modified by MenuSetSlice in the upper bar menu of uvmat'})
    331         GeometryCalib.SliceCoord=Z_plane'*[0 0 1];
    332     end
    333    
    334 else
    335     GeometryCalib=[];
    336     index=1;
    337 end
    338434
    339435
    340436%------------------------------------------------------------------------
    341437% --- determine the parameters for a calibration by an affine function (rescaling and offset, no rotation)
    342 function GeometryCalib=calib_rescale(Coord,handles)
     438function GeometryCalib=calib_rescale(Coord,Intrinsic)
    343439%------------------------------------------------------------------------
    344440X=Coord(:,1);
     
    358454%------------------------------------------------------------------------
    359455% --- determine the parameters for a calibration by a linear transform matrix (rescale and rotation)
    360 function GeometryCalib=calib_linear(Coord,handles)
     456function GeometryCalib=calib_linear(Coord,Intrinsic)
    361457%------------------------------------------------------------------------
    362458X=Coord(:,1);
     
    388484% --- determine the tsai parameters for a view normal to the grid plane
    389485% NOT USED
    390 function GeometryCalib=calib_normal(Coord,handles)
     486function GeometryCalib=calib_normal(Coord,Intrinsic)
    391487%------------------------------------------------------------------------
    392488Calib.f1=str2num(get(handles.fx,'String'));
     
    451547
    452548%------------------------------------------------------------------------
    453 function GeometryCalib=calib_3D_linear(Coord,handles)
    454 %------------------------------------------------------------------------
    455 path_uvmat=which('uvmat');% check the path detected for source file uvmat
    456 path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    457 huvmat=findobj(allchild(0),'Tag','uvmat');
    458 hhuvmat=guidata(huvmat);
    459 coord_files=get(handles.ListCoordFiles,'String');
    460 if ischar(coord_files)
     549function GeometryCalib=calib_3D_linear(Coord,Intrinsic)
     550%------------------------------------------------------------------------
     551coord_files=Intrinsic.coord_files;
     552if ischar(Intrinsic.coord_files)
    461553    coord_files={coord_files};
    462554end
     
    466558%retrieve the calibration points stored in the files listed in the popup list ListCoordFiles
    467559x_1=Coord(:,4:5)';%px coordinates of the ref points
    468 if ~strcmp(get(hhuvmat.Scalar,'Visible'),'on')
    469     msgbox_uvmat('ERROR','An image needs to be opened in uvmat for calibration')
    470   return
    471 end
    472 nx=str2num(get(hhuvmat.num_Npx,'String'));
    473 ny=str2num(get(hhuvmat.num_Npy,'String'));
     560
     561nx=Intrinsic.Npx;
     562ny=Intrinsic.Npy;
    474563x_1(2,:)=ny-x_1(2,:);%reverse the y image coordinates
    475564X_1=Coord(:,1:3)';%phys coordinates of the ref points
     
    12211310set(handles.kc,'String',num2str(kc,'%1.4f'))
    12221311
    1223 
    1224 % --- Executes when user attempts to close geometry_calib.
     1312%------------------------------------------------------------------------
     1313% ---display calibration extrinsic parameters
     1314function display_extrinsic(GeometryCalib,handles)
     1315%------------------------------------------------------------------------
     1316set(handles.Tx,'String',num2str(GeometryCalib.Tx_Ty_Tz(1),4))
     1317set(handles.Ty,'String',num2str(GeometryCalib.Tx_Ty_Tz(2),4))
     1318set(handles.Tz,'String',num2str(GeometryCalib.Tx_Ty_Tz(3),4))
     1319set(handles.Phi,'String',num2str(GeometryCalib.omc(1),4))
     1320set(handles.Theta,'String',num2str(GeometryCalib.omc(2),4))
     1321set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4))
     1322
     1323%------------------------------------------------------------------------
     1324% --- executes when user attempts to close geometry_calib.
    12251325function geometry_calib_CloseRequestFcn(hObject, eventdata, handles)
    1226 
     1326%------------------------------------------------------------------------
    12271327delete(hObject); % closes the figure
    12281328
    12291329%------------------------------------------------------------------------
    1230 % --- Executes on button press in PLOT.
     1330% --- executes on button press in PLOT.
    12311331%------------------------------------------------------------------------
    12321332function PLOT_Callback(hObject, eventdata, handles)
  • trunk/src/nc2struct.m

    r977 r1001  
     1
    12%'nc2struct': transform a NetCDF file in a corresponding matlab structure
    23% it reads all the global attributes and all variables, or a selected list.
  • trunk/src/plot_field.m

    r977 r1001  
    696696            vec_U=Data.(Data.ListVarName{CellInfo{icell}.VarIndex_vector_x});
    697697            vec_V=Data.(Data.ListVarName{CellInfo{icell}.VarIndex_vector_y});
     698            XName=Data.ListVarName{CellInfo{icell}.CoordIndex(end)};
     699            YName=Data.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
    698700            if strcmp(CellInfo{icell}.CoordType,'scattered')%2D field with unstructured coordinates
    699                 XName=Data.ListVarName{CellInfo{icell}.CoordIndex(end)};
    700                 YName=Data.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
    701701                vec_X=reshape(Data.(XName),[],1); %transform vectors in column matlab vectors
    702702                vec_Y=reshape(Data.(YName),[],1);
    703703            elseif strcmp(CellInfo{icell}.CoordType,'grid')%2D field with structured coordinates
    704                 y=Data.(Data.ListVarName{CellInfo{icell}.CoordIndex(end-1)});
    705                 x=Data.(Data.ListVarName{CellInfo{icell}.CoordIndex(end)});
     704                y=Data.(YName);
     705                x=Data.(XName);
    706706                if numel(y)==2 % y defined by first and last values on aregular mesh
    707707                    y=linspace(y(1),y(2),size(vec_U,1));
     
    744744            XName=Data.ListVarName{ivar_X};
    745745            YName=Data.ListVarName{ivar_Y};
    746             eval(['Coord_x=reshape(Data.' XName ',1,[]);'])
    747             eval(['Coord_y=reshape(Data.' YName ',1,[]);'])
     746            Coord_x=reshape(Data.(XName),1,[]);
     747            Coord_y=reshape(Data.(YName),1,[]);
    748748            [A,Coord_x,Coord_y]=proj_grid(Coord_x',Coord_y',A',[],[],'np>256');  % interpolate on a grid
    749749            if isfield(Data,'VarAttribute')
     
    757757        elseif strcmp(CellInfo{icell}.CoordType,'grid')%2D field with structured coordinates
    758758            YName=Data.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
     759            XName=Data.ListVarName{CellInfo{icell}.CoordIndex(end)};
    759760            Coord_y=Data.(YName);
    760             Coord_x=Data.(Data.ListVarName{CellInfo{icell}.CoordIndex(end)});
     761            Coord_x=Data.(XName);
    761762            test_interp_X=0; %default, regularly meshed X coordinate
    762763            test_interp_Y=0; %default, regularly meshed Y coordinate
     
    774775                DCoord_y_max=max(DCoord_y);
    775776                if sign(DCoord_y_min)~=sign(DCoord_y_max);% =1 for increasing values, 0 otherwise
    776                     errormsg=['errror in plot_field.m: non monotonic dimension variable ' Data.ListVarName{VarRole.coord(1)} ];
     777                    errormsg=['errror in plot_field.m: non monotonic dimension variable ' YName ];
    777778                    return
    778779                end
  • trunk/src/read_field.m

    r980 r1001  
    152152            [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeVarName',ParamIn.TimeVarName,num,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVar]);
    153153            if numel(num)~=1
    154                 NbCoord=NbCoord+1;% adds time coordinate, except if q single time hqs been selected
     154                NbCoord=NbCoord+1;% adds time coordinate, except if a single time has been selected
    155155            end
    156156        else
     
    160160            return
    161161        end
    162         %scan all the variables beyond the two first ones, ParamIn.Coord_x and ParamIn.Coord_y.
     162        CheckStructured=1;
     163        %scan all the variables beyond the two first NbCoord ones describing the coordinates.
    163164        for ilist=NbCoord+1:numel(Field.VarDimName)
    164165            if isequal(Field.VarDimName{1},Field.VarDimName{ilist}) % if a variable has the same dimension as the coordinate, it denotes a field with unstructured coordinates
     
    168169                    Field.VarAttribute{3}.Role='coord_z';
    169170                end
     171                CheckUnstructured=0;
    170172                break
    171173            end
    172174        end
     175        if CheckStructured
     176            for ilist=NbCoord+1:numel(Field.VarDimName)
     177                rank(1)=find(strcmp(ParamIn.Coord_x,Field.VarDimName{ilist}));
     178                rank(2)=find(strcmp(ParamIn.Coord_y,Field.VarDimName{ilist}));
     179                if NbCoord==3
     180                rank(3)=find(strcmp(ParamIn.Coord_z,Field.VarDimName{ilist}));
     181                end
     182                rank=flip(rank);
     183                VarName=Field.ListVarName{ilist};
     184                Field.(VarName)=permute(Field.(VarName),rank);
     185                Field.VarDimName{ilist}=Field.VarDimName{ilist}(rank);% permute the order of dimensions
     186            end
     187        end             
    173188        NormName='';
    174189        UName='';
     
    225240                Field.VarAttribute=[cell(1,numel(Field.ListDimName)) Field.VarAttribute];
    226241            end
     242           
    227243        end
    228244    case 'video'
  • trunk/src/series.m

    r998 r1001  
     1
     2
     3
    14%'series': master function associated to the GUI series.m for analysis field series 
    25%------------------------------------------------------------------------
     
    185188TransformPathList=cell(NbBuiltinTransform,1); % initiate the cell matrix of Action fct paths
    186189TransformPathList(:)={path_transform_fct}; % set the default path to series fcts to all list members
     190SeriesData.TransformPath=path_transform_fct;% store the standard path for trqnsform functions (needed for compilation)
    187191
    188192%% get the user defined functions stored in the personal file uvmat_perso.mat
     
    15261530if strcmp(ActionExt,'.sh')
    15271531    TransformPath='';
    1528     if ~isempty(get(handles.ActionExt,'UserData'))
    1529         TransformPath=get(handles.ActionExt,'UserData');
     1532    if isfield(SeriesData,'TransformPath')
     1533        TransformPath=SeriesData.TransformPath;
     1534        if isfield(SeriesData,'TransformList')
     1535            TransformList=get(handles.TransformName,'String');
     1536            TransformIndex=get(handles.TransformName,'Value');
     1537            TransformName=TransformList{TransformIndex};
     1538            if ~ismember(TransformName,SeriesData.TransformList)
     1539                TransformPath='';
     1540            end
     1541        end
     1542    end
     1543    if ~isempty(TransformPath)&&...
     1544          ~strcmp(TransformPath,get(handles.TransformPath,'String'))% if the transform is not in paths set for compilation
     1545        msgbox_uvmat('ERROR', 'compilation not available for this transform function, select .m')
     1546        return
    15301547    end
    15311548    set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch'
     
    25522569FieldTransformVisible='off';  %hidden by default
    25532570if isfield(ParamOut,'FieldTransform')
    2554     FieldTransformVisible=ParamOut.FieldTransform; 
     2571    if ~strcmp(ParamOut.FieldTransform,'off')
     2572    FieldTransformVisible='on'; 
     2573    end
     2574    if iscell(ParamOut.FieldTransform)
     2575        SeriesData.TransformList=ParamOut.FieldTransform;
     2576    end
    25552577    TransformName_Callback([],[], handles)
    25562578end
    25572579set(handles.FieldTransform,'Visible',FieldTransformVisible)
    2558 if isfield(ParamOut,'TransformPath')
    2559     set(handles.ActionExt,'UserData',ParamOut.TransformPath)
     2580if isfield(ParamOut,'TransformPath');% record the path of transform function requested for compilation
     2581    set(handles.TransformPath,'UserData',ParamOut.TransformPath)
    25602582else
    2561     set(handles.ActionExt,'UserData',[])
     2583    set(handles.TransformPath,'UserData',[])
    25622584end
    25632585
  • trunk/src/series/time_series.m

    r984 r1001  
    6767    ParamOut.VelType='two';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
    6868    ParamOut.FieldName='two';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
    69     ParamOut.FieldTransform = 'on';%can use a transform function
    70     ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions (needed for compilation only)
     69    ParamOut.FieldTransform = {'phys','phys_polar'};%can use a transform function, proposed list (needed for compilation)
     70    ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions (needed for compilation only)   
     71    if 1==2 % loop used to enforce compilation of transform fct, never entered.
     72        phys
     73        phys_polar
     74    end
    7175    ParamOut.ProjObject='on';%can use projection object(option 'off'/'on',
    7276    ParamOut.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
     
    217221transform_fct=[];%default
    218222if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    219     addpath(Param.FieldTransform.TransformPath)
     223    %addpath(Param.FieldTransform.TransformPath)
    220224    transform_fct=str2func(Param.FieldTransform.TransformName);
    221     rmpath(Param.FieldTransform.TransformPath)
     225    %rmpath(Param.FieldTransform.TransformPath)
    222226    if isfield(Param,'TransformInput')
    223227        XmlData{1}.TransformInput=Param.TransformInput;
  • trunk/src/set_object.m

    r987 r1001  
    380380% set default values read in the plot of uvmat to initiate the mesh
    381381if isequal(ProjMode,'interp_lin')|| isequal(ProjMode,'interp_tps')
    382             huvmat=findobj('Tag','uvmat');%find the current uvmat interface handle
     382    huvmat=findobj('Tag','uvmat');%find the current uvmat interface handle
     383    if ~isempty(huvmat)
    383384        UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    384     if isempty(str2num(get(handles.num_DX,'String')))||isempty(str2num(get(handles.num_DY,'String')));     
    385 %         Field=UvData.Field;
    386         if  isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)
    387             set(handles.num_DX,'String',num2str(UvData.Field.CoordMesh))
    388             set(handles.num_DY,'String',num2str(UvData.Field.CoordMesh))
    389             set(handles.num_RangeX_1,'String',num2str(UvData.Field.XMin))
    390             set(handles.num_RangeX_2,'String',num2str(UvData.Field.XMax))
    391             set(handles.num_RangeY_1,'String',num2str(UvData.Field.YMin))
    392             set(handles.num_RangeY_2,'String',num2str(UvData.Field.YMax))
    393         end
    394         if isempty(get(handles.CoordUnit,'String'))&& isfield(UvData.Field,'CoordUnit')
    395             set(handles.CoordUnit,'String',UvData.Field.CoordUnit)
    396         end       
     385        if isempty(str2num(get(handles.num_DX,'String')))||isempty(str2num(get(handles.num_DY,'String')));
     386            %         Field=UvData.Field;
     387            if  isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)
     388                set(handles.num_DX,'String',num2str(UvData.Field.CoordMesh))
     389                set(handles.num_DY,'String',num2str(UvData.Field.CoordMesh))
     390                set(handles.num_RangeX_1,'String',num2str(UvData.Field.XMin))
     391                set(handles.num_RangeX_2,'String',num2str(UvData.Field.XMax))
     392                set(handles.num_RangeY_1,'String',num2str(UvData.Field.YMin))
     393                set(handles.num_RangeY_2,'String',num2str(UvData.Field.YMax))
     394            end
     395            if isempty(get(handles.CoordUnit,'String'))&& isfield(UvData.Field,'CoordUnit')
     396                set(handles.CoordUnit,'String',UvData.Field.CoordUnit)
     397            end
     398        end
    397399    end
    398400    if isempty(str2num(get(handles.num_RangeInterp,'String'))) && isfield(UvData,'Field')
    399      set(handles.num_RangeInterp,'String',num2str(3*UvData.Field.CoordMesh))% default interpolationlength= 3 meshes
     401        set(handles.num_RangeInterp,'String',num2str(3*UvData.Field.CoordMesh))% default interpolationlength= 3 meshes
    400402    end
    401403end
  • trunk/src/uvmat.m

    r998 r1001  
    422422%% reset position and scale of axis
    423423pos(1)=0.2*size_fig(3)+35;
    424 pos(2)=35;
     424pos(2)=50;
    425425pos(3)=0.77*size_fig(3)-1.2*ColumnWidth;
    426 pos(4)=size_fig(4)-60;
     426pos(4)=size_fig(4)-100;
    427427set(handles.PlotAxes,'Units','pixels')
    428428set(handles.PlotAxes,'Position',pos)
Note: See TracChangeset for help on using the changeset viewer.