Changeset 17


Ignore:
Timestamp:
Feb 18, 2010, 7:37:48 PM (14 years ago)
Author:
sommeria
Message:

possibilite de créer une grille physique dans geometry_calib (le faire apres avoir introduit les points sur l'image avec la souris)
petites corrections mineures sur les autres fichiers

Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/dataview.m

    r12 r17  
    44% associated with the GUI dataview.fig
    55%
    6 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     6%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    77%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
    8 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     8%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    99%     This file is part of the toolbox UVMAT.
    1010%
     
    1818%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1919%     GNU General Public License (file UVMAT/COPYING.txt) for more details.
    20 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     20%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    2121
    2222function varargout = dataview(varargin)
     
    4343% End initialization code - DO NOT EDIT
    4444
    45 
     45%------------------------------------------------------------------------
    4646% --- Executes just before dataview is made visible.
    4747function dataview_OpeningFcn(hObject, eventdata, handles, RootDir, SubCampaignTst,GeometryCalib)
    48 
     48%------------------------------------------------------------------------
    4949% Choose default command line output for dataview
    5050handles.output = 'Cancel';
     
    107107end
    108108
    109 
    110 
    111109%------------------------------------------------------------------------
    112110% --- Outputs from this function are returned to the command line.
     
    117115delete(handles.figure)
    118116
    119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    120117%------------------------------------------------------------------------
    121118% --- Executes on button press in browser.
     
    136133CampaignDir=uigetdir(CurrentFile,'Open the Campaign directory'); %file browser
    137134set(handles.RootDirectory,'String',CampaignDir)
    138 
    139135RootDirectory_Callback(hObject, eventdata, handles)
    140136
  • trunk/src/geometry_calib.m

    r12 r17  
    109109%set(htable,'ColumnNames',{'x','y','z','X(pixels)','Y(pixels)'})
    110110
     111%------------------------------------------------------------------------
    111112% --- Outputs from this function are returned to the command line.
    112113function varargout = geometry_calib_OutputFcn(hObject, eventdata, handles)
    113 % varargout  cell array for returning output args (see VARARGOUT);
    114 % hObject    handle to figure
    115 % eventdata  reserved - to be defined in a future version of MATLAB
    116 % handles    structure with handles and user data (see GUIDATA)
    117 
     114%------------------------------------------------------------------------
    118115% Get default command line output from handles structure
    119116varargout{1} = handles.output;
     
    123120function Phi_Callback(hObject, eventdata, handles)
    124121
    125 
    126 
    127 
    128 %--------------------------------------------------
     122%------------------------------------------------------------------------
    129123%read input xml file and update the edit boxes
    130124function loadfile(handles,fileinput)
    131 
     125%------------------------------------------------------------------------
    132126%read the input xml file
    133127t=xmltree(fileinput);
     
    267261unit=unitlist{get(handles.CoordUnit,'value')};
    268262GeometryCalib.CoordUnit=unit;
    269 
     263GeometryCalib.SourceCalib.PointCoord=Object.Coord;
    270264huvmat=findobj(allchild(0),'Name','uvmat');
    271265hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
     
    285279    outputfile=answer{1};
    286280end
    287 testappend=0;
    288 if exist(outputfile,'file');%=1 if the output file already exists, 0 else
    289     t=xmltree(outputfile); %read the file
    290     backupfile=outputfile;
    291     testexist=2;
    292     while testexist==2
    293         backupfile=[backupfile '~'];% make a backup name by adding  ~ to the xml file name
    294         testexist=exist(backupfile,'file');
    295     end
    296     [success,message]=copyfile(outputfile,backupfile);%make backup   
    297     t=xmltree(outputfile); %read the file
    298     uid=find(t,'ImaDoc');
    299     if ~isequal(uid,1)%if the xml file is not ImaDoc, delete it (after backup)
    300         if isequal(success,1)
    301             delete(outputfile)
    302         else
    303             msgbox_uvmat('ERROR',['error in the backup of the existing xml file: ' message])
    304             return
    305         end
    306     else
    307         uid_calib=find(t,'ImaDoc/GeometryCalib');
    308         testappend=1;
    309         if isempty(uid_calib)
    310             [t,uid_calib]=add(t,1,'element','GeometryCalib');
    311         else %if GeometryCalib already exists, delete its content
    312             uid_child=children(t,uid_calib);
    313             t=delete(t,uid_child);
    314 %             testappend=1;
    315         end
    316     end
    317 end
    318 if ~testappend %create a new xml file for calibration data
    319     t=xmltree;
    320     t=set(t,1,'name','ImaDoc');
    321     [t,uid_calib]=add(t,1,'element','GeometryCalib');
    322 end
    323 % hgrid=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata
    324 % imagename=get(hgrid,'UserData');
    325 % if exist(imagename,'file')
    326 %     GeometryCalib.SourceCalib.ImageCalib=imagename;
     281update_imadoc(GeometryCalib,outputfile)
     282% testappend=0;
     283% if exist(outputfile,'file');%=1 if the output file already exists, 0 else
     284%     t=xmltree(outputfile); %read the file
     285%     backupfile=outputfile;
     286%     testexist=2;
     287%     while testexist==2
     288%         backupfile=[backupfile '~'];% make a backup name by adding  ~ to the xml file name
     289%         testexist=exist(backupfile,'file');
     290%     end
     291%     [success,message]=copyfile(outputfile,backupfile);%make backup   
     292%     t=xmltree(outputfile); %read the file
     293%     uid=find(t,'ImaDoc');
     294%     if ~isequal(uid,1)%if the xml file is not ImaDoc, delete it (after backup)
     295%         if isequal(success,1)
     296%             delete(outputfile)
     297%         else
     298%             msgbox_uvmat('ERROR',['error in the backup of the existing xml file: ' message])
     299%             return
     300%         end
     301%     else
     302%         uid_calib=find(t,'ImaDoc/GeometryCalib');
     303%         testappend=1;
     304%         if isempty(uid_calib)
     305%             [t,uid_calib]=add(t,1,'element','GeometryCalib');
     306%         else %if GeometryCalib already exists, delete its content
     307%             uid_child=children(t,uid_calib);
     308%             t=delete(t,uid_child);
     309% %             testappend=1;
     310%         end
     311%     end
    327312% end
    328 GeometryCalib.SourceCalib.PointCoord=Object.Coord;
    329 t=struct2xml(GeometryCalib,t,uid_calib);
    330 save(t,outputfile);
     313% if ~testappend %create a new xml file for calibration data
     314%     t=xmltree;
     315%     t=set(t,1,'name','ImaDoc');
     316%     [t,uid_calib]=add(t,1,'element','GeometryCalib');
     317% end
     318% % hgrid=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata
     319% % imagename=get(hgrid,'UserData');
     320% % if exist(imagename,'file')
     321% %     GeometryCalib.SourceCalib.ImageCalib=imagename;
     322% % end
     323% GeometryCalib.SourceCalib.PointCoord=Object.Coord;
     324% t=struct2xml(GeometryCalib,t,uid_calib);
     325% save(t,outputfile);
    331326msgbox_uvmat('CONFIRMATION',{[outputfile ' updated with calibration data'];...
    332327    ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
     
    364359end
    365360% %record image source
    366 % hgrid=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata
    367 % imagename=get(hgrid,'UserData');
    368 % if exist(imagename,'file')
    369 %     GeometryCalib.SourceCalib.ImageCalib=imagename;
    370 % end
    371361GeometryCalib.SourceCalib.PointCoord=Object.Coord;
    372 
    373 
    374 %root PROJETS
    375362
    376363%open and read the dataview GUI
     
    380367end
    381368CalibData=get(handles.figure1,'UserData');%read the calibration image source on the interface userdata
    382 % filename='PROJETS';%default
    383 % if isfield(CalibData,'XmlInput')
    384 %      [pp,filename]=fileparts(CalibData.XmlInput);
    385 % end
    386 % while ~isequal(filename,'PROJETS') && numel(filename)>1
    387 %     filename_1=filename;
    388 %     pp_1=pp;
    389 %     [pp,filename]=fileparts(pp)
    390 % end
    391 % projinput=fullfile(pp_1,filename_1)
    392 % dd=dataview(projinput)
    393 
    394 %
    395 % Device=[];%default
    396 %
    397 % h_dataview=dataview;
    398 % hhdataview=guidata(h_dataview);
    399 % drawnow
    400369
    401370if isfield(CalibData,'XmlInput')
     
    443412end
    444413if testinput
    445     outcome=dataview(XmlInput,SubCampaignTest,GeometryCalib)%,SubCampaignTest)
     414    outcome=dataview(XmlInput,SubCampaignTest,GeometryCalib)
    446415end
    447416%     %A COMPLETER
     
    955924    set(handles.ListCoord,'String',Tabchar) 
    956925    ListCoord_Callback(hObject, eventdata, handles)
    957     PLOT_Callback(hObject,eventdata,handles)
     926    MenuPlot_Callback(hObject,eventdata,handles)
    958927end
    959928
     
    10511020end
    10521021
    1053 
    1054 
    1055 % --------------------------------------------------------------------
     1022%------------------------------------------------------------------------
    10561023function MenuCreateGrid_Callback(hObject, eventdata, handles)
     1024%------------------------------------------------------------------------
    10571025hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
    10581026CalibData=get(hcalib,'UserData');
     
    10611029    Tinput=CalibData.grid;
    10621030end
    1063 T=create_grid(Tinput);%display translate_points GUI and get shift parameters
     1031T=create_grid(Tinput)%display the GUI create_grid
    10641032CalibData.grid=T;
    10651033set(hcalib,'UserData',CalibData)
     
    10671035%grid in phys space
    10681036Coord_cell=get(handles.ListCoord,'String');
    1069 data=read_geometry_calib(Coord_cell);
    1070 data.Coord(:,1)=T(1)+data.Coord(:,1);
    1071 data.Coord(:,2)=T(2)+data.Coord(:,2);
    1072 data.Coord(:,3)=T(3)+data.Coord(:,3);
    1073 data.Coord(:,[4 5])=data.Coord(:,[4 5]);
    1074 for i=1:size(data.Coord,1)
    1075     for j=1:5
    1076           Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
     1037data=read_geometry_calib(Coord_cell)
     1038nbpoints=size(data.Coord,1); %nbre of calibration points
     1039data.Coord(1:size(T,1),1:3)=T;
     1040for i=1:nbpoints
     1041   for j=1:5
     1042          Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits
    10771043   end
    10781044end
     1045for i=nbpoints+1:size(data.Coord,1)
     1046    for j=1:3
     1047          Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits
     1048    end
     1049    for j=4:5
     1050          Coord{i,j}='';%display coordiantes with 4 digi
     1051    end
     1052end
     1053
     1054
     1055%size(data.Coord,1)
    10791056Tabchar=cell2tab(Coord,'    |    ');
    10801057set(handles.ListCoord,'Value',1)
    10811058set(handles.ListCoord,'String',Tabchar)
    10821059
    1083 
    1084 
    1085 % --------------------------------------------------------------------
     1060%-----------------------------------------------------------------------
    10861061function MenuTranslatePoints_Callback(hObject, eventdata, handles)
     1062%-----------------------------------------------------------------------
    10871063hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
    10881064CalibData=get(hcalib,'UserData')
  • trunk/src/get_field.m

    r12 r17  
    15671567if ~isequal(path_get_field,PathName)
    15681568    CurrentPath=fileparts(which(ACTION));
    1569     if ~isequal(PathName,CurrentPath)
     1569    if ~isequal(CurrentPath,PathName)&&~isequal(CurrentPath,fullfile(PathName,'private'))
    15701570        addpath(PathName)
    15711571        errormsg=check_functions;
  • trunk/src/private/ListDir.m

    r8 r17  
    11%'ListDir': scan the structure of the directory tree (for dataview.m)
    22%------------------------------------------------------------------------
     3% function [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices_in,ListRecords_in)
     4%
     5%
     6% OUTPUT:
     7% ListDevices: list of Devices
     8% ListRecords: list of records
     9% ListXml: list of xml file names
     10% List: structure representing the tree structure
     11%
     12%INPUT
     13% CurrentPath: full name (including path) to the input campaign (or subcampaign), we assume that
     14%          data are organised as (sub)campaign/Experiment/Device/(Record/)/file .xml
     15% ListExperiments: list of experiments to scan (cell of names)
     16% ListDevices_in: list of devices to scan (cell of names)
     17% ListRecords_in: list of records to scan (cell of names)
     18
    319function [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices_in,ListRecords_in)
    420
     
    7389end
    7490
    75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     91
     92%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     93% ListDevices: list of devices already scanned
     94% ListDevices_in: list of input devices to scan
    7695function [testnew,testselect]=test_select(name,ListDevices,ListDevices_in)
     96%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    7797if ~isempty(ListDevices_in)
    7898    testnew=0;
  • trunk/src/private/read_geometry_calib.m

    r8 r17  
    1818nb_defining_points=length(Coord_cell);
    1919iline=0;
     20data.Coord=[];%default
    2021for i=1:nb_defining_points
    2122    coord_str=Coord_cell{i};%character string of line number i
  • trunk/src/series.m

    r12 r17  
    16771677if ~isequal(path_series,PathName)
    16781678    CurrentPath=fileparts(which(ACTION));
    1679     if ~isequal(PathName,CurrentPath)
     1679    if ~isequal(CurrentPath,PathName)&&~isequal(CurrentPath,fullfile(PathName,'private'))
    16801680        addpath(PathName)
    16811681        errormsg=check_functions;
     
    43994399            last_j2 =last_j +ind_shift(2);
    44004400            siz=size(SeriesData.Time{1});
    4401             if siz(1)>=last_i2 & siz(2)>=last_j2
     4401            if first_i1>=1 && first_j1
     4402                >=1 && siz(1)>=last_i2 && siz(2)>=last_j2
    44024403                time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2;
    44034404                time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2;
  • trunk/src/update_imadoc.m

    r13 r17  
    1111if exist(outputfile,'file');%=1 if the output file already exists, 0 else 
    1212    t=xmltree(outputfile); %read the file
     13    backupfile=outputfile;
     14    testexist=2;
     15    while testexist==2
     16       backupfile=[backupfile '~'];
     17       testexist=exist(backupfile,'file');
     18    end
     19    [success,message]=copyfile(outputfile,backupfile);%make backup
    1320    uid=find(t,'ImaDoc');
    1421    if ~isequal(uid,1)
     
    2128        [t,uid_calib]=add(t,1,'element','GeometryCalib');
    2229    else %if GeometryCalib already exists, delete its content
    23         backupfile=outputfile;
    24         testexist=2;
    25         while testexist==2
    26            backupfile=[backupfile '~'];
    27            testexist=exist(backupfile,'file');
    28         end
    29         [success,message]=copyfile(outputfile,backupfile);%make backup
     30%         backupfile=outputfile;
     31%         testexist=2;
     32%         while testexist==2
     33%            backupfile=[backupfile '~'];
     34%            testexist=exist(backupfile,'file');
     35%         end
     36%         [success,message]=copyfile(outputfile,backupfile);%make backup
    3037        if isequal(success,1)
    3138            delete(outputfile)
  • trunk/src/uvmat.m

    r15 r17  
    39953995PathName=list_path{ind_coord};
    39963996CurrentPath=fileparts(which(coord_option));
    3997 if ~isequal(PathName,CurrentPath)
     3997if ~isequal(PathName,CurrentPath)&&~isequal(CurrentPath,fullfile(PathName,'private'))
    39983998    addpath(PathName)
    39993999    errormsg=check_functions;
Note: See TracChangeset for help on using the changeset viewer.