Changeset 591 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 25, 2013, 5:43:18 PM (8 years ago)
Author:
sommeria
Message:

various updates, in particular modification of series to do calculations in the cluster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r589 r591  
    3434%                       .PosSetObject: position of set_object
    3535%                       .PosGeometryCalib: size of set_object
    36 %                       .NbBuiltin: nbre of functions always displayed in transform_fct menu
     36%                       .NbBuiltin: nbre of functions always displayed in TransformName menu
    3737%          .Object: cell array of structures representing the current projection objects, as produced by 'set_object.m'={[]} by default
    3838%          .NewSeries: =0/1 flag telling whether a new field series has been opened
     
    215215end
    216216
    217 %% load the list of previously browsed files in menus Open, Open_1 and transform_fct
     217%% load the list of previously browsed files in menus Open, Open_1 and TransformName
    218218 dir_perso=prefdir; % path to the directory .matlab containing the personal data of the current user
    219219 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmat_perso.mat' in .matlab
     
    240240 end
    241241transform_menu=[transform_menu;{'more...'}];%append the option more.. to the menu
    242 set(handles.transform_fct,'String',transform_menu)% display the menu of transform fcts
    243 set(handles.transform_fct,'UserData',path_list)% store the corresponding list of path in UserData of uicontrol transform_fct
    244 set(handles.path_transform,'String','')
    245 set(handles.path_transform,'UserData',[])
     242set(handles.TransformName,'String',transform_menu)% display the menu of transform fcts
     243set(handles.TransformName,'UserData',path_list)% store the corresponding list of path in UserData of uicontrol transform_fct
     244set(handles.TransformPath,'String','')
     245set(handles.TransformPath,'UserData',[])
    246246
    247247%% case of an input argument for uvmat
     
    973973        set(handles.pxcm,'String','')
    974974        set(handles.pycm,'String','')
    975         set(handles.transform_fct,'Value',1); %  no transform by default
     975        set(handles.TransformName,'Value',1); %  no transform by default
    976976    else
    977977        if (isfield(GeometryCalib,'R')&& ~isequal(GeometryCalib.R(2,1),0) && ~isequal(GeometryCalib.R(1,2),0)) ||...
     
    986986        end
    987987        if ~get(handles.CheckFixLimits,'Value')
    988             set(handles.transform_fct,'Value',3); % phys transform by default if fixedLimits is off
     988            set(handles.TransformName,'Value',3); % phys transform by default if fixedLimits is off
    989989        end
    990990        if isfield(GeometryCalib,'SliceCoord')           
     
    11081108
    11091109%% apply the effect of the transform fct and view the field 
    1110 transform=get(handles.path_transform,'UserData');
     1110transform=get(handles.TransformPath,'UserData');
    11111111if index==2 && (~isa(transform,'function_handle')||nargin(transform)<3)
    1112     set(handles.transform_fct,'value',2); % set transform to sub_field if the current fct doe not accept two input fields
    1113 end
    1114 transform_fct_Callback([],[],handles)
     1112    set(handles.TransformName,'value',2); % set transform to sub_field if the current fct doe not accept two input fields
     1113end
     1114TransformName_Callback([],[],handles)
    11151115mask_test=get(handles.CheckMask,'value');
    11161116if mask_test
     
    14131413        end
    14141414        %px to phys or other transform on field
    1415          menu_transform=get(handles.transform_fct,'String');
    1416         choice_value=get(handles.transform_fct,'Value');
     1415         menu_transform=get(handles.TransformName,'String');
     1416        choice_value=get(handles.TransformName,'Value');
    14171417        transform_name=menu_transform{choice_value};%name of the transform fct  given by the menu 'transform_fct'
    1418         transform=get(handles.path_transform,'UserData');
     1418        transform=get(handles.TransformPath,'UserData');
    14191419        if  ~isequal(transform_name,'') && ~isequal(transform_name,'px')
    14201420            if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
     
    19471947
    19481948%px to phys or other transform on field
    1949 transform=get(handles.path_transform,'UserData');
     1949transform=get(handles.TransformPath,'UserData');
    19501950if  ~isempty(transform)
    19511951    if isfield(UvData,'XmlData') && numel(UvData.XmlData)>=index %use geometry calib recorded from the ImaDoc xml file as first priority
     
    24202420
    24212421%% apply coordinate transform or other user fct
    2422 transform=get(handles.path_transform,'UserData');
     2422transform=get(handles.TransformPath,'UserData');
    24232423if isempty(transform)
    24242424    UvData.Field=Field{1};
     
    24322432        end
    24332433    end
    2434     transform=get(handles.path_transform,'UserData');
     2434    transform=get(handles.TransformPath,'UserData');
    24352435    switch nargin(transform)
    24362436        case 4
     
    29992999    end
    30003000    set(handles.uvmat,'UserData',UvData);
    3001     transform_fct_list=get(handles.transform_fct,'String');
    3002     transform_fct=transform_fct_list(get(handles.transform_fct,'Value'));
     3001    transform_fct_list=get(handles.TransformName,'String');
     3002    transform_fct=transform_fct_list(get(handles.TransformName,'Value'));
    30033003    if strcmp(transform_fct,'sub_field')
    3004         set(handles.transform_fct,'Value',1)%suppress the sub_field transform
     3004        set(handles.TransformName,'Value',1)%suppress the sub_field transform
    30053005        transform_fct_Callback(hObject, eventdata, handles);
    30063006    else
     
    33013301            UvData.FileType{2}=UvData.FileType{1};
    33023302            UvData.XmlData{2}= UvData.XmlData{1};
    3303             transform=get(handles.path_transform,'UserData');
     3303            transform=get(handles.TransformPath,'UserData');
    33043304             if (~isa(transform,'function_handle')||nargin(transform)<3)
    33053305                set(handles.uvmat,'UserData',UvData)
    3306                 set(handles.transform_fct,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields
     3306                set(handles.TransformName,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields
    33073307                transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current plot
    33083308                 check_refresh=0;
     
    34003400     UvData.XmlData{2}= UvData.XmlData{1};
    34013401     set(handles.SubField,'Value',1)
    3402      transform=get(handles.path_transform,'UserData');
     3402     transform=get(handles.TransformPath,'UserData');
    34033403     if (~isa(transform,'function_handle')||nargin(transform)<3)
    34043404        set(handles.uvmat,'UserData',UvData)
    3405         set(handles.transform_fct,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields
     3405        set(handles.TransformName,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields
    34063406        transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current plot
    34073407     else
     
    36063606%------------------------------------------------------------------
    36073607%-------------------------------------------------------------
    3608 % --- Executes on selection change in transform_fct.
    3609 
    3610 function transform_fct_Callback(hObject, eventdata, handles)
     3608% --- Executes on selection change in TransformName.
     3609
     3610function TransformName_Callback(hObject, eventdata, handles)
    36113611%-------------------------------------------------------------
    36123612UvData=get(handles.uvmat,'UserData');
    3613 menu=get(handles.transform_fct,'String');refresh
    3614 ichoice=get(handles.transform_fct,'Value');%item number in the menu
     3613menu=get(handles.TransformName,'String');refresh
     3614ichoice=get(handles.TransformName,'Value');%item number in the menu
    36153615transform_name=menu{ichoice};% choice of the transform fct
    3616 list_path=get(handles.transform_fct,'UserData');
     3616list_path=get(handles.TransformName,'UserData');
    36173617
    36183618%% add a new item to the menu if the option 'more...' has been selected
    3619 prev_path=fullfile(get(handles.path_transform,'String'));
     3619prev_path=fullfile(get(handles.TransformPath,'String'));
    36203620if ~exist(prev_path,'dir')
    36213621    prev_path=fullfile(fileparts(which('uvmat')),'transform_field');
     
    36413641    end
    36423642    list_path{ichoice}=PathName;%update the list fo fct paths
    3643     set(handles.transform_fct,'String',menu)
    3644     set(handles.transform_fct,'Value',ichoice)
     3643    set(handles.TransformName,'String',menu)
     3644    set(handles.TransformName,'Value',ichoice)
    36453645   
    36463646    % save the new menu in the personal file 'uvmat_perso.mat'
     
    36723672    cd(current_dir)
    36733673end
    3674 set(handles.path_transform,'String',list_path{ichoice})
    3675 set(handles.path_transform,'UserData',transform_handle)
    3676 set(handles.transform_fct,'UserData',list_path)
    3677 
    3678 %% update the ToolTip string of the menu transform_fct with the first line of the selected fct file
     3674set(handles.TransformPath,'String',list_path{ichoice})
     3675set(handles.TransformPath,'UserData',transform_handle)
     3676set(handles.TransformName,'UserData',list_path)
     3677
     3678%% update the ToolTip string of the menu TransformName with the first line of the selected fct file
    36793679if isempty(list_path{ichoice})% case of no selected fct
    3680     set(handles.transform_fct,'ToolTipString','transform_fct:choose a transform function')
     3680    set(handles.TransformName,'ToolTipString','transform_fct:choose a transform function')
    36813681else
    36823682    try
     
    36843684        InputText=textscan(fid,'%s',1,'delimiter','\n');
    36853685        fclose(fid)
    3686         set(handles.transform_fct,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help
     3686        set(handles.TransformName,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help
    36873687    end
    36883688end
     
    50665066FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
    50675067UvData=get(handles.uvmat,'UserData');
    5068 % CoordList=get(handles.transform_fct,'String');
    5069 % val=get(handles.transform_fct,'Value');
     5068% CoordList=get(handles.TransformName,'String');
     5069% val=get(handles.TransformName,'Value');
    50705070set_grid(FileName,UvData.Field);% call the set_object interface
    50715071
     
    50895089function MenuSeries_Callback(hObject, eventdata, handles)
    50905090%------------------------------------------------------------------------
    5091 series; %first display of the GUI to fill waiting time
    50925091[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
    50935092Param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];%first input file name
     
    51285127end
    51295128Param.index_fields_1=find(strcmp(FieldName_1,Param.list_fields_1));% selected string index
    5130 Param.transform_str=get(handles.transform_fct,'String');
    5131 Param.transform_val=get(handles.transform_fct,'Value');
     5129TransformList=get(handles.TransformName,'String');
     5130Param.TransformName=TransformList{get(handles.TransformName,'Value')};
    51325131Param.Coord_x_str=get(handles.Coord_x,'String');
    51335132Param.Coord_x_val=get(handles.Coord_x,'Value');
     
    51655164% --- Executes on button press in CheckColorBar.
    51665165function CheckColorBar_Callback(hObject, eventdata, handles)
     5166
     5167
     5168
     5169function TransformPath_Callback(hObject, eventdata, handles)
     5170% hObject    handle to TransformPath (see GCBO)
     5171% eventdata  reserved - to be defined in a future version of MATLAB
     5172% handles    structure with handles and user data (see GUIDATA)
     5173
     5174% Hints: get(hObject,'String') returns contents of TransformPath as text
     5175%        str2double(get(hObject,'String')) returns contents of TransformPath as a double
Note: See TracChangeset for help on using the changeset viewer.