Changeset 1062


Ignore:
Timestamp:
Mar 21, 2019, 6:35:43 PM (6 years ago)
Author:
sommeria
Message:

bugs repaired, still problems with geometry_calib

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r1061 r1062  
    33% function hgeometry_calib = geometry_calib(inputfile,pos)
    44%
    5 %OUTPUT: 
     5%OUTPUT:
    66% hgeometry_calib=current handles of the GUI geometry_calib.fig
    77%
    88%INPUT:
    99% inputfile: (optional) name of an xml file containing coordinates of reference points
    10 % pos: (optional) 4 element vector setting the 'Position' of the GUI 
     10% pos: (optional) 4 element vector setting the 'Position' of the GUI
    1111
    1212%=======================================================================
     
    5757gui_Singleton = 1;
    5858gui_State = struct('gui_Name',       mfilename, ...
    59                    'gui_Singleton',  gui_Singleton, ...
    60                    'gui_OpeningFcn', @geometry_calib_OpeningFcn, ...
    61                    'gui_OutputFcn',  @geometry_calib_OutputFcn, ...
    62                    'gui_LayoutFcn',  [] , ...
    63                    'gui_Callback',   []);
     59    'gui_Singleton',  gui_Singleton, ...
     60    'gui_OpeningFcn', @geometry_calib_OpeningFcn, ...
     61    'gui_OutputFcn',  @geometry_calib_OutputFcn, ...
     62    'gui_LayoutFcn',  [] , ...
     63    'gui_Callback',   []);
    6464if nargin
    65    [pp,ff]=fileparts(which(varargin{1})); % name of the input file
    66    if strcmp(ff,mfilename)% if we are activating a sub-function of geometry_calib
    67    % ~isempty(regexp(varargin{1},'_Callback','once'))
    68     gui_State.gui_Callback = str2func(varargin{1});
    69    end
     65    [pp,ff]=fileparts(which(varargin{1})); % name of the input file
     66    if strcmp(ff,mfilename)% if we are activating a sub-function of geometry_calib
     67        % ~isempty(regexp(varargin{1},'_Callback','once'))
     68        gui_State.gui_Callback = str2func(varargin{1});
     69    end
    7070end
    7171
     
    7979
    8080% --- Executes just before geometry_calib is made visible.
    81 %INPUT: 
     81%INPUT:
    8282%handles: handles of the geometry_calib interface elements
    8383% PlotHandles: set of handles of the elements contolling the plotting
     
    8686function geometry_calib_OpeningFcn(hObject, eventdata, handles,inputfile)
    8787%------------------------------------------------------------------------
    88 % Choose default command line output for geometry_calib
    8988
    9089handles.output = hObject;
    91 
    9290% Update handles structure
    9391guidata(hObject, handles);
    9492set(hObject,'DeleteFcn',{@closefcn})%
    95 %set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
    9693
    9794%% position
     
    124121set(handles.geometry_calib,'Position',[Left Bottom 420 Height])
    125122
    126 %set menu of calibration options
     123%% set menu of calibration options
    127124set(handles.calib_type,'String',{'rescale';'linear';'3D_linear';'3D_quadr';'3D_extrinsic'})
    128125if exist('inputfile','var')&& ~isempty(inputfile)
     
    135132            struct.Campaign=Heading.Campaign;
    136133        end
    137     end   
     134    end
    138135    set(hObject,'UserData',struct)
    139136end
     
    146143varargout{1} = handles.output;
    147144varargout{2}=handles;
    148 %
     145               
    149146%------------------------------------------------------------------------
    150147% executed when closing: set the parent interface button to value 0
     
    162159    if ~isempty(hobject)
    163160        delete(hobject)
    164     end   
    165 end
    166 
     161    end
     162end
     163               
    167164%------------------------------------------------------------------------
    168165% --- Executes on button press APPLY (used to launch the calibration).
    169     function APPLY_Callback(hObject, eventdata, handles)
    170         set(handles.CheckEnableMouse,'Value',0)% desactivate mouse (to avoid spurious creation of new points)
    171        
    172         %------------------------------------------------------------------------
    173         %% look for the GUI uvmat and check for an image as input
    174         set(handles.APPLY,'BackgroundColor',[1 1 0])% paint APPLY button in yellow to show activation
    175         huvmat=findobj(allchild(0),'Name','uvmat');% look for the GUI uvmat
    176         hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
    177         if ~strcmp(get(hhuvmat.Scalar,'Visible'),'on')
    178             msgbox_uvmat('ERROR','An image needs to be opened in uvmat for calibration')
    179             return
    180         end
    181        
    182         RootPath='';
    183         if ~isempty(hhuvmat.RootPath)&& ~isempty(hhuvmat.RootFile)
    184             RootPath=get(hhuvmat.RootPath,'String');% path to the currently displayed image
    185             SubDirBase=regexprep(get(hhuvmat.SubDir,'String'),'\..+$','');
    186             outputfile=[fullfile(RootPath,SubDirBase) '.xml'];%xml file associated with the currently displayed image
    187         else
    188             question={'save the calibration data and point coordinates in'};
    189             def={fullfile(RootPath,'ObjectCalib.xml')};
    190             options.Resize='on';
    191             answer=inputdlg(question,'',1,def,options);
    192             outputfile=answer{1};
    193         end
    194        
    195         %% read coordinates of the calibration poinnts: Coord(:,1-3) in phys, Coord(:,4-5) image
    196         Coord=get(handles.ListCoord,'Data');
    197        
    198        
    199         %% read the type of calibration
    200         calib_cell=get(handles.calib_type,'String');
    201         val=get(handles.calib_type,'Value');
    202         CalibFcn=['calib_' calib_cell{val}];
    203        
    204         %% read the intrinsic parameters
    205         Intrinsic.Npx=str2num(get(hhuvmat.num_Npx,'String'));
    206         Intrinsic.Npy=str2num(get(hhuvmat.num_Npy,'String'));
    207         Intrinsic.coord_files=get(handles.ListCoordFiles,'String');
    208         Intrinsic.fx=str2num(get(handles.fx,'String'));
    209         Intrinsic.fy=str2num(get(handles.fy,'String'));
    210         Intrinsic.kc=str2num(get(handles.kc,'String'));
    211         Intrinsic.Cx=str2num(get(handles.Cx,'String'));
    212         Intrinsic.Cy=str2num(get(handles.Cy,'String'));
    213         if isempty(Intrinsic.kc)
    214             Intrinsic.kc=0;
    215         end
    216         if isempty(Intrinsic.Cx)||isempty(Intrinsic.Cy)
    217             Intrinsic.Cx=Intrinsic.Npx/2;
    218             Intrinsic.Cy=Intrinsic.Npy/2;
    219         end
    220        
    221         %% apply to cropped images if requested
    222         if get(handles.Replicate,'Value')
    223             answer=msgbox_uvmat('INPUT_Y-N','apply to full images (not cropped)?');
    224             if strcmp(answer,'No')
    225                 prompt = {'npy_lower'};
    226                 dlg_title = 'remove image the npy_lower image lines (removal of the upper line does not change calibration)';
    227                 num_lines= 1;
    228                 def     = {'0'};
    229                 answer = inputdlg(prompt,dlg_title,num_lines,def);
    230                 npy_crop=str2num(answer{1});
    231                 Intrinsic.Npy=Intrinsic.Npy-npy_crop; %size of the filtering window
    232                 Coord(:,5)=Coord(:,5)-npy_crop;% shift the image ordinates of the calibration points by removing the lower band
    233             end
    234         end
    235        
    236         %% Apply calibration
    237         [GeometryCalib,index,ind_removed,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
    238        
    239         %% record the coordinate unit
    240         unitlist=get(handles.CoordUnit,'String');
    241         unit=unitlist{get(handles.CoordUnit,'value')};
    242         GeometryCalib.CoordUnit=unit;
    243        
    244         %% record the coordinates of the calibration points
    245         GeometryCalib.SourceCalib.PointCoord=Coord;
    246        
    247         %% display calibration results on the GUI geometry_calib
    248         display_intrinsic(GeometryCalib,handles)%display calibration intrinsic parameters
    249         display_extrinsic(GeometryCalib,handles)%display calibration extrinsic parameters
    250         %     (rotation and translation of camera with  respect to the phys coordinates)
    251        
    252         %% set the defqult plane and display the calibration data errors for validation
    253         answer=msgbox_uvmat('INPUT_Y-N',{'store calibration data';...
    254             ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
    255             ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels'];
    256             [num2str(numel(ind_removed)) ' points removed']});
    257         if strcmp(answer,'Yes') %store the calibration data
    258             if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration
    259                 answer=msgbox_uvmat('INPUT_Y-N',{['Assume that the current image is in the plane of the calib points z=' num2str(Z_plane) ] ; 'can be later modified by MenuSetSlice in the upper bar menu of uvmat'});
    260                 SliceCoord_ref=Z_plane'*[0 0 1];
    261             end
    262         else
    263             GeometryCalib=[];
    264             index=1;
    265         end
    266        
    267         if ~isempty(GeometryCalib) % if calibration is not cancelled
    268             if get(handles.Replicate,'Value')
    269                 %% open the GUI browse_data
    270                 hbrowse=findobj(allchild(0),'Tag','browse_data');
    271                 if ~isempty(hbrowse)
    272                     BrowseHandles=guidata(hbrowse);
    273                     SourceDir=get(BrowseHandles.SourceDir,'String');
    274                     ListExperiments=get(BrowseHandles.ListExperiments,'String');
    275                     ListValues=get(BrowseHandles.ListExperiments,'Value');
    276                     ListExperiments=ListExperiments(ListValues);
    277                     ListDevices=get(BrowseHandles.ListDevices,'String');
    278                     Val=get(BrowseHandles.ListDevices,'Value');
    279                     DataFolder=ListDevices{Val};
    280                     nbcalib=0;
    281                     for ilist=1:numel(ListExperiments)
    282                         SubDirBase=regexprep(DataFolder,'+/','');
    283                         ListExperiments{ilist}=regexprep(ListExperiments{ilist},'+/','');
    284                         XmlName=fullfile(SourceDir,ListExperiments{ilist},[SubDirBase '.xml']);
    285                         % copy the xml file from the old location if appropriate, then update with the calibration parameters
    286                         %                 if ~exist(XmlName,'file') && ~isempty(SubDirBase)
    287                         %                     oldxml=fullfile(OutPut.Campaign,OutPut.Experiment{ilist},SubDirBase,[get(hhuvmat.RootFile,'String') '.xml']);
    288                         GeometryCalib.SliceCoord=SliceCoord_ref;%default input
    289                         if exist(XmlName,'file')
    290                             %[success,message]=copyfile(oldxml,XmlName);%copy the old xml file to a new one with the new convention
    291                             dispmesGeometryCalib=UvData.XmlData{1}.GeometryCalib;
    292                         else
    293                             msgbox_uvmat('ERROR','3D geometric calibration needed before defining slices')
    294                             return
    295                         end
    296                         SliceCoord=GeometryCalib.SliceCoord;
    297                         InterfaceCoord=min(SliceCoord(:,3));
    298                         if isfield(GeometryCalib,'InterfaceCoord')
    299                             InterfaceCoord=GeometryCalib.InterfaceCoord(1,3);
    300                         end
    301                         NbSlice=size(SliceCoord,1);
    302                         CheckVolumeScan=0;
    303                         if isfield(GeometryCalib,'CheckVolumeScan')
    304                             CheckVolumeScan=GeometryCalib.CheckVolumeScan;
    305                         end
    306                         RefractionIndex=1.33;
    307                         CheckRefraction=0;% default value of the check box refraction
    308                         if isfield(GeometryCalib,'RefractionIndex')
    309                             RefractionIndex=GeometryCalib.RefractionIndex;
    310                             CheckRefraction=1;
    311                         end
    312                         SliceAngle=[0 0 0];
    313                         if isfield(GeometryCalib,'SliceAngle')
    314                             SliceAngle=GeometryCalib.SliceAngle;
    315                         end
    316                         dispmessage=' updated with calibration parameters';
    317                         %                         if ~strcmp(answer,'yes')
    318                         [XmlDataOld,warntext]=imadoc2struct(XmlName);
    319                         if isfield(XmlDataOld,'GeometryCalib')
    320                             if isfield(XmlDataOld.GeometryCalib,'SliceAngle')
    321                                 GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.SliceAngle;
    322                             end
    323                             if isfield(XmlDataOld.GeometryCalib,'CheckRefraction')
    324                                 GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.CheckRefraction;
    325                             end
    326                             if isfield(XmlDataOld.GeometryCalib,'RefractionIndex')
    327                                 GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.RefractionIndex;
    328                             end
    329                             if isfield(XmlDataOld.GeometryCalib,'InterfaceCoord')
    330                                 GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.InterfaceCoord;
    331                             end
    332                         end
    333                        
    334                         end
    335                        
    336                         else
    337                             dispmessage=' created with calibration parameters';
     166function APPLY_Callback(hObject, eventdata, handles)
     167set(handles.CheckEnableMouse,'Value',0)% desactivate mouse (to avoid spurious creation of new points)
     168
     169%------------------------------------------------------------------------
     170%% look for the GUI uvmat and check for an image as input
     171set(handles.APPLY,'BackgroundColor',[1 1 0])% paint APPLY button in yellow to show activation
     172huvmat=findobj(allchild(0),'Name','uvmat');% look for the GUI uvmat
     173hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
     174if ~strcmp(get(hhuvmat.Scalar,'Visible'),'on')
     175    msgbox_uvmat('ERROR','An image needs to be opened in uvmat for calibration')
     176    return
     177end
     178
     179RootPath='';
     180if ~isempty(hhuvmat.RootPath)&& ~isempty(hhuvmat.RootFile)
     181    RootPath=get(hhuvmat.RootPath,'String');% path to the currently displayed image
     182    SubDirBase=regexprep(get(hhuvmat.SubDir,'String'),'\..+$','');
     183    outputfile=[fullfile(RootPath,SubDirBase) '.xml'];%xml file associated with the currently displayed image
     184else
     185    question={'save the calibration data and point coordinates in'};
     186    def={fullfile(RootPath,'ObjectCalib.xml')};
     187    options.Resize='on';
     188    answer=inputdlg(question,'',1,def,options);
     189    outputfile=answer{1};
     190end
     191
     192%% read coordinates of the calibration poinnts: Coord(:,1-3) in phys, Coord(:,4-5) image
     193Coord=get(handles.ListCoord,'Data');
     194
     195
     196%% read the type of calibration
     197calib_cell=get(handles.calib_type,'String');
     198val=get(handles.calib_type,'Value');
     199CalibFcn=['calib_' calib_cell{val}];
     200
     201%% read the intrinsic parameters
     202Intrinsic.Npx=str2num(get(hhuvmat.num_Npx,'String'));
     203Intrinsic.Npy=str2num(get(hhuvmat.num_Npy,'String'));
     204Intrinsic.coord_files=get(handles.ListCoordFiles,'String');
     205Intrinsic.fx=str2num(get(handles.fx,'String'));
     206Intrinsic.fy=str2num(get(handles.fy,'String'));
     207Intrinsic.kc=str2num(get(handles.kc,'String'));
     208Intrinsic.Cx=str2num(get(handles.Cx,'String'));
     209Intrinsic.Cy=str2num(get(handles.Cy,'String'));
     210if isempty(Intrinsic.kc)
     211    Intrinsic.kc=0;
     212end
     213if isempty(Intrinsic.Cx)||isempty(Intrinsic.Cy)
     214    Intrinsic.Cx=Intrinsic.Npx/2;
     215    Intrinsic.Cy=Intrinsic.Npy/2;
     216end
     217
     218%% apply to cropped images if requested
     219if get(handles.Replicate,'Value')
     220    answer=msgbox_uvmat('INPUT_Y-N','apply to full images (not cropped)?');
     221    if strcmp(answer,'No')
     222        prompt = {'npy_lower'};
     223        dlg_title = 'remove image the npy_lower image lines (removal of the upper line does not change calibration)';
     224        num_lines= 1;
     225        def     = {'0'};
     226        answer = inputdlg(prompt,dlg_title,num_lines,def);
     227        npy_crop=str2num(answer{1});
     228        Intrinsic.Npy=Intrinsic.Npy-npy_crop; %size of the filtering window
     229        Coord(:,5)=Coord(:,5)-npy_crop;% shift the image ordinates of the calibration points by removing the lower band
     230    end
     231end
     232
     233%% Apply calibration
     234[GeometryCalib,index,ind_removed,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
     235if isempty(GeometryCalib)
     236    return
     237end
     238
     239%% record the coordinate unit
     240unitlist=get(handles.CoordUnit,'String');
     241unit=unitlist{get(handles.CoordUnit,'value')};
     242GeometryCalib.CoordUnit=unit;
     243
     244%% record the coordinates of the calibration points
     245GeometryCalib.SourceCalib.PointCoord=Coord;
     246
     247%% display calibration results on the GUI geometry_calib
     248display_intrinsic(GeometryCalib,handles)%display calibration intrinsic parameters
     249display_extrinsic(GeometryCalib,handles)%display calibration extrinsic parameters
     250%     (rotation and translation of camera with  respect to the phys coordinates)
     251
     252%% set the default plane and display the calibration data errors for validation
     253answer=msgbox_uvmat('INPUT_Y-N',{'store calibration data';...
     254    ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
     255    ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels'];
     256    [num2str(numel(ind_removed)) ' points removed']});
     257if strcmp(answer,'Yes') %store the calibration data
     258    if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration
     259        answer=msgbox_uvmat('INPUT_Y-N',{['Assume that the current image is in the plane of the calib points z=' num2str(Z_plane) ] ; 'can be later modified by MenuSetSlice in the upper bar menu of uvmat'});
     260        SliceCoord_ref=Z_plane'*[0 0 1];
     261    end
     262else
     263    GeometryCalib=[];
     264    index=1;
     265end
     266
     267if ~isempty(GeometryCalib) % if calibration is not cancelled
     268    %%%%% use of the option 'replicate'
     269    if get(handles.Replicate,'Value')% if the option replicate is activated
     270        %% open the GUI browse_data
     271        hbrowse=findobj(allchild(0),'Tag','browse_data');
     272        if ~isempty(hbrowse)% look for the GUI 'replicate'
     273            BrowseHandles=guidata(hbrowse);
     274            SourceDir=get(BrowseHandles.SourceDir,'String');
     275            ListExperiments=get(BrowseHandles.ListExperiments,'String');
     276            ListValues=get(BrowseHandles.ListExperiments,'Value');
     277            ListExperiments=ListExperiments(ListValues);
     278            ListDevices=get(BrowseHandles.ListDevices,'String');
     279            Val=get(BrowseHandles.ListDevices,'Value');
     280            DataFolder=ListDevices{Val};
     281            nbcalib=0;
     282            for ilist=1:numel(ListExperiments)
     283                SubDirBase=regexprep(DataFolder,'+/','');
     284                ListExperiments{ilist}=regexprep(ListExperiments{ilist},'+/','');
     285                XmlName=fullfile(SourceDir,ListExperiments{ilist},[SubDirBase '.xml']);
     286                % copy the xml file from the old location if appropriate, then update with the calibration parameters
     287                %                 if ~exist(XmlName,'file') && ~isempty(SubDirBase)
     288                %                     oldxml=fullfile(OutPut.Campaign,OutPut.Experiment{ilist},SubDirBase,[get(hhuvmat.RootFile,'String') '.xml']);
     289                GeometryCalib.SliceCoord=SliceCoord_ref;%default input
     290                if exist(XmlName,'file')
     291                    %[success,message]=copyfile(oldxml,XmlName);%copy the old xml file to a new one with the new convention
     292                    dispmesGeometryCalib=UvData.XmlData{1}.GeometryCalib;
     293                else
     294                    msgbox_uvmat('ERROR','3D geometric calibration needed before defining slices')
     295                    return
     296                end
     297                SliceCoord=GeometryCalib.SliceCoord;
     298                InterfaceCoord=min(SliceCoord(:,3));
     299                if isfield(GeometryCalib,'InterfaceCoord')
     300                    InterfaceCoord=GeometryCalib.InterfaceCoord(1,3);
     301                end
     302                NbSlice=size(SliceCoord,1);
     303                CheckVolumeScan=0;
     304                if isfield(GeometryCalib,'CheckVolumeScan')
     305                    CheckVolumeScan=GeometryCalib.CheckVolumeScan;
     306                end
     307                RefractionIndex=1.33;
     308                CheckRefraction=0;% default value of the check box refraction
     309                if isfield(GeometryCalib,'RefractionIndex')
     310                    RefractionIndex=GeometryCalib.RefractionIndex;
     311                    CheckRefraction=1;
     312                end
     313                SliceAngle=[0 0 0];
     314                if isfield(GeometryCalib,'SliceAngle')
     315                    SliceAngle=GeometryCalib.SliceAngle;
     316                end
     317                dispmessage=' updated with calibration parameters';
     318                %                         if ~strcmp(answer,'yes')
     319                [XmlDataOld,warntext]=imadoc2struct(XmlName);
     320                if isfield(XmlDataOld,'GeometryCalib')
     321                    if isfield(XmlDataOld.GeometryCalib,'SliceAngle')
     322                        GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.SliceAngle;
    338323                    end
    339                     errormsg=update_imadoc(GeometryCalib,XmlName,'GeometryCalib');% introduce the calibration data in the xml file
    340                     if ~strcmp(errormsg,'')
    341                         msgbox_uvmat('ERROR',errormsg);
    342                     else
    343                         display([XmlName dispmessage])
    344                         nbcalib=nbcalib+1;
     324                    if isfield(XmlDataOld.GeometryCalib,'CheckRefraction')
     325                        GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.CheckRefraction;
     326                    end
     327                    if isfield(XmlDataOld.GeometryCalib,'RefractionIndex')
     328                        GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.RefractionIndex;
     329                    end
     330                    if isfield(XmlDataOld.GeometryCalib,'InterfaceCoord')
     331                        GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.InterfaceCoord;
    345332                    end
    346333                end
    347                
    348334            end
    349             msgbox_uvmat('CONFIMATION',[SubDirBase ' calibrated for ' num2str(nbcalib) ' experiments']);
     335
     336        else % in case the GUI 'replicate'is not found
     337            dispmessage=' created with calibration parameters';
     338        end
     339        errormsg=update_imadoc(GeometryCalib,XmlName,'GeometryCalib');% introduce the calibration data in the xml file
     340        if ~strcmp(errormsg,'')
     341            msgbox_uvmat('ERROR',errormsg);
    350342        else
    351            
    352             %% copy the xml file from the old location if appropriate, then update with the calibration parameters
    353             if ~exist(outputfile,'file') && ~isempty(SubDirBase)
    354                 oldxml=[fullfile(RootPath,SubDirBase,get(hhuvmat.RootFile,'String')) '.xml'];
    355                 if exist(oldxml,'file')
    356                     [success,message]=copyfile(oldxml,outputfile);%copy the old xml file to a new one with the new convention
    357                 end
    358             end
    359             errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');% introduce the calibration data in the xml file
    360             if ~strcmp(errormsg,'')
    361                 msgbox_uvmat('ERROR',errormsg);
    362             end
    363            
    364             %% display image with new calibration in the currently opened uvmat interface
    365             FieldList=get(hhuvmat.FieldName,'String');
    366             val=get(hhuvmat.FieldName,'Value');
    367             if strcmp(FieldList{val},'image')
    368                 set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' to plot the whole image
    369                 UserData=get(handles.geometry_calib,'UserData');
    370                 UserData.XmlInputFile=outputfile;%save the current xml file name
    371                 set(handles.geometry_calib,'UserData',UserData)
    372                 uvmat('InputFileREFRESH_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat, show the image in phys coordinates
    373                 PLOT_Callback(hObject, eventdata, handles)
    374                 set(handles.CoordLine,'string',num2str(index))
    375                 Coord=get(handles.ListCoord,'Data');
    376                 update_calib_marker(Coord(index,:)); %indicate the point with max deviations from phys coord to calibration
    377                 figure(handles.geometry_calib)% put the GUI geometry_calib in front
    378             else
    379                 msgbox_uvmat('WARNING','open the image to see the effect of the new calibration')
    380             end
     343            display([XmlName dispmessage])
     344            nbcalib=nbcalib+1;
    381345        end
    382346    end
    383     set(handles.APPLY,'BackgroundColor',[1 0 0]) % set APPLY button to red color
    384 
     347    % Use of the option replicate
     348end
     349msgbox_uvmat('CONFIMATION',[SubDirBase ' calibrated for ' num2str(nbcalib) ' experiments']);
     350
     351
     352%% copy the xml file from the old location if appropriate, then update with the calibration parameters
     353if ~exist(outputfile,'file') && ~isempty(SubDirBase)
     354    oldxml=[fullfile(RootPath,SubDirBase,get(hhuvmat.RootFile,'String')) '.xml'];
     355    if exist(oldxml,'file')
     356        [success,message]=copyfile(oldxml,outputfile);%copy the old xml file to a new one with the new convention
     357    end
     358end
     359errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');% introduce the calibration data in the xml file
     360if ~strcmp(errormsg,'')
     361    msgbox_uvmat('ERROR',errormsg);
     362end
     363
     364%% display image with new calibration in the currently opened uvmat interface
     365FieldList=get(hhuvmat.FieldName,'String');
     366val=get(hhuvmat.FieldName,'Value');
     367if strcmp(FieldList{val},'image')
     368    set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' to plot the whole image
     369    UserData=get(handles.geometry_calib,'UserData');
     370    UserData.XmlInputFile=outputfile;%save the current xml file name
     371    set(handles.geometry_calib,'UserData',UserData)
     372    uvmat('InputFileREFRESH_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat, show the image in phys coordinates
     373    PLOT_Callback(hObject, eventdata, handles)
     374    set(handles.CoordLine,'string',num2str(index))
     375    Coord=get(handles.ListCoord,'Data');
     376    update_calib_marker(Coord(index,:)); %indicate the point with max deviations from phys coord to calibration
     377    figure(handles.geometry_calib)% put the GUI geometry_calib in front
     378else
     379    msgbox_uvmat('WARNING','open the image to see the effect of the new calibration')
     380end
     381
     382set(handles.APPLY,'BackgroundColor',[1 0 0]) % set APPLY button to red color
     383                   
    385384%------------------------------------------------------------------------
    386385% --- Executes on button press in Replicate
     
    409408index=[];
    410409GeometryCalib=[];
     410ind_max=[];ind_removed=[];Z_plane=[];
    411411% apply the calibration, whose type is selected in  handles.calib_type
    412412if ~isempty(Coord)
     
    414414else
    415415    msgbox_uvmat('ERROR','No calibration points, abort')
    416 end 
     416end
    417417if isempty(GeometryCalib)
    418418    return
     
    441441ind_removed=find(check_x | check_y)
    442442% repeat calibration without the excluded points:
    443 if ~isempty(ind_removed) 
     443if ~isempty(ind_removed)
    444444    Coord(ind_removed,:)=[];
    445445    GeometryCalib=feval(CalibFcn,Coord,Intrinsic);
     
    482482%------------------------------------------------------------------------
    483483% --- determine the parameters for a calibration by a linear transform matrix (rescale and rotation)
    484 function GeometryCalib=calib_linear(Coord,Intrinsic) 
     484function GeometryCalib=calib_linear(Coord,Intrinsic)
    485485%------------------------------------------------------------------------
    486486X=Coord(:,1);
     
    534534    Calib.Cx=str2num(get(hhuvmat.num_Npx,'String'))/2;
    535535    Calib.Cx=str2num(get(hhuvmat.num_Npy,'String'))/2;
    536 end   
     536end
    537537%tsai parameters
    538538Calib.dpx=0.012;%arbitrary
     
    570570GeometryCalib.kappa1=calib_param(1);
    571571GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
    572 GeometryCalib.Tx_Ty_Tz=[calib_param(2) calib_param(3) calib_param(4)]; 
     572GeometryCalib.Tx_Ty_Tz=[calib_param(2) calib_param(3) calib_param(4)];
    573573alpha=calib_param(5);
    574574GeometryCalib.R=[cos(alpha) sin(alpha) 0;-sin(alpha) cos(alpha) 0;0 0 -1];
     
    592592X_1=Coord(:,1:3)';%phys coordinates of the ref points
    593593n_ima=numel(coord_files)+1;
    594 if ~isempty(coord_files) 
     594if ~isempty(coord_files)
    595595    msgbox_uvmat('CONFIRMATION',['The xy coordinates of the calibration points in ' num2str(n_ima) ' planes will be used'])
    596596    for ifile=1:numel(coord_files)
    597     t=xmltree(coord_files{ifile});
    598     s=convert(t);%convert to matlab structure
     597        t=xmltree(coord_files{ifile});
     598        s=convert(t);%convert to matlab structure
    599599        if isfield(s,'GeometryCalib')
    600600            if isfield(s.GeometryCalib,'SourceCalib')
    601601                if isfield(s.GeometryCalib.SourceCalib,'PointCoord')
    602                 PointCoord=s.GeometryCalib.SourceCalib.PointCoord;
    603                 Coord_file=zeros(length(PointCoord),5);%default
    604                 for i=1:length(PointCoord)
    605                     line=str2num(PointCoord{i});
    606                     Coord_file(i,4:5)=line(4:5);%px x
    607                     Coord_file(i,1:3)=line(1:3);%phys x
    608                 end
    609                 eval(['x_' num2str(ifile+1) '=Coord_file(:,4:5)'';']);
    610                 eval(['x_' num2str(ifile+1) '(2,:)=ny-x_' num2str(ifile+1) '(2,:);' ]);
    611                 eval(['X_' num2str(ifile+1) '=Coord_file(:,1:3)'';']);
     602                    PointCoord=s.GeometryCalib.SourceCalib.PointCoord;
     603                    Coord_file=zeros(length(PointCoord),5);%default
     604                    for i=1:length(PointCoord)
     605                        line=str2num(PointCoord{i});
     606                        Coord_file(i,4:5)=line(4:5);%px x
     607                        Coord_file(i,1:3)=line(1:3);%phys x
     608                    end
     609                    eval(['x_' num2str(ifile+1) '=Coord_file(:,4:5)'';']);
     610                    eval(['x_' num2str(ifile+1) '(2,:)=ny-x_' num2str(ifile+1) '(2,:);' ]);
     611                    eval(['X_' num2str(ifile+1) '=Coord_file(:,1:3)'';']);
    612612                end
    613613            end
     
    652652if ~strcmp(get(hhuvmat.Scalar,'Visible'),'on')
    653653    msgbox_uvmat('ERROR','An image needs to be opened in uvmat for calibration')
    654   return
     654    return
    655655end
    656656% check_cond=0;
     
    672672X_1=Coord(:,1:3)';%phys coordinates of the ref points
    673673n_ima=numel(coord_files)+1;
    674 if ~isempty(coord_files) 
     674if ~isempty(coord_files)
    675675    msgbox_uvmat('CONFIRMATION',['The xy coordinates of the calibration points in ' num2str(n_ima) ' planes will be used'])
    676676    for ifile=1:numel(coord_files)
    677     t=xmltree(coord_files{ifile});
    678     s=convert(t);%convert to matlab structure
     677        t=xmltree(coord_files{ifile});
     678        s=convert(t);%convert to matlab structure
    679679        if isfield(s,'GeometryCalib')
    680680            if isfield(s.GeometryCalib,'SourceCalib')
    681681                if isfield(s.GeometryCalib.SourceCalib,'PointCoord')
    682                 PointCoord=s.GeometryCalib.SourceCalib.PointCoord;
    683                 Coord_file=zeros(length(PointCoord),5);%default
    684                 for i=1:length(PointCoord)
    685                     line=str2num(PointCoord{i});
    686                     Coord_file(i,4:5)=line(4:5);%px x
    687                     Coord_file(i,1:3)=line(1:3);%phys x
    688                 end
    689                 eval(['x_' num2str(ifile+1) '=Coord_file(:,4:5)'';']);
    690                 eval(['x_' num2str(ifile+1) '(2,:)=ny-x_' num2str(ifile+1) '(2,:);' ]);
    691                 eval(['X_' num2str(ifile+1) '=Coord_file(:,1:3)'';']);
     682                    PointCoord=s.GeometryCalib.SourceCalib.PointCoord;
     683                    Coord_file=zeros(length(PointCoord),5);%default
     684                    for i=1:length(PointCoord)
     685                        line=str2num(PointCoord{i});
     686                        Coord_file(i,4:5)=line(4:5);%px x
     687                        Coord_file(i,1:3)=line(1:3);%phys x
     688                    end
     689                    eval(['x_' num2str(ifile+1) '=Coord_file(:,4:5)'';']);
     690                    eval(['x_' num2str(ifile+1) '(2,:)=ny-x_' num2str(ifile+1) '(2,:);' ]);
     691                    eval(['X_' num2str(ifile+1) '=Coord_file(:,1:3)'';']);
    692692                end
    693693            end
     
    731731if ~strcmp(get(hhuvmat.Scalar,'Visible'),'on')
    732732    msgbox_uvmat('ERROR','An image needs to be opened in uvmat for calibration')
    733   return
     733    return
    734734end
    735735ny=str2double(get(hhuvmat.num_Npy,'String'));
     
    766766GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%reverse Cx_Cy(2) for calibration (inversion of px ordinate)
    767767[omc,Tc1,Rc1,H,x,ex,JJ] = compute_extrinsic(x_1,X_1,...
    768    (GeometryCalib.fx_fy)',GeometryCalib.Cx_Cy',[GeometryCalib.kc 0 0 0 0]);
     768    (GeometryCalib.fx_fy)',GeometryCalib.Cx_Cy',[GeometryCalib.kc 0 0 0 0]);
    769769rmpath(fct_path);
    770770GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
    771771GeometryCalib.Tx_Ty_Tz=Tc1';
    772 %inversion of z axis 
     772%inversion of z axis
    773773GeometryCalib.R=Rc1;
    774774GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate
     
    817817Z=Coord(:,3);
    818818x_ima=Coord(:,4);
    819 y_ima=Coord(:,5); 
     819y_ima=Coord(:,5);
    820820[Xpoints,Ypoints]=px_XYZ(Calib,X,Y,Z);
    821821ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima)));
     
    839839% RootFile='';
    840840if ~isempty(hhuvmat.RootPath)&& ~isempty(hhuvmat.RootFile)
    841 %     testhandle=1;
     841    %     testhandle=1;
    842842    RootPath=get(hhuvmat.RootPath,'String');
    843843    RootFile=get(hhuvmat.RootFile,'String');
     
    897897
    898898% --------------------------------------------------------------------
    899 function MenuHelp_Callback(hObject, eventdata, handles)
    900 web('http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#GeometryCalib')
    901 
    902 % --------------------------------------------------------------------
    903 function MenuSetScale_Callback(hObject, eventdata, handles)
     899
     900% function MenuHelp_Callback(hObject, eventdata, handles)
     901% web('http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#GeometryCalib')
     902
     903%
     904function MenuSetScale_Callback(hObject,eventdata,handles)
    904905
    905906answer=msgbox_uvmat('INPUT_TXT','scale pixel/cm?','');
     
    942943
    943944% -----------------------------------------------------------------------
    944 % --- automatic grid dectection from local maxima of the images 
     945% --- automatic grid dectection from local maxima of the images
    945946function MenuDetectGrid_Callback(hObject, eventdata, handles)
    946947%------------------------------------------------------------------------
     
    953954end
    954955% corners_X=(Coord(end:-1:end-3,4)); %pixel absissa of the four corners
    955 % corners_Y=(Coord(end:-1:end-3,5)); 
     956% corners_Y=(Coord(end:-1:end-3,5));
    956957corners_X=(Coord(:,4)); %pixel absissa of the four corners
    957958corners_Y=(Coord(:,5));
     
    964965angles=angle((corners_X-corners_X(1))+1i*(corners_Y-corners_Y(1)));
    965966if abs(angles(4)-angles(2))>abs(angles(3)-angles(2))
    966       X_end=corners_X(4);
    967       Y_end=corners_Y(4);
    968       corners_X(4)=corners_X(3);
    969       corners_Y(4)=corners_Y(3);
    970       corners_X(3)=X_end;
    971       corners_Y(3)=Y_end;
     967    X_end=corners_X(4);
     968    Y_end=corners_Y(4);
     969    corners_X(4)=corners_X(3);
     970    corners_Y(4)=corners_Y(3);
     971    corners_X(3)=X_end;
     972    corners_Y(3)=Y_end;
    972973end
    973974
     
    992993% reference: http://alumni.media.mit.edu/~cwren/interpolator/ by Christopher R. Wren
    993994B = [ X Y ones(size(X)) zeros(4,3)        -X.*corners_X -Y.*corners_X ...
    994       zeros(4,3)        X Y ones(size(X)) -X.*corners_Y -Y.*corners_Y ];
     995    zeros(4,3)        X Y ones(size(X)) -X.*corners_Y -Y.*corners_Y ];
    995996B = reshape (B', 8 , 8 )';
    996997D = [ corners_X , corners_Y ];
     
    10001001C = [l(7:8)' 1];
    10011002
    1002 %% transform grid image into 'phys' coordinates 
     1003%% transform grid image into 'phys' coordinates
    10031004GeometryCalib.CalibrationType='3D_linear';
    10041005GeometryCalib.fx_fy=[1 1];
     
    10221023rmpath(fullfile(path_UVMAT,'transform_field'))
    10231024Amod=DataOut.A;% current image expressed in 'phys' coord
    1024 Rangx=DataOut.Coord_x;% x coordinates of first and last pixel centres in phys 
    1025 Rangy=DataOut.Coord_y;% y coordinates of first and last pixel centres in phys 
     1025Rangx=DataOut.Coord_x;% x coordinates of first and last pixel centres in phys
     1026Rangy=DataOut.Coord_y;% y coordinates of first and last pixel centres in phys
    10261027if CalibData.grid.CheckWhite
    10271028    Amod=double(Amod);%case of white grid markers: will look for image maxima
     
    10721073    x_profile=sum(Asub,1);%profile of subimage summed over y
    10731074    y_profile=sum(Asub,2);%profile of subimage summed over x
    1074 
     1075   
    10751076    [tild,ind_x_max]=max(x_profile);% index of max for the x profile
    10761077    [tild,ind_y_max]=max(y_profile);% index of max for the y profile
     
    10861087        y_shift=sum(Atop.*[-2 -1 0 1 2]')/sum(Atop);
    10871088    end
    1088         %%%%
    1089 %     if ipoint==9
    1090 %                 figure(11)
    1091 %   imagesc(Asub)
    1092 %     figure(12)
    1093 %     plot(x_profile,'r')
    1094 %     hold on
    1095 %     plot(y_profile,'b')
    1096 %     grid on
    1097 %     end
     1089    %%%%
     1090    %     if ipoint==9
     1091    %                 figure(11)
     1092    %   imagesc(Asub)
     1093    %     figure(12)
     1094    %     plot(x_profile,'r')
     1095    %     hold on
     1096    %     plot(y_profile,'b')
     1097    %     grid on
     1098    %     end
    10981099    %%%%
    10991100    TIndex(ipoint,1)=(i0min+ind_x_max-1+x_shift);% x position of the maximum (in index of Amod)
     
    11021103Tmod(:,1)=(TIndex(:,1)-1)*Dx+Rangx(1);
    11031104Tmod(:,2)=(TIndex(:,2)-1)*Dy+Rangy(1);
    1104 %Tmod=T(:,(1:2))+Delta;% 'phys' coordinates of the detected points 
     1105%Tmod=T(:,(1:2))+Delta;% 'phys' coordinates of the detected points
    11051106[Xpx,Ypx]=px_XYZ(GeometryCalib,Tmod(:,1),Tmod(:,2));% image coordinates of the detected points
    11061107Coord=[T Xpx Ypx zeros(size(T,1),1)];
     
    11201121    Tinput=CalibData.translate;
    11211122end
    1122 T=translate_points(Tinput);%display translate_points GUI and get shift parameters 
     1123T=translate_points(Tinput);%display translate_points GUI and get shift parameters
    11231124CalibData.translate=T;
    11241125set(handles.geometry_calib,'UserData',CalibData)
     
    11391140    Tinput=CalibData.rotate;
    11401141end
    1141 T=rotate_points(Tinput);%display rotate_points GUI to introduce rotation parameters 
     1142T=rotate_points(Tinput);%display rotate_points GUI to introduce rotation parameters
    11421143CalibData.rotate=T;
    11431144set(handles.geometry_calib,'UserData',CalibData)
     
    11901191GeometryCalib=s.GeometryCalib;
    11911192if ~(isfield(GeometryCalib,'SourceCalib')&&isfield(GeometryCalib.SourceCalib,'PointCoord'))
    1192         msgbox_uvmat('ERROR','invalid input file: no calibration points')
     1193    msgbox_uvmat('ERROR','invalid input file: no calibration points')
    11931194    return
    11941195end
     
    12441245end
    12451246[FileName, PathName, filterindex] = uigetfile( ...
    1246        {'*.xml;*.mat', ' (*.xml,*.mat)';
    1247        '*.xml',  '.xml files '; ...
    1248         '*.mat',  '.mat matlab files '}, ...
    1249         'Pick a file',oldfile);
    1250 fileinput=[PathName FileName];%complete file name 
     1247    {'*.xml;*.mat', ' (*.xml,*.mat)';
     1248    '*.xml',  '.xml files '; ...
     1249    '*.mat',  '.mat matlab files '}, ...
     1250    'Pick a file',oldfile);
     1251fileinput=[PathName FileName];%complete file name
    12511252testblank=findstr(fileinput,' ');%look for blanks
    12521253if ~isempty(testblank)
     
    13981399figure(handles.geometry_calib)
    13991400
    1400 %------------------------------------------------------------------------ 
     1401%------------------------------------------------------------------------
    14011402% --- Executes on button press in Copy: display Coord on the Matlab work space
    14021403%------------------------------------------------------------------------
     
    14091410commandwindow; %brings the Matlab command window to the front
    14101411
    1411 %------------------------------------------------------------------------ 
     1412%------------------------------------------------------------------------
    14121413% --- Executes when selected cell(s) is changed in ListCoord.
    1413 %------------------------------------------------------------------------ 
     1414%------------------------------------------------------------------------
    14141415function ListCoord_CellSelectionCallback(hObject, eventdata, handles)
    14151416if ~isempty(eventdata.Indices)
    14161417    iline=eventdata.Indices(1);% selected line number
    14171418    set(handles.CoordLine,'String',num2str(iline))
    1418      Data=get(handles.ListCoord,'Data');
    1419      update_calib_marker(Data(iline,:))
    1420 end
    1421 
    1422 %------------------------------------------------------------------------ 
     1419    Data=get(handles.ListCoord,'Data');
     1420    update_calib_marker(Data(iline,:))
     1421end
     1422
     1423%------------------------------------------------------------------------
    14231424% --- Executes when entered data in editable cell(s) in ListCoord.
    1424 %------------------------------------------------------------------------ 
     1425%------------------------------------------------------------------------
    14251426function ListCoord_CellEditCallback(hObject, eventdata, handles)
    14261427
     
    14711472%------------------------------------------------------------------------
    14721473% --- update the plot of calibration points
    1473 %------------------------------------------------------------------------ 
     1474%------------------------------------------------------------------------
    14741475% draw a circle around the point defined by the input coordinates Coord as given by line in the table Listcoord
    14751476function update_calib_marker(Coord)
     
    14931494
    14941495%% read appropriate coordinates (px or phys) in the table ListCoord
    1495 if isequal(option,'phys') % use phys coord 
     1496if isequal(option,'phys') % use phys coord
    14961497    XCoord=Coord(1);
    14971498    YCoord=Coord(2);
  • trunk/src/proj_field.m

    r1061 r1062  
    574574        NbSegment=0;
    575575    case 'rectangle'
    576         LineCoord([1 4],1)=ObjectData.Coord(1,1)-ObjectData.RangeX;
    577         LineCoord([1 2],2)=ObjectData.Coord(1,2)-ObjectData.RangeY;
    578         LineCoord([2 3],1)=ObjectData.Coord(1,1)+ObjectData.RangeX;
    579         LineCoord([4 1],2)=ObjectData.Coord(1,2)+ObjectData.RangeY;
     576        LineCoord([1 4],1)=ObjectData.Coord(1,1)-ObjectData.num_RangeX_2;
     577        LineCoord([1 2],2)=ObjectData.Coord(1,2)-ObjectData.num_RangeX_2;
     578        LineCoord([2 3],1)=ObjectData.Coord(1,1)+ObjectData_RangeX_2;
     579        LineCoord([4 1],2)=ObjectData.Coord(1,2)+ObjectData.RangeY-Y2;
    580580    case 'polygon'
    581581        LineCoord(NbPoints+1)=LineCoord(1);
     
    16101610                    ProjData.(AXName)=[coord_x_proj(1) coord_x_proj(end)]; %record the new (projected ) x coordinates
    16111611                    [X,YI]=meshgrid(coord_x_proj,coord_y_proj);%grid in the new coordinates
    1612                     XI=ObjectData.Coord(1,1)+(X)*cos(PlaneAngle(2))-YI*sin(PlaneAngle(1));%corresponding coordinates in the original system
    1613                     YI=ObjectData.Coord(1,2)+(X)*sin(PlaneAngle(2))+YI*cos(PlaneAngle(1));
     1612                    XI=ObjectData.Coord(1,1)+(X)*cos(PlaneAngle(1))-YI*sin(PlaneAngle(1));%corresponding coordinates in the original system
     1613                    YI=ObjectData.Coord(1,2)+(X)*sin(PlaneAngle(1))+YI*cos(PlaneAngle(1));
    16141614                   
    16151615                    if numel(Coord{1})==2% x coordinate defined by its bounds, get the whole set
  • trunk/src/series/civ_series.m

    r1061 r1062  
    455455                par_civ1.Mask=mask; %use mask already opened
    456456            else
    457                 try
    458                     par_civ1.Mask=imread(maskname);%update the mask, an store it for future use
    459                 catch ME
    460                     if ~isempty(ME.message)
    461                         errormsg=['error reading input image: ' ME.message];
    462                         disp_uvmat('ERROR',errormsg,checkrun)
    463                         return
     457                if exist(maskname,'file')
     458                    try
     459                        par_civ1.Mask=imread(maskname);%update the mask, an store it for future use
     460                    catch ME
     461                        if ~isempty(ME.message)
     462                            errormsg=['error reading input image: ' ME.message];
     463                            disp_uvmat('ERROR',errormsg,checkrun)
     464                            return
     465                        end
    464466                    end
     467                else
     468                    par_civ1.Mask=[];
    465469                end
    466470                mask=par_civ1.Mask;
     
    711715                par_civ2.Mask=mask; %use mask already opened
    712716            else
     717                if exist(maskname,'file')
    713718                try
    714719                    par_civ2.Mask=imread(maskname);%update the mask, an store it for future use
     
    719724                        return
    720725                    end
     726                end
     727                else
     728                    par_civ2.Mask=[];
    721729                end
    722730                mask=par_civ2.Mask;
  • trunk/src/series/merge_proj.m

    r1061 r1062  
    288288        %% reading input file(s)     
    289289        [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},ParamIn{iview},frame_index{iview}(index));
    290         if ~isempty(errormsg)
     290        if isempty(errormsg)
     291            disp([filecell{iview,index} ' read'])
     292        else
    291293            disp_uvmat('ERROR',['ERROR in merge_proj/read_field/' errormsg],checkrun)
    292294            return
  • trunk/src/set_object.m

    r1061 r1062  
    293293%set(handles.num_Angle_3,'Visible','off')
    294294set(handles.num_RangeX_1,'Visible','off')
    295 set(handles.num_RangeX_2,'Visible','off')
    296295set(handles.num_RangeY_1,'Visible','off')
    297 if isequal(ProjMode,'interp_lin')|| isequal(ProjMode,'interp_tps')
    298     set(handles.num_RangeY_2,'Visible','off')
    299 else
    300     set(handles.num_RangeY_2,'Visible','on')
    301 end
    302 if strcmp(ObjectStyle,'rectangle')||strcmp(ObjectStyle,'ellipse')
    303     set(handles.num_RangeX_2,'Visible','on')
    304 else
    305    set(handles.num_RangeX_2,'Visible','off')
    306 end
     296% if isequal(ProjMode,'interp_lin')|| isequal(ProjMode,'interp_tps')
     297%     set(handles.num_RangeY_2,'Visible','off')
     298% else
     299%     set(handles.num_RangeY_2,'Visible','on')
     300
    307301set(handles.num_RangeZ_1,'Visible','off')
    308302set(handles.num_RangeZ_2,'Visible','off')
     
    310304set(handles.num_DY,'Visible','off')
    311305set(handles.num_DZ,'Visible','off')
    312 set(handles.num_RangeInterp,'Visible','off')
    313 
     306%default
     307                set(handles.num_RangeX_2,'Visible','off')
     308         set(handles.num_RangeY_2,'Visible','off')
    314309switch ObjectStyle
    315310    case 'points'
    316         set(handles.num_RangeY_2,'TooltipString','num_RangeY_2: range of projection around each point')
     311        set(handles.num_RangeInterp,'TooltipString','num_RangeY_2: range of projection around each point')
    317312%         set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points')
    318313%         set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points')
    319314%         set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points')
    320315    case {'line','polyline','polygon'}
    321         set(handles.num_RangeY_2,'TooltipString','num_RangeY_2: range of projection around the line')
     316        set(handles.num_RangeX_2,'Visible','off')
     317         set(handles.num_RangeY_2,'Visible','off')
     318        %set(handles.num_RangeY_2,'TooltipString','num_RangeY_2: range of projection around the line')
    322319         set(handles.Coord,'TooltipString','Coord: table of x,y, z coordinates defining the line')
    323320%         set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line')
     
    329326        end       
    330327    case {'rectangle','ellipse'}
     328                set(handles.num_RangeX_2,'Visible','on')
     329         set(handles.num_RangeY_2,'Visible','on')
    331330        set(handles.num_RangeX_2,'TooltipString',['num_RangeX_2: half length of the ' ObjectStyle])
    332331        set(handles.num_RangeY_2,'TooltipString',['num_RangeY_2: half width of the ' ObjectStyle])
     332        if isequal(ProjMode,'interp_lin')|| isequal(ProjMode,'interp_tps')
     333            set(handles.num_DX,'Visible','on')
     334            set(handles.num_DX,'TooltipString','num_DX: mesh for the interpolated field along the line')
     335            set(handles.num_RangeInterp,'Visible','on')
     336        end       
    333337    case {'plane','plane_z'} 
    334338        set(handles.num_Angle_1,'Visible','on')
     
    336340        set(handles.num_RangeX_2,'Visible','on')
    337341        set(handles.num_RangeY_1,'Visible','on')
    338         set(handles.num_RangeY_2,'Visible','on')
     342        %set(handles.num_RangeY_2,'Visible','on')
    339343        set(handles.num_RangeZ_2,'TooltipString','num_ZMax: range of projection normal to the plane')
    340344        if test3D
Note: See TracChangeset for help on using the changeset viewer.