Changeset 710 for trunk/src/uvmat.m


Ignore:
Timestamp:
Feb 16, 2014, 5:35:45 PM (10 years ago)
Author:
sommeria
Message:

various improvements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r709 r710  
    210210set(hObject,'DeleteFcn',{@closefcn})%
    211211set(hObject,'ResizeFcn',{@ResizeFcn,handles})%
     212% set(handles.RootPath,'ButtonDownFcn',{'@mouse_down_control'})%set mouse click action function
    212213
    213214%% initialisation
     
    319320% --- Outputs from this function are returned to the command menuline.
    320321function varargout = uvmat_OutputFcn(hObject, eventdata, handles)
     322%------------------------------------------------------------------------   
    321323varargout{1} = handles.output;% the only output argument is the handle to the GUI figure
    322324
     
    325327function closefcn(gcbo,eventdata)
    326328%------------------------------------------------------------------------
     329% delete GUI 'view_field' if detected
    327330hh=findobj(allchild(0),'tag','view_field');
    328331if ~isempty(hh)
    329332    delete(hh)
    330333end
     334% delete GUI 'geometry_calib' if detected
    331335hh=findobj(allchild(0),'tag','geometry_calib');
    332336if ~isempty(hh)
    333337    delete(hh)
    334338end
     339% desable set_object editing action if detected
    335340hh=findobj(allchild(0),'tag','set_object');
    336341if ~isempty(hh)
    337342    hhh=findobj(hh,'tag','PLOT');
    338343    set(hhh,'enable','off')
     344end
     345%delete the bowser if detected
     346hh=findobj(allchild(0),'tag','browser');
     347if ~isempty(hh)
     348    delete(hh)
    339349end
    340350
     
    450460else
    451461
    452 %% display the selected field and related information
    453 if ~isempty(fileinput)
    454     set(handles.SubField,'Value',0)
    455     desable_subfield(handles)
    456     display_file_name(handles,fileinput)
    457 end
     462    %% display the selected field and related information
     463    if ~isempty(fileinput)
     464        set(handles.SubField,'Value',0)
     465        desable_subfield(handles)
     466        display_file_name(handles,fileinput)
     467    end
    458468end
    459469
     
    564574
    565575%------------------------------------------------------------------------
    566 % --- Called by action in RootPath edit box
    567 function RootPath_Callback(hObject,eventdata,handles)
    568 %------------------------------------------------------------------------
    569 % read the current input file name:
    570 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    571 if ~exist(fullfile(RootPath,SubDir),'dir')
    572     msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
    573     return
    574 end
    575 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
    576 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
    577 % initiate the input file series and refresh the current field view:
    578 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,1);
    579 
    580 %-----------------------------------------------------------------------
    581 % --- Called by action in RootPath_1 edit box
    582 function RootPath_1_Callback(hObject,eventdata,handles)
    583 % -----------------------------------------------------------------------
    584 % update_rootinfo_1(hObject,eventdata,handles)
    585 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
    586 if ~exist(fullfile(RootPath,SubDir),'dir')
    587     msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
    588     return
    589 end
    590 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
    591 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
    592 % initiate the input file series and refresh the current field view:
    593 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,2);
    594 
    595 %------------------------------------------------------------------------
    596 % --- Called by action in RootFile edit box
    597 function SubDir_Callback(hObject, eventdata, handles)
    598 %------------------------------------------------------------------------
    599 %refresh the menu of input fieldname
    600 FieldName_Callback(hObject, eventdata, handles);
    601 % refresh the current field view
    602 run0_Callback(hObject, eventdata, handles);
    603 
    604 %------------------------------------------------------------------------
    605 % --- Called by action in RootFile edit box
    606 function RootFile_Callback(hObject, eventdata, handles)
    607 %------------------------------------------------------------------------
    608 RootPath_Callback(hObject,eventdata,handles)
    609 
    610 %-----------------------------------------------------------------------
    611 % --- Called by action in RootFile_1 edit box
    612 function RootFile_1_Callback(hObject, eventdata, handles)
    613 % -----------------------------------------------------------------------
    614 RootPath_1_Callback(hObject,eventdata,handles)
    615 
    616 %------------------------------------------------------------------------
    617576% --- Called by action in FileIndex edit box
    618577function FileIndex_Callback(hObject, eventdata, handles)
     
    624583set(handles.j2,'String',num2str(j2));
    625584
    626 % refresh the current field view
    627 run0_Callback(hObject, eventdata, handles)
    628 
    629 %------------------------------------------------------------------------
    630 % --- Called by action in FileIndex_1 edit box
    631 function FileIndex_1_Callback(hObject, eventdata, handles)
    632 %------------------------------------------------------------------------
    633 run0_Callback(hObject, eventdata, handles)
    634585
    635586%------------------------------------------------------------------------
     
    658609% refresh the current settings and refresh the field view
    659610RootPath_1_Callback(hObject,eventdata,handles)
     611
     612%------------------------------------------------------------------------
     613% --- Executes on button press in REFRESH.
     614function REFRESH_Callback(hObject, eventdata, handles)
     615%------------------------------------------------------------------------   
     616set(handles.REFRESH,'BackgroundColor',[1 1 0])% set button color to yellow to indicate that refresh is under action
     617% read the current input file name:
     618[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
     619% if ~exist(fullfile(RootPath,SubDir),'dir')
     620%     msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
     621%     return
     622% end
     623% detect the file type, get the movie object if relevant, and look for the corresponding file series:
     624[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
     625% initiate the input file series and refresh the current field view:
     626errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,1);
     627% refresh the second series if selected
     628if get(handles.SubField,'Value')
     629    [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
     630    if ~exist(fullfile(RootPath,SubDir),'dir')
     631        msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
     632        return
     633    end
     634    % detect the file type, get the movie object if relevant, and look for the corresponding file series:
     635    [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
     636    % initiate the input file series and refresh the current field view:
     637    errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,2);
     638end
     639
     640if isempty(errormsg)
     641set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red to indicate that refresh has been updated
     642else
     643    set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
     644end
    660645
    661646%------------------------------------------------------------------------
     
    696681    set(handles.TimeValue_1,'Visible','on')
    697682end
    698 set(handles_RootPath,'BackgroundColor',[1 1 0])% paint edit box to yellow to visualise root file input
     683set(handles.REFRESH,'BackgroundColor',[1 1 0])% paint REFRESH button to yellow to visualise root file input
    699684set(handles.uvmat,'Pointer','watch') % set the mouse pointer to 'watch'
    700685drawnow
     
    840825end
    841826
    842 set(handles_RootPath,'BackgroundColor',[1 1 1])% paint back edit box to white to visualise end of root file input
     827set(handles.REFRESH,'BackgroundColor',[1 0 0])% paint back button to red to indicate update is finished
    843828set(handles.uvmat,'Pointer','arrow')% set back the mouse pointer to arrow
    844829
     
    847832% --- Update information about a new field series (indices to scan, timing,
    848833%     calibration from an xml file, then refresh current plots
    849 
    850 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,VideoObject,index)
    851 %------------------------------------------------------------------------
     834function errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,VideoObject,index)
     835%------------------------------------------------------------------------
     836errormsg=''; %default error msg
    852837%% define the relevant handles depending on the index (1=first file series, 2= second file series)
    853838if ~exist('index','var')
     
    878863FileBase=fullfile(RootPath,RootFile);
    879864if ~exist(FileName,'file')
    880    msgbox_uvmat('ERROR',['input file ' FileName ' not found']);
     865    errormsg=['input file ' FileName ' not found'];
     866   msgbox_uvmat('ERROR',errormsg);   
    881867    return
    882868end
     
    930916NbSlice=1;%default
    931917ImaDoc_str='';
    932 set(handles.RootPath,'BackgroundColor',[1 1 1])
     918set(handles.REFRESH,'BackgroundColor',[1 1 0])
    933919if ~isempty(XmlFileName)
    934920    set(handles.view_xml,'Visible','on')
     
    13701356    end
    13711357    Mask.Path=MaskPath;
    1372     Mask.File=MaskFile{1};
     1358    if isempty(MaskFile)
     1359        Mask.File='';
     1360    else
     1361        Mask.File=MaskFile{1};
     1362    end
    13731363    Mask.Ext=MaskExt;
    13741364    Mask.NomType=MaskNomType;
     
    19801970set(handles.j2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
    19811971set(handles.FileIndex,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
    1982 while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue')%isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command
     1972while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') % enable STOP command
    19831973    % read and plot the series of images in non erase mode
    19841974    set(hima,'CData',Field_b.A);
     
    48414831[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
    48424832FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
    4843 set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib
    4844 % pos_uvmat=get(handles.uvmat,'Position');
    4845 % pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3);
    4846 % pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4);
    4847 % pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4);
     4833set(handles.view_xml,'BackgroundColor',[1 1 0])%indicate the reading of the current xml file by geometry_calib
    48484834geometry_calib(FileName);% call the geometry_calib interface   
    4849 set(handles.view_xml,'Backgroundcolor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib
     4835set(handles.view_xml,'BackgroundColor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib
    48504836set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action
    48514837
     
    48794865    ObjectData=UvData.ProjObject(val);
    48804866    for iobj=1:length(ObjectData)
    4881 %         if isfield(ObjectData{iobj},'Coord')
    48824867            xA(iobj)=ObjectData{iobj}.Coord(1,1);
    48834868            yA(iobj)=ObjectData{iobj}.Coord(1,2);
    48844869            xB(iobj)=ObjectData{iobj}.Coord(2,1);
    48854870            yB(iobj)=ObjectData{iobj}.Coord(2,2);
    4886 %         end
    48874871    end
    48884872end
     
    50655049            end
    50665050        end
    5067 %     end
    50685051    %mask name
    50695052    RootPath=get(handles.RootPath,'String');
     
    50765059    masknumber=num2str(length(list));
    50775060    maskindex=get(handles.masklevel,'Value');
    5078    % mask_name=fullfile_uvmat(RootPath,'',[RootFile '_' masknumber 'mask'],'.png','_1',maskindex);
    50795061    mask_name=fullfile_uvmat(RootPath,[SubDir '.mask'],'mask','.png','_1',maskindex);
    50805062    imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200)
     
    51105092set(handles.edit_vect,'Value',0)
    51115093edit_vect_Callback(hObject, eventdata, handles)
    5112 % set(handles.CheckEditObject,'BackgroundColor',[0.7 0.7 0.7])
    51135094set(handles.ListObject,'Value',1)     
    51145095
Note: See TracChangeset for help on using the changeset viewer.