Changeset 606 for trunk/src/series.m


Ignore:
Timestamp:
Apr 7, 2013, 10:14:45 AM (8 years ago)
Author:
sommeria
Message:

bug on compilation solved (still to test with transform_field fct). faster browser inrtroduced. Various bug corrections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r605 r606  
    258258function MenuBrowse_Callback(hObject, eventdata, handles)
    259259%------------------------------------------------------------------------   
     260%get the previous input file in the Input Table
     261oldfile=''; %default
    260262InputTable=get(handles.InputTable,'Data');
    261 if isempty(InputTable)
    262     RootPathCell={};
    263 else
    264     RootPathCell=InputTable(:,1);
    265 end
    266 oldfile=''; %default
    267 if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box
    268      dir_perso=prefdir;
    269      profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    270      if exist(profil_perso,'file')
    271           h=load (profil_perso);
    272          if isfield(h,'filebase')&&ischar(h.filebase)
    273                  oldfile=h.filebase;
    274          end
    275          if isfield(h,'RootPath')&&ischar(h.RootPath)
    276                  oldfile=h.RootPath;
    277          end
    278      end
    279 else
    280      SubDirCell=InputTable(:,2);
    281     RootFileCell=InputTable(:,3);
    282      oldfile=fullfile(RootPathCell{1},SubDirCell{1},RootFileCell{1});
    283  end
    284 [FileName, PathName] = uigetfile( ...
    285        {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)';
    286        '*.xml',  '.xml files '; ...
    287         '*.xls',  '.xls files '; ...
    288         '*.png','.png image files'; ...
    289         '*.tif','.tif image files'; ...
    290         '*.avi;*.AVI','.avi movie files'; ...
    291         '*.nc','.netcdf files'; ...
    292         '*.*',  'All Files (*.*)'}, ...
    293         'Pick a file',oldfile);
    294 fileinput=[PathName FileName];%complete file name
    295 if isempty(fileinput),return;end %abandon if no file is introduced by the browser
    296 [path,name,ext]=fileparts(fileinput);
    297 if isequal(ext,'.xml')
    298     [Param,Heading]=xml2struct(fileinput);
    299     if ~strcmp(Heading,'Series')
    300         msg_box_uvmat('ERROR','xml file heading is not <Series>')
    301     else
    302         fill_GUI(Param,handles.series);%fill the GUI with the parameters retrieved from the xml file
    303         if isfield(Param,'CheckObject')&& Param.CheckObject
    304             set_object(Param.ProjObject)
    305         end
    306         set(handles.REFRESH,'UserData',1:size(Param.InputTable,1))
    307         REFRESH_Callback([],[], handles)
    308         return
    309     end
    310 elseif isequal(ext,'.xls')
    311     msg_box_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer
    312 else
     263if isequal(InputTable(:,1),[{''};{''};{''};{''}])%open the personal file for empty previous input
     264    dir_perso=prefdir;
     265    profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     266    if exist(profil_perso,'file')
     267         h=load (profil_perso);
     268        if isfield(h,'RootPath')&&ischar(h.RootPath)
     269            oldfile=h.RootPath;
     270        end
     271    end
     272else% select the previous file as the first line of the input table
     273    oldfile=fullfile(InputTable{1,1},InputTable{1,2},InputTable{1,3});
     274end
     275hfig=uigetfile_uvmat('file browser',fileparts(fileparts(oldfile)));
     276uiwait(hfig);
     277if ishandle(hfig) % stop if browser closed without selection
     278    fileinput=get(hfig,'UserData');% retrieve the input file selection
     279    delete(hfig)
    313280    display_file_name(handles,fileinput,0)
    314281end
     282%
     283% [FileName, PathName] = uigetfile( ...
     284%        {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)';
     285%        '*.xml',  '.xml files '; ...
     286%         '*.xls',  '.xls files '; ...
     287%         '*.png','.png image files'; ...
     288%         '*.tif','.tif image files'; ...
     289%         '*.avi;*.AVI','.avi movie files'; ...
     290%         '*.nc','.netcdf files'; ...
     291%         '*.*',  'All Files (*.*)'}, ...
     292%         'Pick a file',oldfile);
     293% fileinput=[PathName FileName];%complete file name
     294% [path,name,ext]=fileparts(fileinput);
     295% if isequal(ext,'.xml')
     296%     [Param,Heading]=xml2struct(fileinput);
     297%     if ~strcmp(Heading,'Series')
     298%         msg_box_uvmat('ERROR','xml file heading is not <Series>')
     299%     else
     300%         fill_GUI(Param,handles.series);%fill the GUI with the parameters retrieved from the xml file
     301%         if isfield(Param,'CheckObject')&& Param.CheckObject
     302%             set_object(Param.ProjObject)
     303%         end
     304%         set(handles.REFRESH,'UserData',1:size(Param.InputTable,1))
     305%         REFRESH_Callback([],[], handles)
     306%         return
     307%     end
     308% elseif isequal(ext,'.xls')
     309%     msg_box_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer
     310% else
     311%     display_file_name(handles,fileinput,0)
     312% end
    315313
    316314% --------------------------------------------------------------------
     
    20062004end
    20072005set(handles.FieldTransform,'Visible',FieldTransformVisible)
     2006if isfield(ParamOut,'TransformPath')
     2007    set(handles.ActionExt,'UserData',ParamOut.TransformPath)
     2008else
     2009    set(handles.ActionExt,'UserData',[])
     2010end
    20082011
    20092012%% Visibility of projection object
     
    22272230function CheckObject_Callback(hObject, eventdata, handles)
    22282231%------------------------------------------------------------------------
     2232hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle
    22292233value=get(handles.CheckObject,'Value');
    22302234if value
    2231 %      set(handles.CheckObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow
    2232      hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle
    2233      if ishandle(hset_object)
    2234          uistack(hset_object,'top')% show the GUI set_object if opened
    2235      else
    2236          %get the object file
    2237          InputTable=get(handles.InputTable,'Data');
    2238          defaultname=InputTable{1,1};
    2239          if isempty(defaultname)
    2240             defaultname={''};
    2241          end
    2242         [FileName, PathName] = uigetfile( ...
    2243        {'*.xml;*.mat', ' (*.xml,*.mat)';
    2244        '*.xml',  '.xml files '; ...
    2245         '*.mat',  '.mat matlab files '}, ...
    2246         'Pick an xml object file (or use uvmat to create it)',defaultname);
    2247         fileinput=[PathName FileName];%complete file name
    2248         sizf=size(fileinput);
    2249         if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
    2250         %read the file
    2251         data=xml2struct(fileinput);
    2252         if ~isfield(data,'Type')
    2253              msgbox_uvmat('ERROR',[fileinput ' is not an object xml file'])
    2254              return
    2255         end
    2256         if ~isfield(data,'ProjMode')
    2257              data.ProjMode='none';
    2258         end
    2259         hset_object=set_object(data);% call the set_object interface
    2260      end
    2261      ProjObject=read_GUI(hset_object);
    2262      set(handles.ProjObject,'String',ProjObject.Name);%display the object name
    2263      SeriesData=get(handles.series,'UserData');
    2264      SeriesData.ProjObject=ProjObject;
    2265      set(handles.series,'UserData',SeriesData);
    2266      set(handles.DeleteObject,'Visible','on');
    2267      set(handles.ViewObject,'Visible','on');
    2268      set(handles.ProjObject,'Visible','on');
     2235    SeriesData=get(handles.series,'UserData');
     2236    if ~(isfield(SeriesData,'ProjObject')&&~isempty(SeriesData.ProjObject))
     2237        if ishandle(hset_object)
     2238            uistack(hset_object,'top')% show the GUI set_object if opened
     2239        else
     2240            %get the object file
     2241            InputTable=get(handles.InputTable,'Data');
     2242            defaultname=InputTable{1,1};
     2243            if isempty(defaultname)
     2244                defaultname={''};
     2245            end
     2246            [FileName, PathName] = uigetfile( ...
     2247                {'*.xml;*.mat', ' (*.xml,*.mat)';
     2248                '*.xml',  '.xml files '; ...
     2249                '*.mat',  '.mat matlab files '}, ...
     2250                'Pick an xml object file (or use uvmat to create it)',defaultname);
     2251            fileinput=[PathName FileName];%complete file name
     2252            sizf=size(fileinput);
     2253            if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
     2254            %read the file
     2255            data=xml2struct(fileinput);
     2256            if ~isfield(data,'Type')
     2257                msgbox_uvmat('ERROR',[fileinput ' is not an object xml file'])
     2258                return
     2259            end
     2260            if ~isfield(data,'ProjMode')
     2261                data.ProjMode='none';
     2262            end
     2263            hset_object=set_object(data);% call the set_object interface
     2264        end
     2265        ProjObject=read_GUI(hset_object);
     2266        set(handles.ProjObject,'String',ProjObject.Name);%display the object name
     2267        SeriesData=get(handles.series,'UserData');
     2268        SeriesData.ProjObject=ProjObject;
     2269        set(handles.series,'UserData',SeriesData);
     2270    end
     2271    set(handles.DeleteObject,'Visible','on');
     2272    set(handles.ViewObject,'Visible','on');
     2273    set(handles.ProjObject,'Visible','on');
    22692274else
    2270          set(handles.DeleteObject,'Visible','off');
    2271      set(handles.ViewObject,'Visible','off');
    2272      set(handles.ProjObject,'Visible','off');
    2273 %     set(handles.CheckObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green
     2275    set(handles.DeleteObject,'Visible','off');
     2276    set(handles.ViewObject,'Visible','off');
     2277    if ~ishandle(hset_object)
     2278    set(handles.ViewObject,'Value',0);
     2279    end
     2280    set(handles.ProjObject,'Visible','off');
    22742281end
    22752282%set(handles.series,'UserData',SeriesData)
     
    24652472        uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
    24662473        uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status);
    2467         hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI);
     2474        uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI);
    24682475        %set(hrefresh,'UserData',StatusData)
    24692476        BarPosition=[0.05 0.81 0.01 0.05];
     
    24712478        drawnow
    24722479    end
    2473     refresh_GUI(hrefresh,[])
     2480    refresh_GUI(hfig)
    24742481else
    24752482    %% delete current display fig if selection is off
     
    25262533%------------------------------------------------------------------------   
    25272534% launched by refreshing the status figure
    2528 function refresh_GUI(hObject, eventdata)
    2529 %------------------------------------------------------------------------
    2530 hfig=get(hObject,'parent');
     2535function refresh_GUI(hfig)
     2536%------------------------------------------------------------------------
    25312537htitlebox=findobj(hfig,'tag','titlebox');
    25322538hlist=findobj(hfig,'tag','list');
     
    25562562ListDisplay=ListDisplay(datnum~=0);
    25572563datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files
     2564NbOutputFile=[];
    25582565if isempty(datnum)
    25592566    if testrecent
     
    26762683ActionList=get(handles.ActionName,'String');
    26772684ActionName=ActionList{get(handles.ActionName,'Value')};
     2685TransformPath='';
     2686if ~isempty(get(handles.ActionExt,'UserData'))
     2687    TransformPath=get(handles.ActionExt,'UserData');
     2688end
    26782689if strcmp(ActionExt,'.sh')
     2690    set(handles.ActionExt,'BackgroundColor',[1 1 0])
    26792691    ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']);
    26802692    if ~exist(ActionFullName,'file')
    26812693        answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?');
    26822694        if strcmp(answer,'Yes')
     2695            set(handles.ActionExt,'BackgroundColor',[1 1 0])
     2696            path_uvmat=fileparts(which('series'));
    26832697            currentdir=pwd;
    2684             cd(get(handles.ActionPath,'String'))
    2685             compile(ActionName)
     2698            cd(get(handles.ActionPath,'String'))% go to the directory of Action
     2699            %  addpath(get(handles.TransformPath,'String'))
     2700            addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
     2701           % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
     2702            compile(ActionName,TransformPath)
    26862703            cd(currentdir)
    26872704        end
    2688     end
    2689     sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']));
    2690     m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
    2691     if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
    2692         set(handles.ActionExt,'BackgroundColor',[1 1 0])
    2693         drawnow
    2694         answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
    2695         if strcmp(answer,'Yes')
    2696             currentdir=pwd;
    2697             cd(get(handles.ActionPath,'String'))
    2698             compile(ActionName)
    2699             cd(currentdir)
    2700         end
    2701         set(handles.ActionExt,'BackgroundColor',[1 1 1])
    2702     end
     2705       
     2706    else
     2707        sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']));
     2708        m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
     2709        if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
     2710            set(handles.ActionExt,'BackgroundColor',[1 1 0])
     2711            drawnow
     2712            answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
     2713            if strcmp(answer,'Yes')
     2714                path_uvmat=fileparts(which('series'));
     2715                currentdir=pwd;
     2716                cd(get(handles.ActionPath,'String'))% go to the directory of Action
     2717                %  addpath(get(handles.TransformPath,'String'))
     2718                addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
     2719                addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
     2720                compile(ActionName,TransformPath)
     2721                cd(currentdir)
     2722            end
     2723        end
     2724    end
     2725    set(handles.ActionExt,'BackgroundColor',[1 1 1])
    27032726end
    27042727
     
    27172740    set(handles.DeleteObject,'Visible','off')
    27182741    set(handles.ViewObject,'Visible','off')
     2742    set(handles.DeleteObject,'Value',0)
    27192743end
    27202744
Note: See TracChangeset for help on using the changeset viewer.