Changeset 1194 for trunk/src/series.m


Ignore:
Timestamp:
Feb 23, 2026, 3:58:54 PM (8 days ago)
Author:
sommeria
Message:

several bugs repaired

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r1193 r1194  
    650650        j1=str2double(get(handles.num_first_j,'String'));
    651651        j2=[];%default
    652         PairString=get(handles.PairString,'Data');
    653         if numel(PairString)>=iview
    654             r=regexp(PairString{iview},'(?<num1>\d+)-(?<num2>\d+)' ,'names');
    655             if ~isempty(r)
    656                 j1=str2double(r.num1);
    657                 j2=str2double(r.num2);
    658             end
    659         end
    660         InputFile=fullfile_uvmat('','',InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1,[],j1,j2);
     652%         PairString=get(handles.PairString,'Data');
     653%         if numel(PairString)>=iview
     654%             r=regexp(PairString{iview},'(?<num1>\d+)-(?<num2>\d+)' ,'names');
     655%             if ~isempty(r)
     656%                 j1=str2double(r.num1);
     657%                 j2=str2double(r.num2);
     658%             end
     659%         end
     660 InputFile=[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}];
     661        %InputFile=fullfile_uvmat('','',InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1,[],j1,j2);
    661662        [RootPath,~,RootFile,Param.i1_series,Param.i2_series,Param.j1_series,Param.j2_series,~,Param.FileInfo,MovieObject]=...
    662663            find_file_series(fullfile(InputTable{iview,1},InputTable{iview,2}),InputFile);
     
    814815    SeriesData.j1_series={};
    815816    SeriesData.j2_series={};
    816     SeriesData.FileType={};
     817 %   SeriesData.FileType={};
    817818    SeriesData.FileInfo={};
    818819    SeriesData.Time={};
     
    10671068
    10681069    %% get index range in case of relabeling
    1069     if ~isempty(Param.XmlData.Time)
     1070    if isfield(Param,'XmlData') && ~isempty(Param.XmlData.Time)
    10701071        Time=Param.XmlData.Time;
    10711072        MinIndex_i=1;
     
    10751076        TimeName='xml';
    10761077    else
    1077         [nbfield,nbfield_j]=size(XmlData.Time);
     1078        InputTable=get(handles.InputTable,'Data');
     1079        [XmlFileName,Rank]=find_imadoc(InputTable{iview,1},InputTable{iview,2});
     1080        if isempty(XmlFileName)
     1081            return
     1082        else
     1083            Param.XmlData=read_imadoc(XmlFileName);
     1084        end
     1085        [nbfield,nbfield_j]=size(Param.XmlData.Time);
    10781086        nbfield=nbfield-1; %remove the possible index 0
    10791087        nbfield_j=nbfield_j-1; %remove the possible index 0
     
    10891097        %i1=(first_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index
    10901098        i1=1;
    1091         if strcmp(SeriesData.TimeName,'xml')% indices i and j
     1099        if isfield(SeriesData,'TimeName') && strcmp(SeriesData.TimeName,'xml')% indices i and j
    10921100            j1=mod(i1-1,nbfield_j)+first_j;
    10931101            i1=floor((i1-1)/nbfield_j)+1;
     
    10961104    end
    10971105end
    1098 %     set(handles.num_first_i,'String',num2str(i1))
    1099 %     %         last_i=str2double(get(handles.num_last_i,'String'));
    1100 %     %         last_j=str2double(get(handles.num_last_j,'String'));
    1101 %     %         i1=(last_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index
    1102 %     %         if strcmp(SeriesData.TimeName,'xml')% indices i and j
    1103 %     %             j1=mod(i1-1,nbfield_j)+1;
    1104 %     %             i1=floor((i1-1)/nbfield_j)+1;
    1105 %     %         end
    1106 %     set(handles.num_last_i,'String',num2str(nbfield))
    1107 %     set(handles.num_last_j,'String',num2str(nbfield_j))
    1108 % % else
    1109 
    1110 
    1111 
    1112 
    1113 %     %% case of possible index relabeling from xml info
    1114 %     if isfield(XmlData,'FileSeries')&& strcmp(FileInfo.FileType,'multimage')
    1115 %         answer=msgbox_uvmat('INPUT_Y-N','relabel the frame  indices according to the xml info?');
    1116 %         if strcmp(answer,'Yes')
    1117 %             set(handles.Relabel,'Visible','on')
    1118 %             set(handles.Relabel,'Value',1)
    1119 %             SeriesData.FileSeries{iview}=XmlData.FileSeries;
    1120 %             TimeMin=Time(2,2);
    1121 %             TimeMax=Time(end,end);
    1122 %             TimeFirst=TimeMin;
    1123 %             TimeLast=TimeMax;
    1124 %         end
    1125 %     elseif iview==1
    1126 %         set(handles.Relabel,'Visible','off')
    1127 %     end
    11281106
    11291107if isfield(Param,'FileInfo') && ~isempty(Param.FileInfo) && strcmp(Param.FileInfo.FileType,'rdvision')
     
    11371115    end
    11381116    TimeMin=Time(MinIndex_i+1,MinIndex_j+1);
    1139 %     if size(Time)>=[first_i+1 first_j+1]
    1140 %         TimeFirst=Time(first_i+1,first_j+1);
    1141 %     end
    1142 %     if size(Time)>=[last_i+1 last_j+1]
    1143 %         TimeLast=Time(last_i+1,last_j+1);
    1144 %     end
    11451117    if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1]
    11461118        TimeMax=Time(MaxIndex_i+1,MaxIndex_j+1);
     
    12611233CheckPair= ~isempty(i2_series)||~isempty(j2_series); % check whether index pairs need to be defined
    12621234PairString=get(handles.PairString,'Data');
     1235PairString{iview,1}=''; % no pair for #iview by default
    12631236if CheckPair% if pairs need to be display for line iview
    12641237    [ModeMenu,ModeValue]=update_mode(i1_series,i2_series,j2_series);
    12651238    Menu=update_listpair(i1_series,i2_series,j1_series,j2_series,ModeMenu{ModeValue},Time,TimeUnit,ref_i,ref_j,TimeName,InputTable(iview,:),Param.FileInfo);
    1266     PairString{iview,1}=Menu{1};
    1267 else
    1268     PairString{iview,1}=''; % no pair for #iview
     1239    if numel(Menu)>=1
     1240        PairString{iview,1}=Menu{1};
     1241    end
    12691242end
    12701243set(handles.PairString,'Data',PairString)
     
    12821255Position=get(handles.FileStatus,'Position');
    12831256set(handles.FileStatus,'Units','normalized')
    1284 %xI=0.5:Position(3)-0.5;
    12851257nbview=numel(SeriesData.i1_series);
    1286 j_max=cell(1,nbview);
     1258i_max=cell(1,nbview);
    12871259MaxIndex_i=ones(1,nbview); % default
    12881260MinIndex_i=ones(1,nbview); % default
     1261missing_indices=cell(1,nbview);
    12891262for iline=1:nbview
    1290     pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); % max on pair index
    1291     j_max{iline}=max(pair_max,[],1); % max on j index
    1292     if ~isempty(j_max{iline})
    1293         MaxIndex_i(iline)=find(j_max{iline}, 1, 'last' )-1; % max ref index i
    1294         MinIndex_i(iline)=find(j_max{iline}, 1 )-1; % min ref index i
     1263    pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); % max i1 indices from i1_series (as obtained by fct uvmat/find_file_series.m)
     1264                                                            % needed in the case of mutiple pairs for the same index ref_i)
     1265    i_max{iline}=max(pair_max,[],1); % max on j index
     1266    if ~isempty(i_max{iline})&& ~isequal(pair_max,0)
     1267        MaxIndex_i(iline)=find(i_max{iline}, 1, 'last' )-1; % max ref index i
     1268        MinIndex_i(iline)=find(i_max{iline}, 1 )-1; % min ref index i
     1269         missing_indices{iline}= find(i_max{iline}(2:end)==0);         
    12951270    end
    12961271end
     
    12991274range_index=MaxIndex_i-MinIndex_i+1;
    13001275range_y=max(1,floor(Position(4)/nbview));
    1301 npx=floor(Position(3));
    1302 file_indices=MinIndex_i+floor(((0.5:npx-0.5)/npx)*range_index)+1;
    1303 CData=zeros(nbview*range_y,npx); % initiate the image representing the existing files
     1276npx=floor(Position(3));%length of the bar image FileStatus in pixels
     1277
     1278%file_indices=MinIndex_i+floor(((0.5:npx-0.5)/npx)*range_index)+1;
     1279CData=ones(nbview*range_y,npx); % initiate the image representing the existing files
     1280LineData=ones(1,npx);
    13041281for iline=1:nbview
    13051282    ind_y=1+(iline-1)*range_y:iline*range_y;
    1306     LineData=zeros(size(file_indices));
    1307     file_select=file_indices(file_indices<=numel(j_max{iline}));
    1308     ind_select=file_indices<=numel(j_max{iline});
    1309     LineData(ind_select)=j_max{iline}(file_select)~=0;
    1310     CData(ind_y,:)=ones(size(ind_y'))*LineData;
     1283    missing_pixels=floor((missing_indices{iline}-MinIndex_i+1)*npx/range_index)+1;
     1284    LineData(missing_pixels)=0;
     1285%     LineData=zeros(size(file_indices));
     1286%     file_select=file_indices(file_indices<=numel(i_max{iline}));
     1287%     ind_select=file_indices<=numel(i_max{iline});
     1288%     LineData(ind_select)=i_max{iline}(file_select)~=0;
     1289    CData(ind_y,:)=ones(numel(ind_y),1)*LineData;%create an image band with width numel(ind_y)
    13111290end
    13121291CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); % make color images r=0,g,b=0
     
    15201499if isempty(pos_last), pos_last=1; end
    15211500Position=get(handles.Waitbar,'Position'); % position of the waitbar:= [ x,y, width, height]
    1522 Position_status=get(handles.FileStatus,'Position');
     1501Position_status=get(handles.FileStatus,'Position');% position of the FileStatus bar:= [ x,y, width, height]
    15231502Position(1)=Position_status(1)+Position_status(3)*pos_first;
    15241503Position(3)=max(Position_status(3)*(pos_last-pos_first),0.001); % width must remain positive
     
    26422621    end
    26432622    if  VelTypeRequest_1 && numel(iview_civ)>=2
    2644         menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileType{iview_civ(2)});
     2623        menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileInfo{iview_civ(2)}.FileType);
    26452624        set(handles.VelType_1,'Value',1)% set first choice by default
    26462625        set(handles.VelType_1,'String',[{'*'};menu])
     
    29962975    FieldListInit(field_index(1))=[];
    29972976    SeriesData=get(handles.series,'UserData');
     2977    for iview=1:numel(SeriesData.FileInfo)
     2978    FileType{iview}=SeriesData.FileInfo{iview}.FileType;
     2979    end
    29982980    % input line for which the field choice is relevant
    2999     iview=find(ismember(SeriesData.FileType,{'netcdf','civx','civdata'})); % all nc files, icluding civ
     2981    iview=find(ismember(FileType,{'netcdf','civx','civdata'})); % all nc files, icluding civ
    30002982    hget_field=findobj(allchild(0),'name','get_field');
    30012983    if ~isempty(hget_field)
     
    31523134    end
    31533135    Param=read_GUI(handles.series);
    3154     InputTable=Param.InputTable(2,:);
     3136    %InputTable=Param.InputTable(2,:);
    31553137    % check the existence of the first file in the series
    31563138    first_j=[];
     
    41944176check_input_file_series(handles,CheckRelabel)
    41954177ActionInput_Callback([],[], handles)
    4196 % if get(handles.Relabel,'Value')
    4197 %             NomType='*';
    4198 %             i1=1;i2=[];j1=1;j2=[];
    4199 %             i1_series=1:size(XmlData.Time,1)-1;   
    4200 %             i2_series=[];
    4201 %             j1_series=1:size(XmlData.Time,2)-1;
    4202 %             j2_series=[];
    4203 %
    4204 %
    4205 %
    4206 %     SeriesData=get(handles.series,'UserData');
    4207 %     if isfield(SeriesData,'FileSeries')&& ~isempty(SeriesData.FileSeries{1})
    4208 %         [nbfield,nbfield_j]=size(SeriesData.Time{1});
    4209 %         nbfield=nbfield-1; %remove the possible index 0
    4210 %         nbfield_j=nbfield_j-1; %remove the possible index 0
    4211 %         MaxIndex_i=get(handles.MaxIndex_i,'Data');
    4212 %         MaxIndex_j=get(handles.MaxIndex_j,'Data');
    4213 %         MaxIndex_i(1,:)=nbfield;
    4214 %         MaxIndex_j(1,:)=nbfield_j;
    4215 %                 MinIndex_i(1,:)=1;
    4216 %         MinIndex_j(1,:)=1;
    4217 %         set(handles.MaxIndex_i,'Data',MaxIndex_i)
    4218 %         set(handles.MaxIndex_j,'Data',MaxIndex_j)
    4219 %          set(handles.MinIndex_i,'Data',MinIndex_i)
    4220 %         set(handles.MinIndex_j,'Data',MinIndex_j)
    4221 %         first_i=str2double(get(handles.num_first_i,'String'));
    4222 %         first_j=str2double(get(handles.num_first_j,'String'));
    4223 %         %i1=(first_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index
    4224 %         i1=1;
    4225 %         if strcmp(SeriesData.TimeName,'xml')% indices i and j
    4226 %             j1=mod(i1-1,nbfield_j)+first_j;
    4227 %             i1=floor((i1-1)/nbfield_j)+1;
    4228 %             set(handles.num_first_j,'String',num2str(j1))
    4229 %         end
    4230 %         set(handles.num_first_i,'String',num2str(i1))
    4231 % %         last_i=str2double(get(handles.num_last_i,'String'));
    4232 % %         last_j=str2double(get(handles.num_last_j,'String'));
    4233 % %         i1=(last_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index
    4234 % %         if strcmp(SeriesData.TimeName,'xml')% indices i and j
    4235 % %             j1=mod(i1-1,nbfield_j)+1;
    4236 % %             i1=floor((i1-1)/nbfield_j)+1;
    4237 % %         end
    4238 %         set(handles.num_last_i,'String',num2str(nbfield))
    4239 %          set(handles.num_last_j,'String',num2str(nbfield_j))
    4240 %     end
    4241 % else
    4242 %     check_input_file_series(handles)
    4243 %     ActionInput_Callback([],[], handles)
    4244 % end
    4245 
     4178
     4179
Note: See TracChangeset for help on using the changeset viewer.