Changeset 937 for trunk/src/series.m


Ignore:
Timestamp:
Mar 30, 2016, 11:04:43 PM (8 years ago)
Author:
sommeria
Message:

various upgrades

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r935 r937  
    467467%% look for the previously opened file 'oldfile'
    468468InputTable=get(handles.InputTable,'Data');
    469 RootPathCell=InputTable(:,1);
    470 SubDirCell=InputTable(:,2);
     469if ~isempty(InputTable)
    471470oldfile=fullfile(InputTable{1,1},InputTable{1,2});
    472 if isempty(oldfile)
     471else
    473472    % use a file name stored in prefdir
    474473    dir_perso=prefdir;
     
    476475    if exist(profil_perso,'file')
    477476        h=load (profil_perso);
    478         if isfield(h,'RootPath') && ischar(h.RootPath)
    479             oldfile=h.RootPath;
     477        if isfield(h,'MenuCampaign') && ~isempty(h.MenuCampaign)&& ischar(h.MenuCampaign{1})
     478            oldfile=h.MenuCampaign{1};
    480479        end
    481480    end
     
    519518REFRESH_Callback(hObject, eventdata, handles)
    520519
    521 
    522 % %------------------------------------------------------------------------
    523 % % --- fct activated by the browser under 'Open campaign/Browse...'
    524 % %------------------------------------------------------------------------
    525 % function MenuBrowseCampaignAppend_Callback(hObject, eventdata, handles)
    526 % append='append';
    527 % browse_campaign(handles,append);
    528 
    529 % %------------------------------------------------------------------------
    530 % function browse_campaign(handles,append);
    531 %
    532 % %% look for the previously opened file 'oldfile'
    533 %
    534 % %
    535 % %
    536 % % InputTable=get(handles.InputTable,'Data');
    537 % % RootPath=InputTable{1,1};
    538 % % CampaignPath=fileparts(fileparts(RootPath));
    539 % % DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir');
    540 % % if ~ischar(DirFull)|| ~exist(DirFull,'dir')
    541 % %     return
    542 % % end
    543 % OutPut=browse_data(oldfile);% open the GUI browse_data to get select a campaign dir, experiment and device
    544 % if ~isfield(OutPut,'Campaign')
    545 %     return
    546 % end
    547 % DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
    548 % ListStruct=dir(DirName); %list files and the dir DataSeries
    549 % % select the first appropriate file in the dir
    550 % FileName='';
    551 % for ilist=1:numel(ListStruct)
    552 %     if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir
    553 %         FileName=ListStruct(ilist).name;
    554 %         FileInfo=get_file_info(fullfile(DirName,FileName));
    555 %         switch FileInfo.FileType
    556 %             case {'image','multimage','civx','civdata','netcdf'}
    557 %                 break
    558 %         end
    559 %     end
    560 % end
    561 % if isempty(FileName)
    562 %     msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)])
    563 %     return
    564 % end
    565 %
    566 % %% update the list of campaigns in the menubar
    567 % MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};...
    568 %     {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}];
    569 % check_dir=isempty(find(strcmp(DirName,MenuCampaign)));
    570 % if check_dir %insert the new campaign in the list if it is not found
    571 %     MenuCampaign(end)=[]; %suppress the last item
    572 %     MenuCampaign=[{DirName};MenuCampaign];%insert the new campaign
    573 %     for ilist=1:numel(MenuCampaign)
    574 %         set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist})
    575 %     end
    576 %     % save the list for future opening:
    577 %     dir_perso=prefdir;
    578 %     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    579 %     if exist(profil_perso,'file')
    580 %         save (profil_perso,'MenuCampaign','-append'); %store the file names for future opening of uvmat
    581 %     else
    582 %         save (profil_perso,'MenuCampaign','-V6'); %store the file names for future opening of uvmat
    583 %     end
    584 % end
    585 %
    586 % %% display the selected field and related information
    587 % if get(handles.CheckAppend,'Value')
    588 %     display_file_name(handles,fullfile(DirName,FileName),'append')
    589 % else
    590 %     display_file_name(handles,fullfile(DirName,FileName),'one')
    591 % end
    592 % set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
    593 
    594520% --------------------------------------------------------------------
    595521function MenuCampaign_Callback(hObject, eventdata, handles)
    596522% --------------------------------------------------------------------
    597 set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])
     523
    598524OutPut=browse_data(get(hObject,'Label'),'on','on');% open the GUI browse_data to get select a campaign dir, experiment and device
    599525if ~isfield(OutPut,'Campaign')
     
    636562set(handles.InputTable,'Data',InputTable)
    637563REFRESH_Callback(hObject, eventdata, handles)
    638 
    639 
    640 % DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
    641 % hdir=dir(DirName); %list files and dirs
    642 % for ilist=1:numel(hdir)
    643 %     if ~isequal(hdir(ilist).isdir,1)%look for files, not dir
    644 %         FileName=hdir(ilist).name;
    645 %         FileInfo=get_file_info(fullfile(DirName,FileName));
    646 %         switch FileInfo.FileType
    647 %             case {'image','multimage','civx','civdata','netcdf'}
    648 %             break
    649 %         end
    650 %     end
    651 % end
    652 % if get(handles.CheckAppend,'Value')
    653 %     display_file_name(handles,fullfile(DirName,FileName),'append')
    654 % else
    655 %     display_file_name(handles,fullfile(DirName,FileName),'one')
    656 % end
    657 % set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
    658564
    659565
     
    816722
    817723%% enable other menus and uicontrols
    818 set(handles.MenuOpenCampaign,'Enable','on')
     724% set(handles.MenuOpenCampaign,'Enable','on')
    819725set(handles.MenuCampaign_1,'Enable','on')
    820726set(handles.MenuCampaign_2,'Enable','on')
     
    1006912ref_i=1;
    1007913if isfield(SeriesData,'ref_i')
    1008 ref_i=SeriesData.ref_i;
     914    ref_i=SeriesData.ref_i;
    1009915end
    1010916if isempty(first_i)
     
    1019925ref_j=1;
    1020926if isfield(SeriesData,'ref_j')
    1021 ref_j=SeriesData.ref_j;
     927    ref_j=SeriesData.ref_j;
    1022928end
    1023929if isempty(first_j)
     
    1046952    last_j=first_j;
    1047953end
    1048 set(handles.num_first_i,'String',num2str(first_i)); 
     954set(handles.num_first_i,'String',num2str(first_i));
    1049955set(handles.num_first_j,'String',num2str(first_j));
    1050 set(handles.num_last_i,'String',num2str(last_i)); 
     956set(handles.num_last_i,'String',num2str(last_i));
    1051957set(handles.num_last_j,'String',num2str(last_j));
    1052958
    1053959%% number of slices set by default
    1054 NbSlice=1;%default
     960NbSlice=[];%default
    1055961% read  value set by the first series for the append mode (iwiew >1)
    1056962if iview>1 && strcmp(get(handles.num_NbSlice,'Visible'),'on')
    1057     NbSlice=str2num(get(handles.num_NbSlice,'String'));
     963    NbSlice=str2double(get(handles.num_NbSlice,'String'));
    1058964end
    1059965
     
    1061967TimeUnit='';
    1062968% read  value set by the first series for the append mode (iwiew >1)
    1063 if iview>1 
     969if iview>1
    1064970    TimeUnit=get(handles.TimeUnit,'String');
    1065971end
     
    1078984    [XmlData,errormsg]=imadoc2struct(XmlFileName);
    1079985    if ~isempty(errormsg)
    1080          msgbox_uvmat('WARNING',['error in reading ' XmlFileName ': ' errormsg]);
     986        msgbox_uvmat('WARNING',['error in reading ' XmlFileName ': ' errormsg]);
    1081987    end
    1082988    % read time if available
    1083989    if isfield(XmlData,'Time')
    1084          Time=XmlData.Time;
     990        Time=XmlData.Time;
    1085991        TimeName='xml';
    1086992    end
    1087993    if isfield(XmlData,'Camera')
    1088         if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice)
    1089             if iview>1 && ~isempty(NbSlice) && ~strcmp(NbSlice,XmlData.Camera.NbSlice)
    1090                 msgbox_uvmat('WARNING','inconsistent number of slices with the first field series');
    1091             end
    1092             NbSlice=XmlData.Camera.NbSlice;% Nbre of slices from camera
    1093         end
     994        %         if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice)
     995        %             if iview>1 && ~isempty(NbSlice) && ~strcmp(NbSlice,XmlData.Camera.NbSlice)
     996        %                 msgbox_uvmat('WARNING','inconsistent number of slices with the first field series');
     997        %             end
     998        %             NbSlice=XmlData.Camera.NbSlice;% Nbre of slices from camera
     999        %         end
    10941000        if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit)
    10951001            if iview>1 && ~isempty(TimeUnit) && ~strcmp(TimeUnit,XmlData.Camera.TimeUnit)
     
    11001006    end
    11011007    % number of slices
     1008    if isfield(XmlData,'TranslationMotor')&& isfield(XmlData.TranslationMotor,'NbSlice')
     1009        NbSlice_motor=XmlData.TranslationMotor.NbSlice;
     1010        if ~isempty(NbSlice) && ~isequal(NbSlice_motor,NbSlice)
     1011                msgbox_uvmat('WARNING','inconsistent Z numbers of Z indices');
     1012        else
     1013            NbSlice=NbSlice_motor;
     1014        end
     1015    end
     1016   
    11021017    if isfield(XmlData,'GeometryCalib')
    11031018        check_calib=1;
    11041019        if isfield(XmlData.GeometryCalib,'SliceCoord')
    11051020            siz=size(XmlData.GeometryCalib.SliceCoord);
    1106             if siz(1)>1
    1107                 if iview>1 && ~isempty(NbSlice) && ~strcmp(NbSlice,siz(1))
    1108                     msgbox_uvmat('WARNING','inconsistent number of Z indices with the first field series');
    1109                 end
     1021            if ~isempty(NbSlice)&& ~isequal(size(1),NbSlice)
     1022                msgbox_uvmat('WARNING','inconsistent numbers of Z indices between motor and calibration');
     1023            else
    11101024                NbSlice=siz(1);
    11111025            end
    11121026        end
    11131027    end
    1114     set(handles.num_NbSlice,'String',num2str(NbSlice))
     1028end
     1029if ~isempty(NbSlice)
     1030set(handles.num_NbSlice,'String',num2str(NbSlice))
     1031set(handles.num_NbSlice,'Visible','on')
    11151032end
    11161033
     
    20131930                    '#!/bin/bash \n'...
    20141931                    '. /etc/sysprofile \n'...
     1932                    'module load matlab/8.6 \n'...% CHOICE OF MATLAB VERSION
    20151933                    'matlab -nodisplay -nosplash -nojvm -logfile ''' filelog{iprocess} ''' <<END_MATLAB \n'...
    20161934                    'addpath(''' path_series '''); \n'...
Note: See TracChangeset for help on using the changeset viewer.