Changeset 332 for trunk/src/series.m


Ignore:
Timestamp:
Dec 13, 2011, 11:20:07 AM (9 years ago)
Author:
sommeria
Message:

NomType? changed from _i1-i2 ... to _1-2 ... (bugs to be expected!)
bug corrected in geometry_calib
series changed by introducing a from FileIndices?, introduction of find_file_series to detect the file series corresponding to an input file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r329 r332  
    6565% set(0,'Units','pixels')
    6666% screensize=get(0,'ScreenSize'); %screen size in pixels
    67 set(hObject,'Position',[150 100 1000 600] );%position and size in pixels (get adjusted to the screen size in case of excess)
     67set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)
     68%set(hObject,'Position',[150 100 1000 600] );%position and size in pixels (get adjusted to the screen size in case of excess)
    6869%load the list of previously browsed files in menus Open and Open_1
    6970dir_perso=prefdir;
     
    112113if isfield(param,'FileName')
    113114    if isfield(param,'FileName_1')
    114         update_file(hObject, eventdata, handles,param.FileName_1,0)
    115         update_file(hObject, eventdata, handles,param.FileName,1)
     115        update_file(handles,param.FileName_1,0)
     116        update_file(handles,param.FileName,1)
    116117    else
    117         update_file(hObject, eventdata, handles,param.FileName,0)
     118        update_file(handles,param.FileName,0)
    118119    end
    119120end 
     
    125126    FieldCell{1}=param.list_fields{param.index_fields};
    126127end
    127 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)
    128128NomType_Callback(hObject, eventdata, handles)
    129129
     
    135135[path_series,name,ext]=fileparts(which('series'));
    136136path_series=fullfile(path_series,'series');%path of the function 'series'
    137 addpath path_series ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory)
     137addpath (path_series) ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory)
    138138path_transform=fullfile(path_series,'transform_field');%path to the field transform functions
    139139for ilist=1:length(fct_menu)
     
    256256    warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer
    257257else
    258     update_file(hObject, eventdata, handles,fileinput,0)
     258    update_file(handles,fileinput,0)
    259259     %update list of recent files in the menubar
    260260    MenuFile_1=fileinput;
     
    293293function MenuFile_1_Callback(hObject, eventdata, handles)
    294294fileinput=get(handles.MenuFile_1,'Label');
    295 update_file(hObject, eventdata, handles,fileinput,0)
     295update_file(handles,fileinput,0)
    296296
    297297% --------------------------------------------------------------------
    298298function MenuFile_2_Callback(hObject, eventdata, handles)
    299299fileinput=get(handles.MenuFile_2,'Label');
    300 update_file(hObject, eventdata, handles,fileinput,0)
     300update_file(handles,fileinput,0)
    301301
    302302% --------------------------------------------------------------------
    303303function MenuFile_3_Callback(hObject, eventdata, handles)
    304304fileinput=get(handles.MenuFile_3,'Label');
    305 update_file(hObject, eventdata, handles,fileinput,0)
     305update_file( handles,fileinput,0)
    306306
    307307% --------------------------------------------------------------------
    308308function MenuFile_4_Callback(hObject, eventdata, handles)
    309309fileinput=get(handles.MenuFile_4,'Label');
    310 update_file(hObject, eventdata, handles,fileinput,0)
     310update_file(handles,fileinput,0)
    311311
    312312% --------------------------------------------------------------------
    313313function MenuFile_5_Callback(hObject, eventdata, handles)
    314314fileinput=get(handles.MenuFile_5,'Label');
    315 update_file(hObject, eventdata, handles,fileinput,0)
     315update_file(handles,fileinput,0)
    316316
    317317% --------------------------------------------------------------------
     
    360360    msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer
    361361else
    362     update_file(hObject, eventdata, handles,fileinput,1)
     362    update_file(handles,fileinput,1)
    363363    %update list of recent files in the menubar
    364364    MenuFile_1=fileinput;
     
    397397function MenuFile_insert_1_Callback(hObject, eventdata, handles)
    398398fileinput=get(handles.MenuFile_insert_1,'Label');
    399 update_file(hObject, eventdata, handles,fileinput,1)
     399update_file(handles,fileinput,1)
    400400
    401401% --------------------------------------------------------------------
    402402function MenuFile_insert_2_Callback(hObject, eventdata, handles)
    403403fileinput=get(handles.MenuFile_insert_2,'Label');
    404 update_file(hObject, eventdata, handles,fileinput,1)
     404update_file(handles,fileinput,1)
    405405
    406406% --------------------------------------------------------------------
    407407function MenuFile_insert_3_Callback(hObject, eventdata, handles)
    408408fileinput=get(handles.MenuFile_insert_3,'Label');
    409 update_file(hObject, eventdata, handles,fileinput,1)
     409update_file( handles,fileinput,1)
    410410
    411411% --------------------------------------------------------------------
    412412function MenuFile_insert_4_Callback(hObject, eventdata, handles)
    413413fileinput=get(handles.MenuFile_insert_4,'Label');
    414 update_file(hObject, eventdata, handles,fileinput,1)
     414update_file( handles,fileinput,1)
    415415
    416416% --------------------------------------------------------------------
    417417function MenuFile_insert_5_Callback(hObject, eventdata, handles)
    418418fileinput=get(handles.MenuFile_insert_5,'Label');
    419 update_file(hObject, eventdata, handles,fileinput,1)
     419update_file(handles,fileinput,1)
    420420
    421421%------------------------------------------------------------------------
    422422% ---  refresh the GUI data after introduction of a new file series
    423 function update_file(hObject, eventdata, handles,fileinput,addtest)
     423% INPUT:
     424% handles:
     425% fileinput: name of the input file
     426% addtest: =0 to refresh the list of file series, =1 to append a new series to the list (from the menu bar option 'Open_insert')
     427function update_file(handles,fileinput,addtest)
    424428%------------------------------------------------------------------------ 
     429
     430%% enable other menus and uicontrols
     431set(handles.MenuOpen_insert,'Enable','on')
     432set(handles.MenuFile_insert_1,'Enable','on')
     433set(handles.MenuFile_insert_2,'Enable','on')
     434set(handles.MenuFile_insert_3,'Enable','on')
     435set(handles.MenuFile_insert_4,'Enable','on')
     436set(handles.MenuFile_insert_5,'Enable','on')
     437set(handles.RUN, 'Enable','On')
     438set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red
     439set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box  to yellow
     440drawnow
     441
     442%% get the input root name, indices, file extension and nomenclature NomType
    425443if ~exist(fileinput,'file')
    426444    msgbox_uvmat('ERROR',['input file ' fileinput  ' does not exist'])
    427445    return
    428446end
    429 
    430 % refresh input root name, indices, file extension and nomenclature
    431 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput);
    432 
    433 %check for movie image files
    434 if ~isempty(FileExt)
    435     if ~isempty(imformats(FileExt(2:end)))
    436         imainfo=imfinfo(fileinput);
    437         if length(imainfo) >1 %case of image with multiple frames
    438             NomType='*';
    439             [RootPath,RootFile]=fileparts(fileinput);
    440         end
    441     end
    442 end
    443 NcType='none';%default
    444 if isequal(FileExt,'.nc')
    445    Data=nc2struct(fileinput,[]);
    446    if isfield(Data,'absolut_time_T0')
    447        NcType='civx'; % test for civx velocity fields
    448    end
    449 end
    450 
    451 set(handles.RootPath,'Value',1)
    452 set(handles.SubDir,'Value',1)
    453 set(handles.RootFile,'Value',1)
    454 set(handles.NomType,'Value',1)
    455 set(handles.FileExt,'Value',1)
    456 set(handles.nb_field,'Value',1)
    457 set(handles.nb_field2,'Value',1)
    458 if addtest
    459     SeriesData=get(handles.figure1,'UserData');
    460     SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num];
    461     SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile;
    462     RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ;
    463     SubDirCell=[{SubDir}; get(handles.SubDir,'String')];
    464     RootFileCell=[{RootFile}; get(handles.RootFile,'String')];
    465     NomTypeCell=[{NomType}; SeriesData.NomType];
    466     FileExtCell=[{FileExt}; get(handles.FileExt,'String')];
    467     NcTypeCell=[{NcType};SeriesData.NcType];
    468     set(handles.NomType,'String',[{};get(handles.NomType,'String')])
    469 else
    470     SeriesData=[];%re-initialisation
    471     SeriesData.displ_num=[0 0 0 0];
    472     RootPathCell={RootPath};
    473     SubDirCell={SubDir};
    474     RootFileCell={RootFile};   
    475     NomTypeCell={NomType};
    476     FileExtCell={FileExt};   
    477     NcTypeCell={NcType};
    478 end
    479 
    480 SeriesData.NomType=NomTypeCell;
    481 SeriesData.NcType=NcTypeCell;
    482 SeriesData.CurrentInputFile=fileinput;
    483 set(handles.RootPath,'String',RootPathCell);
    484 set(handles.SubDir,'String',SubDirCell);
    485 set(handles.RootFile,'String',RootFileCell);
    486 set(handles.NomType,'String',NomTypeCell);
    487 set(handles.FileExt,'String',FileExtCell); 
    488 
    489 %determine field indices
     447[RootPath,RootFile,i1,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput);
     448
     449%% look for min and max indices existing in the file series and update NomType
     450[num_i1,num_i2,num_j1,num_j2,NomType,FileType,Object]=find_file_series(fileinput);
     451 if strcmp(NomType,'*')
     452     MinIndex_i=1;
     453     MinIndex_j=1;
     454     nb_field=num_i2;
     455     nb_field2=1;
     456 else
     457    MinIndex_i=min(floor((min(num_i1)+min(num_i2))/2));
     458    MinIndex_j=min(floor((min(num_j1)+min(num_j2))/2));
     459    nb_field=max(floor((max(num_i1)+max(num_i2))/2));
     460    nb_field2=max(floor((max(num_j1)+max(num_j2))/2));
     461 end
     462if isnan(nb_field)
     463    nb_field_str='?';
     464    nb_field_str2='?';
     465else
     466    MinIndex_i_str=num2str(MinIndex_i);
     467    MinIndex_j_str=num2str(MinIndex_j);
     468    nb_field_str=num2str(nb_field);
     469    nb_field_str2=num2str(nb_field2); 
     470end
     471if addtest% case of insertion of a new series (menu bar option Open_insert)
     472    MinIndex_i_cell=[{MinIndex_i_str} ;get(handles.MinIndex_i,'String')];
     473    MinIndex_j_cell=[{MinIndex_j_str} ;get(handles.MinIndex_j,'String')];
     474    nb_field_cell=[{nb_field_str} ;get(handles.nb_field,'String')];
     475    nb_field2_cell=[{nb_field_str2} ;get(handles.nb_field2,'String')];
     476else % refresh the list (menu bar option Open)
     477    MinIndex_i_cell={MinIndex_i_str};
     478    MinIndex_j_cell={MinIndex_j_str};
     479    nb_field_cell={nb_field_str};
     480    nb_field2_cell={nb_field_str2};
     481end
     482set(handles.MinIndex_i,'String',MinIndex_i_cell);
     483set(handles.MinIndex_j,'String',MinIndex_j_cell);
     484set(handles.nb_field,'String',nb_field_cell);
     485set(handles.nb_field2,'String',nb_field2_cell);
     486
     487
     488%% determine reference field indices
    490489ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV
    491 if ~isempty(str2num(field_count))
    492     ref_i=str2num(field_count);
     490if ~isempty(str2num(i1))
     491    ref_i=str2num(i1);
    493492    if ~isempty(str2num(str2))
    494493        ref_i=floor((ref_i+str2num(str2))/2);% reference image number corresponding to the file
    495         SeriesData.browse_Di=str2num(str2)-str2num(field_count);
     494        SeriesData.browse_Di=str2num(str2)-str2num(i1);
    496495    end
    497496end
     
    511510set(handles.last_j,'String',num2str(ref_j));
    512511
    513 %enable other menus and uicontrols
    514 set(handles.MenuOpen_insert,'Enable','on')
    515 set(handles.MenuFile_insert_1,'Enable','on')
    516 set(handles.MenuFile_insert_2,'Enable','on')
    517 set(handles.MenuFile_insert_3,'Enable','on')
    518 set(handles.MenuFile_insert_4,'Enable','on')
    519 set(handles.MenuFile_insert_5,'Enable','on')
    520 set(handles.RUN, 'Enable','On')
    521 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red
    522 set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box  to yellow
    523 drawnow
    524 
    525512TimeUnit=''; %default
    526513time=[];%default
     
    536523if isequal(lower(FileExt),'.avi') %.avi file
    537524    testima=1;
    538     info=aviinfo([FileBase FileExt]);
    539     time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';
    540     nb_field=info.NumFrames;
    541     nb_field2=1;
     525%     info=aviinfo([FileBase FileExt]);
     526%     time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';
     527%     nb_field=info.NumFrames;
     528%     nb_field2=1;
    542529elseif ~isempty(imformats(FileExt(2:end)))
    543530    testima=1;
    544     if isequal(NomType,'*')% multi-frame image
    545         imainfo=imfinfo([FileBase FileExt]);     
    546         if length(imainfo) >1 %case of image with multiple frames
    547             nb_field=length(imainfo);
    548             nb_field2=1;
    549         end
    550     end
     531%     if isequal(NomType,'*')% multi-frame image
     532%         imainfo=imfinfo([FileBase FileExt]);     
     533%         if length(imainfo) >1 %case of image with multiple frames
     534%             nb_field=length(imainfo);
     535%             nb_field2=1;
     536%         end
     537%     end
    551538elseif isequal(FileExt,'.vol')
    552539     testima=1;
    553540end
    554541
    555 % enable field and veltype menus
     542
     543%% fill the list of file series
     544% select the first line in the list
     545set(handles.RootPath,'Value',1)
     546set(handles.SubDir,'Value',1)
     547set(handles.RootFile,'Value',1)
     548set(handles.NomType,'Value',1)
     549set(handles.FileExt,'Value',1)
     550set(handles.nb_field,'Value',1)
     551set(handles.nb_field2,'Value',1)
     552% append the current file series to the list
     553if addtest
     554    SeriesData=get(handles.series,'UserData');
     555    SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num];
     556    SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile;
     557    RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ;
     558    SubDirCell=[{SubDir}; get(handles.SubDir,'String')];
     559    RootFileCell=[{RootFile}; get(handles.RootFile,'String')];
     560    NomTypeCell=[{NomType}; SeriesData.NomType];
     561    FileExtCell=[{FileExt}; get(handles.FileExt,'String')];
     562    FileTypeCell=[{FileType};SeriesData.FileType];
     563    set(handles.NomType,'String',[{};get(handles.NomType,'String')])
     564% or re-initialise the list of  input  file series   
     565else
     566    SeriesData=[];%re-initialisation
     567    SeriesData.displ_num=[0 0 0 0];
     568    RootPathCell={RootPath};
     569    SubDirCell={SubDir};
     570    RootFileCell={RootFile};   
     571    NomTypeCell={NomType};
     572    FileExtCell={FileExt};   
     573    FileTypeCell={FileType};
     574end
     575SeriesData.NomType=NomTypeCell;
     576SeriesData.FileType=FileTypeCell;
     577SeriesData.CurrentInputFile=fileinput;
     578set(handles.RootPath,'String',RootPathCell);
     579set(handles.SubDir,'String',SubDirCell);
     580set(handles.RootFile,'String',RootFileCell);
     581set(handles.NomType,'String',NomTypeCell);
     582set(handles.FileExt,'String',FileExtCell);
     583
     584%% enable field and veltype menus
    556585testfield=isequal(get(handles.FieldMenu,'enable'),'on');
    557586testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on');
     
    568597            testnc=1;
    569598        end
    570         if isequal(NcTypeCell{iview},'civx')
     599        if isequal(FileTypeCell{iview},'civx')
    571600            testcivx=1;
    572601        end
     
    575604    testnc=isequal(FileExtCell{1},'.nc');
    576605    testnc_1=isequal(FileExtCell{2},'.nc');
    577     testcivx=isequal(NcTypeCell{1},'civx');
    578     testcivx_1=isequal(NcTypeCell{2},'civx');
     606    testcivx=isequal(FileTypeCell{1},'civx');
     607    testcivx_1=isequal(FileTypeCell{2},'civx');
    579608end
    580609if testfield && testnc
     
    630659end 
    631660
    632 %%%%%%%%   read image documentation file  if found%%%%%%%%%%%%%%%%%%%%%%%%%%%
    633       %look for the file existence
     661%%  read image documentation file  if found%%%%%%%%%%%%%%%%%%%%%%%%%%%
    634662ext_imadoc='';
    635663if isequal(FileExt,'.xml')||isequal(FileExt,'.civ')
     
    640668    ext_imadoc='.civ';
    641669end
    642       %read the ImaDoc file
     670%read the ImaDoc file
    643671XmlData=[];
    644672NbSlice_calib={};
     
    672700    end 
    673701end 
     702
     703
     704
     705%% display times
    674706if addtest
    675707    SeriesData.Time=[{time} SeriesData.Time];
     
    677709   SeriesData.Time={time};
    678710end
    679 
    680 
    681 % if ~isempty(time)
    682 %     siztime=size(time);
    683 %     nb_field=siztime(1);
    684 %     nb_field2=siztime(2);
    685 % end   
    686711set(handles.TimeUnit,'String',TimeUnit)
    687 %look for max indices
    688 if ~strcmp(NomType,'*')
    689     [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput);
    690     nb_field=max(floor((max(num_i1)+max(num_i2))/2));
    691     nb_field2=max(floor((max(num_j1)+max(num_j2))/2));
    692 end
    693 if isnan(nb_field)
    694     nb_field_str='?';
    695     nb_field_str2='?';
    696 else
    697     nb_field_str=num2str(nb_field);
    698     nb_field_str2=num2str(nb_field2);
    699 end
    700 if addtest
    701     nb_field_cell=[{nb_field_str} ;get(handles.nb_field,'String')];
    702     nb_field2_cell=[{nb_field_str2} ;get(handles.nb_field2,'String')];
    703 else
    704     nb_field_cell={nb_field_str};
    705     nb_field2_cell={nb_field_str2};
    706 end
    707 set(handles.nb_field,'String',nb_field_cell);
    708 set(handles.nb_field2,'String',nb_field2_cell);
    709 set(handles.figure1,'UserData',SeriesData);
    710 
    711 %number of slices
     712set(handles.series,'UserData',SeriesData);
     713
     714%% number of slices
    712715if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord')
    713716       siz=size(XmlData.GeometryCalib.SliceCoord);
     
    721724
    722725% set menus of index pairs
    723 NomType_Callback(hObject, eventdata, handles)
     726NomType_Callback([], [], handles)
    724727
    725728%store the root name for future opening of uvmat
     
    739742end
    740743set(handles.RootPath,'BackgroundColor',[1 1 1])
    741 set(handles.PathCampaign,'String',SeriesData.PathCampaign)
    742 last_j_Callback(hObject, eventdata, handles)
    743 last_i_Callback(hObject, eventdata, handles)
     744% set(handles.PathCampaign,'String',SeriesData.PathCampaign)
     745last_j_Callback([], [], handles)
     746last_i_Callback([], [], handles)
    744747
    745748%------------------------------------------------------------------------
     
    819822function NomType_Callback(hObject, eventdata, handles)
    820823%------------------------------------------------------------------------
    821 hseries=get(handles.ProjObject,'Parent');
    822 SeriesData=get(hseries,'UserData');
     824SeriesData=get(handles.series,'UserData');
    823825if isfield(SeriesData,'NomType')
    824826    NomTypeCell=SeriesData.NomType;
     
    853855    NomType=NomTypeCell{Val};
    854856    switch NomType 
    855             case {'_i1-i2_j', '_i1-i2'}
     857            case {'_1-2_1', '_1-2'}
    856858                set(handles.mode,'String',{'series(Di)'})
    857859                set(handles.mode,'Value',1);
     
    862864                set(handles.mode,'Value',1);
    863865                testpair=1;
    864             case '_i_j1-j2'
     866            case '_1_1-2'
    865867                set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice
    866868                if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1))
     
    873875    end
    874876    switch NomType   
    875             case {'_1_1','_i_j1-j2','_i1-i2_j','1_ab','01_ab'},% two navigation indices
     877            case {'_1_1','_1_1-2','_1-2_1','1_ab','01_ab'},% two navigation indices
    876878                state_j='on';
    877879    end
     
    881883else
    882884    set(handles.NomType,'String',NomTypeCell)
     885    set(handles.j_txt,'Visible',state_j)
     886    set(handles.MinIndex_j,'Visible',state_j)
    883887    set(handles.first_j,'Visible',state_j)
    884888    set(handles.incr_j,'Visible',state_j)
    885889    set(handles.last_j,'Visible',state_j)
    886     set(handles.nb_field2,'Visible',state_j)
     890    set(handles.nb_field2,'Visible',state_j) 
    887891end
    888892
     
    892896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    893897function mode_Callback(hObject, eventdata, handles)
    894 %hseries=get(handles.mode,'parent');
    895 hseries=handles.figure1;
    896 SeriesData=get(hseries,'UserData');
     898SeriesData=get(handles.series,'UserData');
    897899mode_list=get(handles.mode,'String');
    898900mode_value=get(handles.mode,'Value');
     
    904906    Val=get(handles.NomType,'Value');
    905907    NomType=NomTypeCell{Val};
    906     test_find_pair=isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')|| isequal(NomType,'#_ab');
     908    test_find_pair=isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')|| isequal(NomType,'#_ab');
    907909end
    908910time=[];
     
    917919    enable_i(handles,'On')
    918920    enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 
    919 elseif  isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')
     921elseif  isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')
    920922    enable_i(handles,'On')
    921923    enable_j(handles,'On') % allow both i and j index scanning
     
    925927end   
    926928set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1
    927 set(hseries,'UserData',SeriesData)
     929set(handles.series,'UserData',SeriesData)
    928930
    929931%list pairs if relevant
     
    945947function enable_j(handles,state)
    946948set(handles.j_txt,'Visible',state)
     949set(handles.MinIndex_j,'Visible',state)
    947950set(handles.first_j,'Visible',state)
    948951set(handles.last_j,'Visible',state)
     
    974977%----------------------------------------------------------------
    975978function find_netcpair_civ(hObject, eventdata, handles,Val)
    976 %hseries=get(handles.list_pair_civ,'parent');
    977 SeriesData=get(handles.figure1,'UserData');
     979SeriesData=get(handles.series,'UserData');
    978980% NomTypeCell=get(handles.NomType,'String');
    979981NomTypeCell=SeriesData.NomType;
     
    10801082    for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode
    10811083        for numod_b=(numod_a+1):nbfield2
    1082             [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir);
    1083             select=(exist(filename,'file')==2);
     1084            [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir)
     1085            select=(exist(filename,'file')==2)
    10841086            if select==1
    10851087                ind_exist=ind_exist+1;
     
    11041106                        nom_type_ima='#A';
    11051107                    otherwise
    1106                          nom_type_ima='_i_j';
     1108                         nom_type_ima='_1_1';
    11071109                end
    11081110               displ_pair{ind_exist}=['j= ' num2stra(numod_a,nom_type_ima,2) '-' num2stra(numod_b,nom_type_ima,2) ...
     
    11451147SeriesData.displ_num(iview,:)=(displ_num(:,val))';
    11461148SeriesData.ref_time=ref_time;
    1147 set(handles.figure1,'UserData',SeriesData)
     1149set(handles.series,'UserData',SeriesData)
    11481150list_pair_civ_Callback(hObject, eventdata, handles)
    11491151
     
    11571159Val=get(handles.RootPath,'Value');
    11581160IndexCell=get(handles.NomType,'String');
    1159 %hseries=get(handles.list_pair_civ,'parent');
    1160 SeriesData=get(handles.figure1,'UserData');
     1161SeriesData=get(handles.series,'UserData');
    11611162NomType=SeriesData.NomType{Val};
    11621163list_pair=get(handles.list_pair_civ,'String');%get the menu of image pairs
     
    11841185    end
    11851186    switch NomType
    1186        case {'_i1-i2_j'}
     1187       case {'_1-2_1'}
    11871188           if isequal(num1_str(1),'0')
    11881189               IndexCell{Val}=['_(i-(i+' num2_str ')_j'];
     
    11921193           displ_num(3)=num1;
    11931194           displ_num(4)=num2;
    1194        case {'_i1-i2'}
     1195       case {'_1-2'}
    11951196           if isequal(num1_str(1),'0')
    11961197               IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')'];
     
    12001201           displ_num(3)=num1;
    12011202           displ_num(4)=num2;
    1202        case '_i_j1-j2'
     1203       case '_1_1-2'
    12031204          if test_bursts
    12041205              IndexCell{Val}=['_i_' num1_str '-' num2_str ];
     
    12191220set(handles.NomType,'String',IndexCell)
    12201221SeriesData.displ_num(Val,:)=displ_num;
    1221 set(handles.figure1,'UserData',SeriesData)
     1222set(handles.series,'UserData',SeriesData)
    12221223% set(handles.NomType,'Value',Val)
    12231224
     
    12701271%read root name and field type
    12711272set(handles.RUN,'BusyAction','queue');
    1272 %hseries=get(handles.RUN,'parent');
    1273 set(0,'CurrentFigure',handles.figure1)
     1273set(0,'CurrentFigure',handles.series)
    12741274if isequal(get(handles.GetObject,'Visible'),'on') && isequal(get(handles.GetObject,'Value'),1)
    12751275    Series.GetObject=1;
     
    12781278    Series.GetObject=0;
    12791279end
    1280 SeriesData=get(handles.figure1,'UserData');
     1280SeriesData=get(handles.series,'UserData');
    12811281
    12821282%reinitiate waitbar position
     
    13241324    Series.transform_fct=transform_list{menu_index};% transform function handles
    13251325end
    1326 Series.hseries=handles.figure1; % handles to the series GUI
     1326Series.hseries=handles.series; % handles to the series GUI
    13271327
    13281328%read the set of field numbers
     
    13871387    %case of pairs (.nc files)
    13881388   
    1389     if isequal(NomType{iview},'_i_j1-j2')|| isequal(NomType{iview},'_i1-i2_j')|| isequal(NomType{iview},'_i1-i2')|| isequal(NomType{iview},'#_ab')
     1389    if isequal(NomType{iview},'_1_1-2')|| isequal(NomType{iview},'_1-2_1')|| isequal(NomType{iview},'_1-2')|| isequal(NomType{iview},'#_ab')
    13901390        ind_shift=SeriesData.displ_num(iview,:);
    13911391        if isequal(ind_shift,[0 0 0 0]) % undefined pairs
     
    14901490function last_i_Callback(hObject, eventdata, handles)
    14911491%------------------------------------------------------------------------
    1492 %     hseries=get(handles.last_i,'parent');
    1493 % first_i=str2num(get(handles.first_i,'String'));
    1494 % last_i=str2num(get(handles.last_i,'String'));
    1495 % ref_i=ceil((first_i+last_i)/2);
    1496 % set(handles.ref_i,'String', num2str(ref_i))
    1497 % ref_i_Callback(hObject, eventdata, handles)
    1498 SeriesData=get(handles.figure1,'UserData');
     1492SeriesData=get(handles.series,'UserData');
    14991493if ~isfield(SeriesData,'Time')
    15001494    SeriesData.Time{1}=[];
     
    15151509set(handles.ref_j,'String', num2str(ref_j))
    15161510ref_j_Callback(hObject, eventdata, handles)
    1517 SeriesData=get(handles.figure1,'UserData');
     1511SeriesData=get(handles.series,'UserData');
    15181512if ~isfield(SeriesData,'Time')
    15191513    SeriesData.Time{1}=[];
     
    15281522mode_value=get(handles.mode,'Value');
    15291523mode=mode_list{mode_value};
    1530 %hseries=get(handles.ref_i,'parent');
    1531 SeriesData=get(handles.figure1,'UserData');
     1524SeriesData=get(handles.series,'UserData');
    15321525%NomTypeCell=get(handles.NomType,'String');
    15331526NomTypeCell=SeriesData.NomType;
     
    15361529NomType=NomTypeCell{Val};
    15371530% for ilist=1:length(NomType)
    1538     if isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')
     1531    if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')
    15391532        if isequal(mode,'series(Di)')
    15401533            find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files
     
    15501543mode_value=get(handles.mode,'Value');
    15511544mode=mode_list{mode_value};
    1552 %hseries=get(handles.ref_i,'parent');
    1553 SeriesData=get(handles.figure1,'UserData');
     1545SeriesData=get(handles.series,'UserData');
    15541546NomTypeCell=SeriesData.NomType;
    15551547if ~isempty(NomTypeCell)
    15561548    Val=get(handles.NomType,'Value');
    15571549    NomType=NomTypeCell{Val};
    1558     if isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')
     1550    if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')
    15591551        if isequal(mode,'series(Dj)')
    15601552            find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files
     
    18071799         delete(hget_field)%delete opened versions of get_field
    18081800     end
    1809      %hseries=get(handles.FieldMenu,'parent');
    1810      SeriesData=get(handles.figure1,'UserData');
     1801     SeriesData=get(handles.series,'UserData');
    18111802     filename=SeriesData.CurrentInputFile;
    18121803     if exist(filename,'file')
     
    18351826         delete(hget_field)
    18361827     end
    1837      %hseries=get(handles.FieldMenu,'parent');
    1838      SeriesData=get(handles.figure1,'UserData');
     1828     SeriesData=get(handles.series,'UserData');
    18391829     filename=SeriesData.CurrentInputFile_1;
    18401830     if exist(filename,'file')
     
    18881878num_i_out=num_i;
    18891879num_j_out=num_j;
    1890 if isequal (NomType,'_i1-i2_j') || isequal (NomType,'_i1-i2')
     1880if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2')
    18911881    num_i1_line=num_i+ind_shift(3);% set of first image numbers
    18921882    num_i2_line=num_i+ind_shift(4);
     
    19001890    [xx,num_i1]=meshgrid(num_j,num_i1_line);
    19011891    [xx,num_i2]=meshgrid(num_j,num_i2_line);
    1902 elseif isequal (NomType,'_i_j1-j2') || isequal (NomType,'#_ab')
     1892elseif isequal (NomType,'_1_1-2') || isequal (NomType,'#_ab')
    19031893    if isequal(mode,'bursts') %case of bursts (png_old or png_2D)
    19041894        num_j1=ind_shift(1)*ones(size(num_i));
     
    19211911function displ_time(handles,times)
    19221912%------------------------------------------------------------------------
    1923 hseries=get(handles.last_i,'parent');
    1924 SeriesData=get(hseries,'UserData');%
     1913SeriesData=get(handles.series,'UserData');%
    19251914first_i=str2num(get(handles.first_i,'String'));
    19261915first_j=str2num(get(handles.first_j,'String'));
    19271916last_i=str2num(get(handles.last_i,'String'));
    19281917last_j=str2num(get(handles.last_j,'String'));
    1929 % index_civ=get(handles.list_pair_civ,'Value');
    1930 % NomType=get(handles.NomType,'String');
    19311918NomType=SeriesData.NomType;
    19321919mode_list=get(handles.mode,'String');
    19331920index_mode=get(handles.mode,'Value');
    19341921mode=mode_list{index_mode};
    1935 % ind_shift=0;%default
    19361922
    19371923time_first=[];
     
    19441930    time_last_cell{iview}='?';%default
    19451931    time=SeriesData.Time{iview};
    1946     if isequal(NomType{iview},'_i1-i2_j')|isequal(NomType{iview},'_i_j1-j2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_i1-i2')
     1932    if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2')
    19471933        if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num)
    19481934            ind_shift=SeriesData.displ_num(iview,:);
     
    20212007function GetObject_Callback(hObject, eventdata, handles)
    20222008%------------------------------------------------------------------------
    2023 hseries=get(handles.GetObject,'parent');
    2024 SeriesData=get(hseries,'UserData');
     2009SeriesData=get(handles.series,'UserData');
    20252010value=get(handles.GetObject,'Value');
    20262011if value
     
    20752060%     end
    20762061end
    2077 set(hseries,'UserData',SeriesData)
     2062set(handles.series,'UserData',SeriesData)
    20782063
    20792064%--------------------------------------------------------------
     
    21142099global nb_transform
    21152100
    2116 % huvmat=get(handles.transform_fct,'parent');
    21172101menu=get(handles.transform_fct,'String');
    21182102ind_coord=get(handles.transform_fct,'Value');
     
    23052289end
    23062290
    2307 %------------------------------------------------------------------------
    2308 % --- generates series of file indices corresponding to a file fileinput
    2309 function [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput)
    2310 %------------------------------------------------------------------------
    2311 num_i1=NaN;%default
    2312 num_i2=NaN;%default
    2313 num_j1=NaN;%default
    2314 num_j2=NaN;%default
    2315 % refresh input root name, indices, file extension and nomenclature
    2316 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput);
    2317 if strcmp(SubDir,'')
    2318     filebasesub=fullfile(RootPath,RootFile);
    2319 else
    2320     filebasesub=fullfile(RootPath,SubDir,RootFile);
    2321 end
    2322 dirpair=[]; %default
    2323 switch NomType
    2324     case '_1'
    2325         dirpair=dir([filebasesub '_*' FileExt]);
    2326     case '_1_1'
    2327         dirpair=dir([filebasesub '_*_*' FileExt]);
    2328     case '_i1-i2'
    2329         dirpair=dir([filebasesub '_*-*' FileExt]);
    2330     case '1_ab'
    2331         dirpair=dir([filebasesub '*_*' FileExt]);
    2332     case '_i_j1-j2'
    2333         dirpair=dir([filebasesub '*_*-*' FileExt]);   
    2334     case '_i1-i2_j'
    2335         dirpair=dir([filebasesub '*-*_*' FileExt]);   
    2336 end
    2337 for ifile=1:length(dirpair)
    2338     [RootPath,RF,str_1,str_2,str_a,str_b]=name2display(dirpair(ifile).name);
    2339     num_i1(ifile)=str2double(str_1);
    2340     num_i2(ifile)=str2double(str_2);
    2341     if isnan(num_i2(ifile))
    2342         num_i2(ifile)=num_i1(ifile);
    2343     end
    2344     num_j1(ifile)=stra2num(str_a);
    2345     if isnan(num_j1(ifile))
    2346         num_j1(ifile)=1;
    2347     end
    2348     num_j2(ifile)=stra2num(str_b);
    2349     if isnan(num_j2(ifile))
    2350         num_j2(ifile)=num_j1(ifile);
    2351     end
    2352 end
    2353 
     2291
     2292
Note: See TracChangeset for help on using the changeset viewer.