Changeset 71 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 29, 2010, 6:34:55 PM (11 years ago)
Author:
sommeria
Message:

civ3D updated: introduction of image size
imadoc2struct: reding of image size from the xml file
set_object, view_field and related functions: improvement of projection object editing
mouse: possibility of adjusting the calibrations points with the mouse

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r67 r71  
    195195function uvmat_OpeningFcn(hObject, eventdata, handles, input )
    196196%-------------------------------------------------------------------
    197 %WARNING: avoid the second input parameter, leads to erros
    198 global dircur dir_opening nb_builtin
     197global nb_builtin
     198
    199199% Choose default command menuline output for uvmat
    200200handles.output = hObject;
     
    202202% Update handles structure
    203203guidata(hObject, handles);
    204 
    205 dircur=pwd; %current working directory
    206 dir_opening=dircur;
    207204
    208205% set the position of colorbar and ancillary GUIs:
     
    247244if ~isfield(UvData.Object{1},'plotaxes')
    248245    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
     246    set(handles.list_object_1,'Value',1);
    249247    set(handles.list_object_1,'String',{'1-PLANE'});
    250     set(handles.list_object_1,'Value',1);
    251248end
    252249
     
    382379        set(handles.list_object_1,'Visible','on')
    383380        set(handles.frame_object,'Visible','on')
     381        if ~isempty(errormsg)
     382            msgbox_uvmat('ERROR',errormsg)
     383        end
    384384    else
    385385        update_rootinfo(hObject,eventdata,handles);
     
    566566        set(handles.FileExt,'String',ext);
    567567        % fill file index counters
    568         set(handles.i1,'String',i1);
    569      
     568        set(handles.i1,'String',i1);   
    570569        set(handles.i2,'String',i2);
    571570        set(handles.j1,'String',str_a);
     
    574573        % synchronise indices of the second  input file if it exists
    575574        if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers
    576             [FileName_1,RootPath_1,FileBase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
     575            [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    577576            NomType_1=get(handles.FileIndex_1,'UserData');     
    578             [FileName_1,idetect]=name_generator(FileBase_1,stra2num(i1),stra2num(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
    579             if idetect
     577            FileName_1=name_generator(FileBase_1,stra2num(i1),stra2num(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
     578            if exist(FileName_1,'file')
    580579                FileIndex_1=name_generator('',stra2num(i1),stra2num(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),'');
    581580                set(handles.FileIndex_1,'String',FileIndex_1)
     
    636635%-------------------------------------------------------------------
    637636function update_rootinfo(hObject,eventdata,handles)
    638 global dircur  dir_opening
    639637
    640638set(handles.RootPath,'BackgroundColor',[1 1 0])
     
    11521150end
    11531151TimeUnit_1=[];
    1154 testima=0; %test for image input
     1152% testima=0; %test for image input
    11551153if isequal(lower(FileExt),'.avi') %.avi file
    1156     testima=1;
     1154%     testima=1;
    11571155    info=aviinfo([FileBase FileIndices FileExt]);
    11581156    nbfield_1=info.NumFrames;
     
    13681366function nb_slice_Callback(hObject, eventdata, handles)
    13691367%-------------------------------------------------------------------
    1370 nb_slice_str=get(handles.nb_slice,'String')
     1368nb_slice_str=get(handles.nb_slice,'String');
    13711369if isequal(nb_slice_str,'volume')
    13721370    num=stra2num(get(handles.j1,'String'));
     
    16641662     num1=num1+increment;
    16651663     num2=num2+increment;
    1666      [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir)
     1664     [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
    16671665     if sub_value% set the second field name and indices
    16681666        num1_1=num1_1+increment;
     
    19821980sub_value=get(handles.SubField,'Value');
    19831981FileType_1='none';%default
    1984 %if sub_value==
    1985 filename_1
    19861982if ~isempty(filename_1)
    19871983    % test for a constant second field (comparison with a fixed field)
    19881984    NomType_1=get(handles.FileIndex_1,'UserData');
    1989     Ext_1=get(handles.FileExt_1,'String')
     1985    Ext_1=get(handles.FileExt_1,'String');
    19901986    % determine the input file type
    19911987    if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')
     
    24742470if ~isfield(UvData.Object{1},'plotaxes')
    24752471    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
    2476     set(handles.list_object_1,'String',{'1-PLANE'});
    24772472    set(handles.list_object_1,'Value',1);
     2473    set(handles.list_object_1,'String',{'1-PLANE'}); 
    24782474end
    24792475
     
    25262522    IndexObj(2)=IndexObj_2;
    25272523end
    2528 for iobj=IndexObj
     2524for imap=1:numel(IndexObj)
     2525    iobj=IndexObj(imap);
    25292526    if ~isempty(UvData.Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes)
    25302527        %Projeter les champs sur l'objet:*
    25312528        ObjectData=proj_field(UvData.Field,UvData.Object{iobj},iobj);
    2532    
     2529        if imap==2
     2530            UvData.ProjField_2=ObjectData;%store the projection field on uvmat: ***** WILL REPLACE THE FIELD SORED ON THE AXES: AxeData *****
     2531        else
     2532            UvData.ProjField_1=ObjectData;%store the projection field on view_field
     2533        end
    25332534        %use of mask
    25342535        if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2)
     
    37743775if isequal(coord_option,'more...');
    37753776    coord_fct='';
    3776 
    3777 %     if exist(profil_perso,'file')
    3778 %           h=load (profil_perso);
    3779 %          if isfield(h,'transform_fct')
    3780 %                 transform_fct=h.transform_fct;
    3781 %          end
    3782 %     end
    37833777    prompt = {'Enter the name of the transform function'};
    37843778    dlg_title = 'user defined transform';
     
    37943788    transform_selected =fullfile(PathName,FileName);
    37953789    if ~exist(transform_selected,'file')
    3796 %            msgbox_uvmat('ERROR',['procesing fct ' transform_selected ' not found'])
    37973790           return
    37983791    end
     
    38273820    set(handles.path_transform,'String','')
    38283821end
    3829 %CurrentPath=fileparts(which(coord_option));
    3830 % if ~isequal(PathName,CurrentPath)
    3831 %     addpath(PathName)
    3832 %     errormsg=check_functions;
    3833 %     msgbox_uvmat('WARNING',[['path ' PathName ' added to the current Matlab pathes'];errormsg])
    3834 % end
    3835 %set(handles.path_transform,'String',fullfile(PathName,' ')); %show the path to the senlected function
     3822
    38363823set(handles.FixedLimits,'Value',0)
    38373824set(handles.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
     
    38573844end
    38583845if isfield(UvData,'Object')
    3859     nbobject=length(UvData.Object);
    3860     UvData.Object([2:nbobject])=[];
     3846     UvData.Object=UvData.Object(1);
    38613847end
     3848list_object=get(handles.list_object_1,'String');
     3849set(handles.list_object_1,'Value',1)
     3850set(handles.list_object_1,'String',list_object(1))
     3851set(handles.list_object_2,'Value',2)
     3852set(handles.list_object_2,'String',[list_object(1);{'...'}])
     3853list_object_2_Callback(hObject, eventdata, handles)
     3854
     3855
    38623856
    38633857%delete mask if it is displayed
     
    41814175    hhset_object=guidata(hset_object);
    41824176    if test
    4183         set(hhset_object.PLOT,'Visible','on');
     4177        set(hhset_object.PLOT,'enable','on');
    41844178    else
    4185        set(hhset_object.PLOT,'Visible','off');
     4179       set(hhset_object.PLOT,'enable','off');
    41864180    end
    41874181end
     
    41964190val_2=get(handles.list_object_2,'Value');
    41974191str_2=get(handles.list_object_2,'String');
    4198 if isequal(val_2,IndexObj)
    4199     set(handles.list_object_2,'Value',numel(str_2))
     4192if isequal(val_2,IndexObj)% if the first selection is equal to the second, it will suppress the second
     4193    set(handles.list_object_2,'Value',numel(str_2))%select the end of the list ('...')
    42004194    list_object_2_Callback(hObject, eventdata, handles)
    42014195end
    4202 hset_object=findobj(allchild(0),'Tag','set_object');
    4203 if ~isempty(hset_object)
    4204      set(hset_object,'name',str_1);
    4205 end
    4206 update_object(handles,IndexObj,1)
     4196update_object(handles,IndexObj,1,str_1)
    42074197
    42084198%------------------------------------------------------------------------
     
    42134203IndexObj=get(handles.list_object_2,'Value');
    42144204if isequal(list_str{IndexObj},'...')
    4215     hview_field=findobj(allchild(0),'Tag','view_field')
     4205    hview_field=findobj(allchild(0),'Tag','view_field');
    42164206    if ~isempty(hview_field)
    42174207        delete(hview_field)
    42184208    end
    4219     set(handles.list_object_2,'BackgroundColor',[1 1 1])
    4220 else
    4221     hset_object=findobj(allchild(0),'Tag','set_object');
    4222     if ~isempty(hset_object)
    4223         set(hset_object,'name',list_str{IndexObj});
    4224     end
    4225 %     set(handles.list_object_2,'BackgroundColor',[1 1 0])
    4226 %     set(handles.list_object_1,'BackgroundColor',[1 1 1])
    4227     update_object(handles,IndexObj,2)
     4209else
     4210    update_object(handles,IndexObj,2,list_str{IndexObj})
    42284211end
    42294212
    42304213%------------------------------------------------------------------------
    4231 function update_object(handles,IndexObj,option)
     4214function update_object(handles,IndexObj,option,ObjectName)
    42324215%------------------------------------------------------------------------
    42334216UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     
    42364219end
    42374220ObjectData=UvData.Object{IndexObj};
    4238 if isequal(get(handles.edit,'Value'),0)
    4239     ObjectData.desable_plot=1; % desable the PLOT option in the set_object GUI (editing mode
     4221ObjectData.Name=ObjectName;
     4222if isequal(get(handles.edit,'Value'),1)
     4223    ObjectData.enable_plot=1; % desable the PLOT option in the set_object GUI (editing mode
    42404224end
    42414225PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     
    42454229        ZBounds(2)=UvData.ZMax;%maximum for the Z slider
    42464230    end
    4247 hset_object=findobj(allchild(0),'Name','set_object');
     4231hset_object=findobj(allchild(0),'tag','set_object');
    42484232if ~isempty(hset_object)
    42494233    delete(hset_object)% delete existing version of set_object
    42504234end
    42514235hset_object=set_object(ObjectData,PlotHandles,ZBounds);% call the set_object interface,
     4236set(hset_object,'name',ObjectName)
    42524237pos_uvmat=get(handles.uvmat,'Position');
    42534238%position the set_object GUI with respect to uvmat
     
    43274312%------------------------------------------------------
    43284313function MenuExportField_Callback(hObject, eventdata, handles)
    4329 
    43304314global CurData
    4331 huvmat=get(handles.RootPath,'parent');
    4332 CurData=get(huvmat,'UserData');
     4315huvmat=findobj(allchild(0),'Name','uvmat');
     4316UvData=get(huvmat,'UserData');
     4317CurData=UvData.ProjField_1;
    43334318evalin('base','global CurData')%make CurData global in the workspace
    4334 display(['UserData of uvmat :'])
     4319display(['UserData of view_field :'])
    43354320evalin('base','CurData') %display CurData in the workspace
    43364321commandwindow;
     
    44504435% ------------------------------------------------------------------
    44514436function MenuCalib_Callback(hObject, eventdata, handles)
    4452 % set(handles.TOOLS_txt,'Visible','on')
    4453 % set(handles.frame_tools,'Visible','on')
     4437
    44544438UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    4455 %reinitialize the edit interface associated with uvmat
    4456 %suppress the other options if MENULINE is chosen
     4439
     4440%suppress competing options
    44574441set(handles.zoom,'Value',0)
    44584442set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
    4459 set(handles.MenuTools,'enable','off')
     4443set(handles.MenuMask,'enable','off')
     4444set(handles.MenuGrid,'enable','off')
    44604445set(handles.MenuObject,'enable','off')
    44614446set(handles.MenuEdit,'enable','off')
    4462 %         set(handles.create,'Value',0)
    4463 %         set(handles.create,'BackgroundColor',[0 1 0])
    4464 %         set(handles.create,'enable','off')     
    4465 % set(handles.edit_vect,'Value',0)
    4466 % set(handles.edit_vect,'enable','off')
    4467 % edit_vect_Callback(hObject, eventdata, handles)
    4468 % set(handles.edit,'Value',0)
    4469 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    4470 % set(handles.edit,'enable','off')
    44714447set(handles.list_object_1,'Value',1)     
    44724448% initiate display of GUI geometry_calib
     
    44814457[UvData.hset_object,UvData.sethandles]=geometry_calib(handles,pos,FileName);% call the set_object interface     
    44824458pos_uvmat=get(handles.uvmat,'Position');
    4483 %pos_cal(1:2)=UvData.CalOrigin + pos_uvmat(1:2);
     4459
    44844460if isfield(UvData,'CalOrigin')
    44854461    pos_cal(1)=pos_uvmat(1)+UvData.CalOrigin(1)*pos_uvmat(3);
     
    46464622    end
    46474623end     
    4648 varargin{1}=filebase;
    4649 varargin{2}=NomType;
    4650 varargin{3}=num1;
    4651 varargin{4}=num2;
    4652 varargin{5}=num_a;
    4653 varargin{6}=num_b;
    4654 varargin{7}=SubDir;
    4655 varargin{8}=ind_opening;% A REVOIR +TRANSMETTRE IMADOC INFO
    4656 varargin{11}=ext;
    4657 civ(varargin);% interface de civ(not in the uvmat file)
     4624param.RootName=filebase;
     4625param.NomType=NomType;
     4626param.num1=num1;
     4627param.num2=num2;
     4628param.num_a=num_a;
     4629param.num_b=num_b;
     4630param.SubDir=SubDir;
     4631param.IndOpening=ind_opening;% A REVOIR +TRANSMETTRE IMADOC INFO
     4632param.ImaExt=ext;
     4633civ(param);% interface de civ(not in the uvmat file)
    46584634
    46594635% ------------------------------------------------------------------
     
    47634739t=xmltree(fileinput);
    47644740data=convert(t);
    4765 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4741data.enable_plot=1;
     4742[pp,data.Name]=fileparts(FileName);
     4743%PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
    47664744hset_object=findobj(allchild(0),'Name','set_object');
    47674745if ~isempty(hset_object)
    47684746    delete(hset_object)% delete existing version of set_object
    47694747end
    4770 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
     4748UvData=get(handles.uvmat,'UserData');
     4749[hset_object,UvData.sethandles]=set_object(data);% call the set_object interface
    47714750%position the set_object GUI with respect to uvmat
    47724751pos_uvmat=get(handles.uvmat,'Position');
     
    47824761
    47834762%------------------------------------------------------------------------
     4763% --- generic function used for the creation of a projection object
    47844764function create_object(data,handles)
    47854765%------------------------------------------------------------------------
     
    47914771set(handles.edit,'Value',0); %suppress the object edit mode
    47924772set(handles.edit,'BackgroundColor',[0.7,0.7,0.7]) 
     4773data.enable_plot=1;
    47934774if isfield(UvData,'CoordType')
    47944775    data.CoordType=UvData.CoordType;
     
    48354816zoom_Callback(handles.uvmat, [], handles)
    48364817
    4837 
    4838 
    4839 % --------------------------------------------------------------------
     4818%------------------------------------------------------------------------
    48404819function MenuRuler_Callback(hObject, eventdata, handles)
     4820%------------------------------------------------------------------------
    48414821set(handles.zoom,'Value',0)
    48424822zoom_Callback(handles.uvmat, [], handles)
     
    48464826
    48474827%------------------------------------------------------------------------
    4848 % executed when closing: set the parent interface button to value 0
     4828% --- executed when closing: set the parent interface button to value 0
    48494829function closefcn(gcbo,eventdata)
    48504830%------------------------------------------------------------------------
     
    48634843    set(hhh,'enable','off')
    48644844end
     4845
     4846
     4847% --- Executes on button press in delete_object.
     4848function delete_object_Callback(hObject, eventdata, handles)
     4849IndexObj=get(handles.list_object_2,'Value');
     4850    if IndexObj>1
     4851        delete_object(IndexObj)
     4852    end
     4853   
     4854
Note: See TracChangeset for help on using the changeset viewer.