Changeset 738 for trunk/src/uvmat.m
- Timestamp:
- Apr 14, 2014, 11:41:21 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r735 r738 3811 3811 3812 3812 %% delete drawn objects if the output CooordUnit is different from the previous one 3813 if ~strcmp(CoordUnit,CoordUnitPrev)3813 if ~strcmp(CoordUnit,CoordUnitPrev) 3814 3814 set(handles.CheckFixLimits,'Value',0) 3815 % set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])3816 3815 hother=findobj('Tag','proj_object');%find all the proj objects 3817 3816 for iobj=1:length(hother) … … 4544 4543 UvData.ProjObject(IndexObj)=[]; 4545 4544 end 4546 if ~isempty(list_str) 4547 list_str(IndexObj)=[]; 4548 end 4549 % end 4545 if numel(list_str)>=IndexObj 4546 list_str(IndexObj)=[]; 4547 end 4550 4548 set(huvmat,'UserData',UvData); 4551 4549 set(hlist_object,'String',list_str) … … 4837 4835 %------------------------------------------------------------------------ 4838 4836 %% desactivate concurrent tools 4837 set(handles.MenuRuler,'checked','off')%desactivate ruler 4839 4838 hgeometry_calib=findobj(allchild(0),'tag','geometry_calib');% search the GUI geometric calibration 4840 4839 if ishandle(hgeometry_calib) … … 4945 4944 function MenuCalib_Callback(hObject, eventdata, handles) 4946 4945 %------------------------------------------------------------------------ 4947 4946 %% suppress the second field if exists 4947 if get(handles.SubField,'Value') 4948 set(handles.SubField,'Value',0) 4949 SubField_Callback(hObject, eventdata, handles) 4950 end 4948 4951 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4949 4952 4950 %suppress competing options 4953 %% suppress competing tools 4954 set(handles.MenuRuler,'checked','off')%desactivate ruler 4951 4955 set(handles.CheckZoom,'Value',0) 4952 4956 set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7]) 4953 set(handles.ListObject,'Value',1) 4954 % initiate display of GUI geometry_calib 4957 set(handles.ListObject,'Value',1) 4958 4959 %% initiate display of the GUI geometry_calib 4955 4960 data=[]; %default 4956 4961 if isfield(UvData,'CoordType') … … 4964 4969 set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action 4965 4970 4971 4972 % -------------------------------------------------------------------- 4973 % --- set the slice plane ro the set of slice planes when volume scan is used 4974 function MenuSetSlice_Callback(hObject, eventdata, handles) 4975 % -------------------------------------------------------------------- 4976 %% suppress the second input field if exists 4977 if get(handles.SubField,'Value') 4978 set(handles.SubField,'Value',0) 4979 SubField_Callback(hObject, eventdata, handles) 4980 end 4981 4982 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4983 check=0; 4984 if isfield(UvData,'XmlData')&&isfield(UvData.XmlData{1},'GeometryCalib')&& isfield(UvData.XmlData{1}.GeometryCalib,'SliceCoord') 4985 GeometryCalib=UvData.XmlData{1}.GeometryCalib; 4986 SliceCoord=GeometryCalib.SliceCoord; 4987 else 4988 msgbox_uvmat('ERROR','3D geometric calibration needed before defining slices') 4989 return 4990 end 4991 NbSlice_j=1;%default 4992 Z=SliceCoord(:,3); 4993 % index=index(ind_dim); 4994 %set the Z position of the reference plane used for calibration 4995 if isequal(max(Z),min(Z))%Z constant 4996 Z_plane=Z(1); 4997 GeometryCalib.NbSlice=1; 4998 GeometryCalib.SliceCoord=[0 0 Z_plane]; 4999 end 5000 ZStart=SliceCoord(1,3);% first Z coordinate present in the calibration file 5001 ZEnd=SliceCoord(end,3);% last Z coordinate present in the calibration file 5002 volume_scan='n'; 5003 if isfield(UvData,'XmlData') 5004 if isfield(UvData.XmlData{1},'TranslationMotor') 5005 NbSlice_j=UvData.XmlData.TranslationMotor.Nbslice; 5006 ZStart=UvData.XmlData.TranslationMotor.ZStart/10; 5007 ZEnd=UvData.XmlData.TranslationMotor.ZEnd/10; 5008 volume_scan='y'; 5009 end 5010 end 5011 input_key={'Z (first position)','Z (last position)','Z (water surface)', 'refractive index','NbSlice','volume scan (y/n)','tilt angle y axis','tilt angle x axis'}; 5012 input_val=[{num2str(ZEnd)} {num2str(ZStart)} {num2str(ZStart)} {'1.333'} num2str(NbSlice_j) {volume_scan} {'0'} {'0'}]; 5013 answer=inputdlg(input_key,'slice position(s)',ones(1,8), input_val,'on'); 5014 GeometryCalib.NbSlice=str2double(answer{5}); 5015 GeometryCalib.VolumeScan=answer{6}; 5016 if isempty(answer) 5017 Z_plane=0; %default 5018 else 5019 Z_plane=linspace(str2double(answer{1}),str2double(answer{2}),GeometryCalib.NbSlice); 5020 end 5021 GeometryCalib.SliceCoord=Z_plane'*[0 0 1]; 5022 GeometryCalib.SliceAngle(:,3)=0; 5023 GeometryCalib.SliceAngle(:,2)=str2double(answer{7})*ones(GeometryCalib.NbSlice,1);%rotation around y axis (to generalise) 5024 GeometryCalib.SliceAngle(:,1)=str2double(answer{8})*ones(GeometryCalib.NbSlice,1);%rotation around x axis (to generalise) 5025 GeometryCalib.InterfaceCoord=[0 0 str2double(answer{3})]; 5026 GeometryCalib.RefractionIndex=str2double(answer{4}); 5027 5028 %% store the result in the xml file used for calibration 5029 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 5030 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];%name of the xml file for calibration 5031 [RootPath,SubDir,RootFile,tild,tild,tild,tild,FileExt]=fileparts_uvmat(FileName); 5032 XmlFile=find_imadoc(RootPath,SubDir,RootFile,FileExt); 5033 errormsg=update_imadoc(GeometryCalib,XmlFile,'GeometryCalib');% introduce the calibration data in the xml file 5034 if ~strcmp(errormsg,'') 5035 msgbox_uvmat('ERROR',errormsg); 5036 end 5037 5038 %% display image with new calibration in the currently opened uvmat interface 5039 set(handles.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' to plot the whole image 5040 InputFileREFRESH_Callback(hObject,eventdata,handles); %file input with xml reading in uvmat, show the image in phys coordinates 4966 5041 4967 5042 %----------------------------------------------------------------------- … … 5234 5309 function MenuRuler_Callback(hObject, eventdata, handles) 5235 5310 %------------------------------------------------------------------------ 5236 set(handles.CheckZoom,'Value',0) 5237 CheckZoom_Callback(handles.uvmat, [], handles) 5238 set(handles.MenuRuler,'checked','on') 5239 UvData=get(handles.uvmat,'UserData'); 5240 UvData.MouseAction='ruler'; 5241 set(handles.uvmat,'UserData',UvData); 5311 if strcmp(get(handles.MenuRuler,'checked'),'on') 5312 set(handles.MenuRuler,'checked','off')%desactivate if activated 5313 else 5314 set(handles.MenuRuler,'checked','on')%activate if selected 5315 set(handles.CheckZoom,'Value',0) 5316 CheckZoom_Callback(handles.uvmat, [], handles) 5317 UvData=get(handles.uvmat,'UserData'); 5318 UvData.MouseAction='ruler'; 5319 set(handles.uvmat,'UserData',UvData); 5320 end 5242 5321 5243 5322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 5453 5532 end 5454 5533 5455 5534 % -------------------------------------------------------------------- 5456 5535 % --- Executes on button press in CheckTable. 5536 % -------------------------------------------------------------------- 5457 5537 function CheckTable_Callback(hObject, eventdata, handles) 5458 5538 if get(handles.CheckTable,'Value')
Note: See TracChangeset
for help on using the changeset viewer.