Changeset 1184 for trunk/src/series.m


Ignore:
Timestamp:
Nov 6, 2025, 7:03:02 PM (4 weeks ago)
Author:
sommeria
Message:

bed-scan updated and many updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r1183 r1184  
    134134%% Read the parameter file series.xml, or created from series.xml.default if it does not exist
    135135SeriesData=[];
    136 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series
     136path_series=fileparts(which('series'));% path to the GUI series
    137137xmlfile=fullfile(path_series,'series.xml');
    138138if ~exist(xmlfile,'file')
     
    157157NbBuiltinAction=numel(ActionList);
    158158set(handles.Action,'UserData',NbBuiltinAction)
    159 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series'
    160 [path_series,name,ext]=fileparts(which('series')); % path to the GUI series
     159%path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series'
     160[path_series]=fileparts(which('series')); % path to the GUI series
    161161path_series_fct=fullfile(path_series,'series'); % path of the functions in subdirectroy 'series'
    162162ActionExtList={'.m';'.sh';'fluidimage'}; % default choice of extensions (Matlab fct .m or compiled version .sh
     
    166166if isfield(SeriesData.ClusterParam, 'ExistenceTest')
    167167    oarcommand=SeriesData.ClusterParam.ExistenceTest;
    168     [s,w]=system(oarcommand); % look for cluster system presence
     168    s=system(oarcommand); % look for cluster system presence
    169169    if isequal(s,0)% cluster detected
    170170        RunModeList=[RunModeList;{'cluster'}];
     
    275275    %% fill the list of input file series
    276276    InputTable=[{Param.InputFile.RootPath},{Param.InputFile.SubDir},{Param.InputFile.RootFile},{Param.InputFile.NomType},{Param.InputFile.FileExt}];
    277     if isempty(find(cellfun('isempty',InputTable)==0)) % if there is no input file, do not introduce input info
     277    if isempty(find(cellfun('isempty',InputTable)==0,1)) % if there is no input file, do not introduce input info
    278278        set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
    279279        return
    280280    end
    281     TimeTable=[{Param.InputFile.TimeName},{[]},{[]},{[]},{[]}];
     281   % TimeTable=[{Param.InputFile.TimeName},{[]},{[]},{[]},{[]}];
    282282    if isfield(Param.InputFile,'RootPath_1')
    283283        InputTable=[InputTable;[{Param.InputFile.RootPath_1},{Param.InputFile.SubDir_1},{Param.InputFile.RootFile_1},{Param.InputFile.NomType_1},{Param.InputFile.FileExt_1}]];
    284         TimeTable=[TimeTable; [{Param.InputFile.TimeName_1},{[]},{[]},{[]},{[]}]];
     284       % TimeTable=[TimeTable; [{Param.InputFile.TimeName_1},{[]},{[]},{[]},{[]}]];
    285285    end
    286286    set(handles.InputTable,'Data',InputTable)
     
    291291    set(handles.Device,'String',[Device DeviceExt])
    292292    set(handles.Experiment,'String',[Experiment ExperimentExt])
    293     if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)'))
     293    if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)','once'))
    294294    set(handles.OutputPathBrowse,'Value',1)% an output folder needs to be specified for OpenDAP data
    295295    end
     
    308308    %% determine the selected reference field indices for pair display
    309309
    310     [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(Param.InputFile.FileIndex);
    311     if isempty(i1)
    312         i1=1;
    313     end
    314     if isempty(i2)
    315         i2=i1;
    316     end
     310  %  [~,~,~,i1,i2,j1,j2]=fileparts_uvmat(Param.InputFile.FileIndex);
     311  i1=1;j1=1;%default
     312    if isfield(Param,'i1')
     313        i1=Param.i1;
     314    end
     315    if isfield(Param,'j1')
     316        j1=Param.j1;
     317    end
     318    if isfield(Param,'i2')
     319        i2=Param.i2;
     320    end
     321    if isfield(Param,'j2')
     322        j2=Param.j2;
     323    end
     324   
    317325    ref_i=floor((i1+i2)/2); % reference image number corresponding to the file
    318326    % set(handles.num_ref_i,'String',num2str(ref_i));
     
    609617%% update MinIndex_i and MaxIndex_i if the input table content has been reduced in line nbre
    610618MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex
    611 if ~isempty(MinIndex_i_table)
    612619set(handles.MinIndex_i,'Data',MinIndex_i_table(1:nbview,:));
    613 end
    614620MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex
    615 if ~isempty(MinIndex_j_table)
    616621set(handles.MinIndex_j,'Data',MinIndex_j_table(1:nbview,:));
    617 end
    618622MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex
    619 if ~isempty(MaxIndex_i_table)
     623
    620624set(handles.MaxIndex_i,'Data',MaxIndex_i_table(1:nbview,:));
    621 end
    622625MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex
    623 if ~isempty(MaxIndex_j_table)
    624626set(handles.MaxIndex_j,'Data',MaxIndex_j_table(1:nbview,:));
    625 end
    626627PairString=get(handles.PairString,'Data'); % retrieve the min indices in the table MinIndex
    627 if ~isempty(PairString)
    628628set(handles.PairString,'Data',PairString(1:nbview,:));
    629 end
    630629TimeTable=get(handles.TimeTable,'Data'); % retrieve the min indices in the table MinIndex
    631 if ~isempty(TimeTable)
    632630set(handles.TimeTable,'Data',TimeTable(1:nbview,:));
    633 end
    634631
    635632%% set length of waitbar
     
    861858
    862859%% display the min and max indices for the whole file series
    863 if size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0
     860if isempty(i1_series)
     861    MinIndex_j=1;MaxIndex_j=1;MinIndex_i=1;MaxIndex_i=1;
     862elseif size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0
    864863    MinIndex_j=1; % index j set to 1 by default
    865864    MaxIndex_j=1;
     
    988987XmlData=[];
    989988check_calib=0;
    990 
    991989XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2});
    992990if ~isempty(XmlFileName)
     
    996994    end
    997995    % read time if available
    998     if isfield(XmlData,'Time') && strcmp(FileInfo.FieldType,'image')
     996    if isfield(XmlData,'Time')
    999997        Time=XmlData.Time;
    1000998        TimeName='xml';
     
    13101308end
    13111309PairString=get(handles.PairString,'Data');
    1312 ref_i_1=str2num(get(handles.num_first_i,'String')); % first reference index
    1313 ref_i_2=str2num(get(handles.num_last_i,'String')); % last reference index
    1314 ref_j_1=[];ref_j_2=[];
     1310ref_i_1=str2double(get(handles.num_first_i,'String')); % first reference index
     1311if isnan(ref_i_1)
     1312ref_i_1=1;
     1313end
     1314ref_i_2=str2double(get(handles.num_last_i,'String')); % last reference index
     1315if isnan(ref_i_2)
     1316ref_i_2=1;
     1317end
     1318ref_j_1=NaN;ref_j_2=NaN;
    13151319if strcmp(get(handles.num_first_j,'Visible'),'on')
    1316 ref_j_1=str2num(get(handles.num_first_j,'String'));
    1317 ref_j_2=str2num(get(handles.num_last_j,'String'));
     1320    ref_j_1=str2double(get(handles.num_first_j,'String'));
     1321    ref_j_2=str2double(get(handles.num_last_j,'String'));
    13181322end
    13191323[i1_1,i2_1,j1_1,j2_1] = get_file_index(ref_i_1,ref_j_1,PairString);
     
    14291433
    14301434function errormsg=launch_action(handles)
    1431 errormsg=''; % default
     1435%errormsg=''; % default
    14321436
    14331437%% read the data on the GUI series
     
    16371641        end
    16381642    end
    1639     [xx,ExpName]=fileparts(Param.InputTable{1,1});
    1640     Param.IndexRange.first_i=str2num(get(handles.num_first_i,'String'));%reset the firrst_i and last_i for multiple experiments, modified by the splitting into NbProcess
    1641     Param.IndexRange.last_i=str2num(get(handles.num_last_i,'String'));
     1643    [~,ExpName]=fileparts(Param.InputTable{1,1});
     1644    Param.IndexRange.first_i=str2double(get(handles.num_first_i,'String'));%reset the firrst_i and last_i for multiple experiments, modified by the splitting into NbProcess
     1645    Param.IndexRange.last_i=str2double(get(handles.num_last_i,'String'));
    16421646
    16431647    %% create the output data directory if needed, after checking its existence
     
    16551659        else
    16561660            PathExpOut=fullfile(PathOut,get(handles.Experiment,'String'));
    1657             PathExpDeviceOut=fullfile(PathExpOut,get(handles.Device,'String'))
     1661            PathExpDeviceOut=fullfile(PathExpOut,get(handles.Device,'String'));
    16581662        end
    16591663        if ~exist(PathExpOut,'dir')
    1660             [tild,msg1]=mkdir(PathExpOut);
     1664            [~,msg1]=mkdir(PathExpOut);
    16611665            if ~strcmp(msg1,'')
    16621666                errormsg=['cannot create ' PathExpOut ': ' msg1]; % error message for directory creation
     
    16651669        end
    16661670        if ~exist(PathExpDeviceOut,'dir')
    1667             [tild,msg1]=mkdir(PathExpDeviceOut);
     1671            [~,msg1]=mkdir(PathExpDeviceOut);
    16681672            if ~strcmp(msg1,'')
    16691673                errormsg=['cannot create ' PathExpDeviceOut ': ' msg1]; % error message for directory creation
     
    17101714        OutputDir=fullfile(PathExpDeviceOut,[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory
    17111715        if check_create    % create output directory if it does not exist
    1712             [tild,msg1]=mkdir(OutputDir);
     1716            [~,msg1]=mkdir(OutputDir);
    17131717            if ~strcmp(msg1,'')
    17141718                errormsg=['cannot create ' OutputDir ': ' msg1]; % error message for directory creation
     
    17841788        else
    17851789            ref_j=first_j:incr_j:last_j;
    1786             [tild,ref_i]=find(squeeze(SeriesData.i1_series{1}(1,:,:)));
     1790            [~,ref_i]=find(squeeze(SeriesData.i1_series{1}(1,:,:)));
    17871791            ref_i=ref_i-1;
    17881792            ref_i=ref_i(ref_i>=first_i & ref_i<=last_i);
     
    17921796        ref_i=first_i:incr_i:last_i;
    17931797        if isempty(incr_j)% automatic finding of the existing j indices
    1794             [ref_j,tild]=find(squeeze(SeriesData.i1_series{1}(1,:,:)));
     1798            ref_j=find(squeeze(SeriesData.i1_series{1}(1,:,:)));
    17951799            ref_j=ref_j-1;
    17961800            ref_j=ref_j(ref_j>=first_j & ref_j<=last_j);
     
    18091813            else
    18101814                answer=msgbox_uvmat('INPUT_TXT','estimate the CPU time(in minutes) for each value of index i:' ,'');
    1811                 CPUTime=str2num(answer);
     1815                CPUTime=str2double(answer);
    18121816                set(handles.num_CPUTime,'String',answer)
    18131817                Param.Action.CPUTime=CPUTime;
     
    20912095                cd(curdir)
    20922096            else
    2093                 [tild,msg1]=mkdir(DIR_CLUSTER);
     2097                [~,msg1]=mkdir(DIR_CLUSTER);
    20942098                if ~strcmp(msg1,'')
    20952099                    errormsg=['cannot create ' DIR_CLUSTER ': ' msg1]; % error message for directory creation
     
    21862190                cd(curdir)
    21872191            else
    2188                 [tild,msg1]=mkdir(DirSGE);
     2192                [~,msg1]=mkdir(DirSGE);
    21892193                if ~strcmp(msg1,'')
    21902194                    errormsg=['cannot create ' DirSGE ': ' msg1]; % error message for directory creation
     
    22112215                        cmd=[cmd ActionFullName ' /softs/matlab ' filexml{imgsInJob(ii)} '\n'];
    22122216                    end
    2213                     [fid, message] = fopen([DirSGE '/job' num2str(currJobIndex) '.sh'], 'w');
     2217                    fid = fopen([DirSGE '/job' num2str(currJobIndex) '.sh'], 'w');
    22142218                    fprintf(fid, cmd);
    22152219                    fclose(fid);
     
    22212225                        fullfile([DirSGE '/job' num2str(currJobIndex) '.sh'])];
    22222226                    fprintf(sge_command); % display in command line
    2223                     [status, result] = system(sge_command);
     2227                    [~, result] = system(sge_command);
    22242228                    fprintf(result);
    22252229                    currJobIndex = currJobIndex + 1;
     
    22352239            command = ['python -m fluidimage.run_from_xml ' filexml{iprocess}];
    22362240            fprintf(['command:\n' command '\n\n'])
    2237             [status, result] = call_command_clean(command);
     2241          %  [status, result] = call_command_clean(command);
    22382242    end
    22392243    if exist(OutputDir,'dir')
    2240         [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir);
     2244        [~,MESSAGE] = fileattrib (OutputDir);
    22412245        if MESSAGE.GroupWrite~=1
    22422246            [success,msg] = fileattrib(OutputDir,'+w','g','s'); % allow writing access for the group of users, recursively in the folder
     
    23932397%% Put the first line of the selected Action fct as tooltip help
    23942398try
    2395     [fid,errormsg] =fopen([fullfile(ActionPath,ActionName) '.m']);
     2399    fid=fopen([fullfile(ActionPath,ActionName) '.m']);
    23962400    InputText=textscan(fid,'%s',1,'delimiter','\n');
    23972401    fclose(fid);
     
    28772881        set(handles.FieldName,'String',[FieldListInit; FieldList; {'add_field...'}]);
    28782882        if ~strcmp(GetFieldData.FieldOption,'civdata...')
    2879            if ~isempty(regexp(FieldList{1},'^vec'))
     2883           if ~isempty(regexp(FieldList{1},'^vec', 'once'))
    28802884                set(handles.FieldName,'Value',1)
    28812885           else
     
    30313035            datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date); % dates of creation
    30323036        end
    3033         [datenew,indsort2]=sort(datepair); % sort the multiplet by creation date
     3037        [~,indsort2]=sort(datepair); % sort the multiplet by creation date
    30343038        ind_s=indsort2(1:end-1); %
    30353039        ind_remove=[ind_remove ind_pairs(ind_s)]; % remove these indices, leave the last one
     
    30583062    num_j1=meshgrid(num_j,ones(size(num_i1_line)));
    30593063    num_j2=meshgrid(num_j,ones(size(num_i1_line)));
    3060     [xx,num_i1]=meshgrid(num_j,num_i1_line);
    3061     [xx,num_i2]=meshgrid(num_j,num_i2_line);
     3064    [~,num_i1]=meshgrid(num_j,num_i1_line);
     3065    [~,num_i2]=meshgrid(num_j,num_i2_line);
    30623066elseif isequal (mode,'series(Dj)')||isequal (mode,'bursts')
    30633067    if isequal(mode,'bursts') %case of bursts (png_old or png_2D)
     
    32003204    MaskTable=cell(NbView,2);
    32013205   
    3202     RootPath=Param.InputTable{1,1};
     3206    %RootPath=Param.InputTable{1,1};
    32033207    first_j=[];% note that the function will propose to cover the whole range of indices
    32043208    if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
    3205     last_j=[];
     3209   %last_j=[];
    32063210    if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end
    32073211    PairString='';
     
    32143218            Param.InputTable{iview,5},Param.InputTable{iview,4},i1,i2,j1,j2);
    32153219       
    3216         [FileInfo,VideoObject]=get_file_info(FirstFileName);
     3220       % [FileInfo,VideoObject]=get_file_info(FirstFileName);
    32173221       
    32183222       
     
    34223426%% use a browser to choose the xml file containing the processing config
    34233427InputTable=get(handles.InputTable,'Data');
    3424 oldfile='';
    3425 if isempty(InputTable)
    3426     oldfile='';
    3427 else
    34283428oldfile=InputTable{1,1}; % current path in InputTable
    3429 end
    34303429if isempty(oldfile)
    34313430    % use a file name stored in prefdir
Note: See TracChangeset for help on using the changeset viewer.