Changeset 71 for trunk/src/uvmat.m
- Timestamp:
- Mar 29, 2010, 6:34:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r67 r71 195 195 function uvmat_OpeningFcn(hObject, eventdata, handles, input ) 196 196 %------------------------------------------------------------------- 197 %WARNING: avoid the second input parameter, leads to erros 198 global dircur dir_opening nb_builtin 197 global nb_builtin 198 199 199 % Choose default command menuline output for uvmat 200 200 handles.output = hObject; … … 202 202 % Update handles structure 203 203 guidata(hObject, handles); 204 205 dircur=pwd; %current working directory206 dir_opening=dircur;207 204 208 205 % set the position of colorbar and ancillary GUIs: … … 247 244 if ~isfield(UvData.Object{1},'plotaxes') 248 245 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 246 set(handles.list_object_1,'Value',1); 249 247 set(handles.list_object_1,'String',{'1-PLANE'}); 250 set(handles.list_object_1,'Value',1);251 248 end 252 249 … … 382 379 set(handles.list_object_1,'Visible','on') 383 380 set(handles.frame_object,'Visible','on') 381 if ~isempty(errormsg) 382 msgbox_uvmat('ERROR',errormsg) 383 end 384 384 else 385 385 update_rootinfo(hObject,eventdata,handles); … … 566 566 set(handles.FileExt,'String',ext); 567 567 % fill file index counters 568 set(handles.i1,'String',i1); 569 568 set(handles.i1,'String',i1); 570 569 set(handles.i2,'String',i2); 571 570 set(handles.j1,'String',str_a); … … 574 573 % synchronise indices of the second input file if it exists 575 574 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); 577 576 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 idetect577 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') 580 579 FileIndex_1=name_generator('',stra2num(i1),stra2num(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),''); 581 580 set(handles.FileIndex_1,'String',FileIndex_1) … … 636 635 %------------------------------------------------------------------- 637 636 function update_rootinfo(hObject,eventdata,handles) 638 global dircur dir_opening639 637 640 638 set(handles.RootPath,'BackgroundColor',[1 1 0]) … … 1152 1150 end 1153 1151 TimeUnit_1=[]; 1154 testima=0; %test for image input1152 % testima=0; %test for image input 1155 1153 if isequal(lower(FileExt),'.avi') %.avi file 1156 testima=1;1154 % testima=1; 1157 1155 info=aviinfo([FileBase FileIndices FileExt]); 1158 1156 nbfield_1=info.NumFrames; … … 1368 1366 function nb_slice_Callback(hObject, eventdata, handles) 1369 1367 %------------------------------------------------------------------- 1370 nb_slice_str=get(handles.nb_slice,'String') 1368 nb_slice_str=get(handles.nb_slice,'String'); 1371 1369 if isequal(nb_slice_str,'volume') 1372 1370 num=stra2num(get(handles.j1,'String')); … … 1664 1662 num1=num1+increment; 1665 1663 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); 1667 1665 if sub_value% set the second field name and indices 1668 1666 num1_1=num1_1+increment; … … 1982 1980 sub_value=get(handles.SubField,'Value'); 1983 1981 FileType_1='none';%default 1984 %if sub_value==1985 filename_11986 1982 if ~isempty(filename_1) 1987 1983 % test for a constant second field (comparison with a fixed field) 1988 1984 NomType_1=get(handles.FileIndex_1,'UserData'); 1989 Ext_1=get(handles.FileExt_1,'String') 1985 Ext_1=get(handles.FileExt_1,'String'); 1990 1986 % determine the input file type 1991 1987 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf') … … 2474 2470 if ~isfield(UvData.Object{1},'plotaxes') 2475 2471 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 2476 set(handles.list_object_1,'String',{'1-PLANE'});2477 2472 set(handles.list_object_1,'Value',1); 2473 set(handles.list_object_1,'String',{'1-PLANE'}); 2478 2474 end 2479 2475 … … 2526 2522 IndexObj(2)=IndexObj_2; 2527 2523 end 2528 for iobj=IndexObj 2524 for imap=1:numel(IndexObj) 2525 iobj=IndexObj(imap); 2529 2526 if ~isempty(UvData.Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes) 2530 2527 %Projeter les champs sur l'objet:* 2531 2528 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 2533 2534 %use of mask 2534 2535 if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2) … … 3774 3775 if isequal(coord_option,'more...'); 3775 3776 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 % end3782 % end3783 3777 prompt = {'Enter the name of the transform function'}; 3784 3778 dlg_title = 'user defined transform'; … … 3794 3788 transform_selected =fullfile(PathName,FileName); 3795 3789 if ~exist(transform_selected,'file') 3796 % msgbox_uvmat('ERROR',['procesing fct ' transform_selected ' not found'])3797 3790 return 3798 3791 end … … 3827 3820 set(handles.path_transform,'String','') 3828 3821 end 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 3836 3823 set(handles.FixedLimits,'Value',0) 3837 3824 set(handles.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) … … 3857 3844 end 3858 3845 if isfield(UvData,'Object') 3859 nbobject=length(UvData.Object); 3860 UvData.Object([2:nbobject])=[]; 3846 UvData.Object=UvData.Object(1); 3861 3847 end 3848 list_object=get(handles.list_object_1,'String'); 3849 set(handles.list_object_1,'Value',1) 3850 set(handles.list_object_1,'String',list_object(1)) 3851 set(handles.list_object_2,'Value',2) 3852 set(handles.list_object_2,'String',[list_object(1);{'...'}]) 3853 list_object_2_Callback(hObject, eventdata, handles) 3854 3855 3862 3856 3863 3857 %delete mask if it is displayed … … 4181 4175 hhset_object=guidata(hset_object); 4182 4176 if test 4183 set(hhset_object.PLOT,' Visible','on');4177 set(hhset_object.PLOT,'enable','on'); 4184 4178 else 4185 set(hhset_object.PLOT,' Visible','off');4179 set(hhset_object.PLOT,'enable','off'); 4186 4180 end 4187 4181 end … … 4196 4190 val_2=get(handles.list_object_2,'Value'); 4197 4191 str_2=get(handles.list_object_2,'String'); 4198 if isequal(val_2,IndexObj) 4199 set(handles.list_object_2,'Value',numel(str_2)) 4192 if 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 ('...') 4200 4194 list_object_2_Callback(hObject, eventdata, handles) 4201 4195 end 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) 4196 update_object(handles,IndexObj,1,str_1) 4207 4197 4208 4198 %------------------------------------------------------------------------ … … 4213 4203 IndexObj=get(handles.list_object_2,'Value'); 4214 4204 if isequal(list_str{IndexObj},'...') 4215 hview_field=findobj(allchild(0),'Tag','view_field') 4205 hview_field=findobj(allchild(0),'Tag','view_field'); 4216 4206 if ~isempty(hview_field) 4217 4207 delete(hview_field) 4218 4208 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) 4209 else 4210 update_object(handles,IndexObj,2,list_str{IndexObj}) 4228 4211 end 4229 4212 4230 4213 %------------------------------------------------------------------------ 4231 function update_object(handles,IndexObj,option )4214 function update_object(handles,IndexObj,option,ObjectName) 4232 4215 %------------------------------------------------------------------------ 4233 4216 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface … … 4236 4219 end 4237 4220 ObjectData=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 4221 ObjectData.Name=ObjectName; 4222 if isequal(get(handles.edit,'Value'),1) 4223 ObjectData.enable_plot=1; % desable the PLOT option in the set_object GUI (editing mode 4240 4224 end 4241 4225 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters … … 4245 4229 ZBounds(2)=UvData.ZMax;%maximum for the Z slider 4246 4230 end 4247 hset_object=findobj(allchild(0),' Name','set_object');4231 hset_object=findobj(allchild(0),'tag','set_object'); 4248 4232 if ~isempty(hset_object) 4249 4233 delete(hset_object)% delete existing version of set_object 4250 4234 end 4251 4235 hset_object=set_object(ObjectData,PlotHandles,ZBounds);% call the set_object interface, 4236 set(hset_object,'name',ObjectName) 4252 4237 pos_uvmat=get(handles.uvmat,'Position'); 4253 4238 %position the set_object GUI with respect to uvmat … … 4327 4312 %------------------------------------------------------ 4328 4313 function MenuExportField_Callback(hObject, eventdata, handles) 4329 4330 4314 global CurData 4331 huvmat=get(handles.RootPath,'parent'); 4332 CurData=get(huvmat,'UserData'); 4315 huvmat=findobj(allchild(0),'Name','uvmat'); 4316 UvData=get(huvmat,'UserData'); 4317 CurData=UvData.ProjField_1; 4333 4318 evalin('base','global CurData')%make CurData global in the workspace 4334 display(['UserData of uvmat:'])4319 display(['UserData of view_field :']) 4335 4320 evalin('base','CurData') %display CurData in the workspace 4336 4321 commandwindow; … … 4450 4435 % ------------------------------------------------------------------ 4451 4436 function MenuCalib_Callback(hObject, eventdata, handles) 4452 % set(handles.TOOLS_txt,'Visible','on') 4453 % set(handles.frame_tools,'Visible','on') 4437 4454 4438 UvData=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 chosen4439 4440 %suppress competing options 4457 4441 set(handles.zoom,'Value',0) 4458 4442 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) 4459 set(handles.MenuTools,'enable','off') 4443 set(handles.MenuMask,'enable','off') 4444 set(handles.MenuGrid,'enable','off') 4460 4445 set(handles.MenuObject,'enable','off') 4461 4446 set(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')4471 4447 set(handles.list_object_1,'Value',1) 4472 4448 % initiate display of GUI geometry_calib … … 4481 4457 [UvData.hset_object,UvData.sethandles]=geometry_calib(handles,pos,FileName);% call the set_object interface 4482 4458 pos_uvmat=get(handles.uvmat,'Position'); 4483 %pos_cal(1:2)=UvData.CalOrigin + pos_uvmat(1:2); 4459 4484 4460 if isfield(UvData,'CalOrigin') 4485 4461 pos_cal(1)=pos_uvmat(1)+UvData.CalOrigin(1)*pos_uvmat(3); … … 4646 4622 end 4647 4623 end 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 INFO4656 varargin{11}=ext;4657 civ( varargin);% interface de civ(not in the uvmat file)4624 param.RootName=filebase; 4625 param.NomType=NomType; 4626 param.num1=num1; 4627 param.num2=num2; 4628 param.num_a=num_a; 4629 param.num_b=num_b; 4630 param.SubDir=SubDir; 4631 param.IndOpening=ind_opening;% A REVOIR +TRANSMETTRE IMADOC INFO 4632 param.ImaExt=ext; 4633 civ(param);% interface de civ(not in the uvmat file) 4658 4634 4659 4635 % ------------------------------------------------------------------ … … 4763 4739 t=xmltree(fileinput); 4764 4740 data=convert(t); 4765 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters 4741 data.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 4766 4744 hset_object=findobj(allchild(0),'Name','set_object'); 4767 4745 if ~isempty(hset_object) 4768 4746 delete(hset_object)% delete existing version of set_object 4769 4747 end 4770 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface 4748 UvData=get(handles.uvmat,'UserData'); 4749 [hset_object,UvData.sethandles]=set_object(data);% call the set_object interface 4771 4750 %position the set_object GUI with respect to uvmat 4772 4751 pos_uvmat=get(handles.uvmat,'Position'); … … 4782 4761 4783 4762 %------------------------------------------------------------------------ 4763 % --- generic function used for the creation of a projection object 4784 4764 function create_object(data,handles) 4785 4765 %------------------------------------------------------------------------ … … 4791 4771 set(handles.edit,'Value',0); %suppress the object edit mode 4792 4772 set(handles.edit,'BackgroundColor',[0.7,0.7,0.7]) 4773 data.enable_plot=1; 4793 4774 if isfield(UvData,'CoordType') 4794 4775 data.CoordType=UvData.CoordType; … … 4835 4816 zoom_Callback(handles.uvmat, [], handles) 4836 4817 4837 4838 4839 % -------------------------------------------------------------------- 4818 %------------------------------------------------------------------------ 4840 4819 function MenuRuler_Callback(hObject, eventdata, handles) 4820 %------------------------------------------------------------------------ 4841 4821 set(handles.zoom,'Value',0) 4842 4822 zoom_Callback(handles.uvmat, [], handles) … … 4846 4826 4847 4827 %------------------------------------------------------------------------ 4848 % executed when closing: set the parent interface button to value 04828 % --- executed when closing: set the parent interface button to value 0 4849 4829 function closefcn(gcbo,eventdata) 4850 4830 %------------------------------------------------------------------------ … … 4863 4843 set(hhh,'enable','off') 4864 4844 end 4845 4846 4847 % --- Executes on button press in delete_object. 4848 function delete_object_Callback(hObject, eventdata, handles) 4849 IndexObj=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.