Changeset 738 for trunk/src/uvmat.m


Ignore:
Timestamp:
Apr 14, 2014, 11:41:21 AM (10 years ago)
Author:
sommeria
Message:

various bug resolutions and improvements in particular with geometry_calib. Introduction of a tool set_slices in uvmat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r735 r738  
    38113811
    38123812%% delete drawn objects if the output CooordUnit is different from the previous one
    3813 if ~strcmp(CoordUnit,CoordUnitPrev)
     3813if  ~strcmp(CoordUnit,CoordUnitPrev)
    38143814    set(handles.CheckFixLimits,'Value',0)
    3815 % set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
    38163815    hother=findobj('Tag','proj_object');%find all the proj objects
    38173816    for iobj=1:length(hother)
     
    45444543    UvData.ProjObject(IndexObj)=[];
    45454544end
    4546     if ~isempty(list_str)
    4547         list_str(IndexObj)=[];
    4548     end
    4549 % end
     4545if numel(list_str)>=IndexObj
     4546    list_str(IndexObj)=[];
     4547end
    45504548set(huvmat,'UserData',UvData);
    45514549set(hlist_object,'String',list_str)
     
    48374835%------------------------------------------------------------------------
    48384836%% desactivate concurrent tools
     4837set(handles.MenuRuler,'checked','off')%desactivate ruler
    48394838hgeometry_calib=findobj(allchild(0),'tag','geometry_calib');% search the GUI geometric calibration
    48404839if ishandle(hgeometry_calib)
     
    49454944function MenuCalib_Callback(hObject, eventdata, handles)
    49464945%------------------------------------------------------------------------
    4947 
     4946%% suppress the second field if exists
     4947if get(handles.SubField,'Value')
     4948    set(handles.SubField,'Value',0)
     4949    SubField_Callback(hObject, eventdata, handles)
     4950end
    49484951UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    49494952
    4950 %suppress competing options
     4953%% suppress competing tools
     4954set(handles.MenuRuler,'checked','off')%desactivate ruler
    49514955set(handles.CheckZoom,'Value',0)
    49524956set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
    4953 set(handles.ListObject,'Value',1)     
    4954 % initiate display of GUI geometry_calib
     4957set(handles.ListObject,'Value',1)
     4958
     4959%% initiate display of the GUI geometry_calib
    49554960data=[]; %default
    49564961if isfield(UvData,'CoordType')
     
    49644969set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action
    49654970
     4971
     4972% --------------------------------------------------------------------
     4973% --- set the slice plane ro the set of slice planes when volume scan is used
     4974function MenuSetSlice_Callback(hObject, eventdata, handles)
     4975% --------------------------------------------------------------------
     4976%% suppress the second input field if exists
     4977if get(handles.SubField,'Value')
     4978    set(handles.SubField,'Value',0)
     4979    SubField_Callback(hObject, eventdata, handles)
     4980end
     4981
     4982UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     4983check=0;
     4984if isfield(UvData,'XmlData')&&isfield(UvData.XmlData{1},'GeometryCalib')&& isfield(UvData.XmlData{1}.GeometryCalib,'SliceCoord')
     4985    GeometryCalib=UvData.XmlData{1}.GeometryCalib;
     4986    SliceCoord=GeometryCalib.SliceCoord;
     4987else
     4988    msgbox_uvmat('ERROR','3D geometric calibration needed before defining slices')
     4989    return
     4990end   
     4991NbSlice_j=1;%default
     4992Z=SliceCoord(:,3);
     4993% index=index(ind_dim);
     4994%set the Z position of the reference plane used for calibration
     4995if isequal(max(Z),min(Z))%Z constant
     4996    Z_plane=Z(1);
     4997    GeometryCalib.NbSlice=1;
     4998    GeometryCalib.SliceCoord=[0 0 Z_plane];
     4999end
     5000ZStart=SliceCoord(1,3);% first Z coordinate present in the calibration file
     5001ZEnd=SliceCoord(end,3);% last Z coordinate present in the calibration file
     5002volume_scan='n';
     5003if 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
     5010end     
     5011input_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'};
     5012input_val=[{num2str(ZEnd)} {num2str(ZStart)} {num2str(ZStart)} {'1.333'} num2str(NbSlice_j) {volume_scan} {'0'} {'0'}];
     5013answer=inputdlg(input_key,'slice position(s)',ones(1,8), input_val,'on');
     5014GeometryCalib.NbSlice=str2double(answer{5});
     5015GeometryCalib.VolumeScan=answer{6};
     5016if isempty(answer)
     5017    Z_plane=0; %default
     5018else
     5019    Z_plane=linspace(str2double(answer{1}),str2double(answer{2}),GeometryCalib.NbSlice);
     5020end
     5021GeometryCalib.SliceCoord=Z_plane'*[0 0 1];
     5022GeometryCalib.SliceAngle(:,3)=0;
     5023GeometryCalib.SliceAngle(:,2)=str2double(answer{7})*ones(GeometryCalib.NbSlice,1);%rotation around y axis (to generalise)
     5024GeometryCalib.SliceAngle(:,1)=str2double(answer{8})*ones(GeometryCalib.NbSlice,1);%rotation around x axis (to generalise)
     5025GeometryCalib.InterfaceCoord=[0 0 str2double(answer{3})];
     5026GeometryCalib.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);
     5030FileName=[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);
     5032XmlFile=find_imadoc(RootPath,SubDir,RootFile,FileExt);
     5033errormsg=update_imadoc(GeometryCalib,XmlFile,'GeometryCalib');% introduce the calibration data in the xml file
     5034if ~strcmp(errormsg,'')
     5035    msgbox_uvmat('ERROR',errormsg);
     5036end
     5037
     5038%% display image with new calibration in the currently opened uvmat interface
     5039set(handles.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' to plot the whole image
     5040InputFileREFRESH_Callback(hObject,eventdata,handles); %file input with xml reading  in uvmat, show the image in phys coordinates
    49665041
    49675042%-----------------------------------------------------------------------
     
    52345309function MenuRuler_Callback(hObject, eventdata, handles)
    52355310%------------------------------------------------------------------------
    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);
     5311if strcmp(get(handles.MenuRuler,'checked'),'on')
     5312    set(handles.MenuRuler,'checked','off')%desactivate if activated
     5313else
     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);
     5320end
    52425321
    52435322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    54535532end
    54545533
    5455 
     5534% --------------------------------------------------------------------
    54565535% --- Executes on button press in CheckTable.
     5536% --------------------------------------------------------------------
    54575537function CheckTable_Callback(hObject, eventdata, handles)
    54585538if get(handles.CheckTable,'Value')
Note: See TracChangeset for help on using the changeset viewer.