Ignore:
Timestamp:
Apr 9, 2013, 8:20:00 PM (11 years ago)
Author:
sommeria
Message:

various bugs corrected after tests with Windows OS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/civ_input.m

    r604 r609  
    8989FileType=SeriesData.FileType{1};
    9090FileInfo=SeriesData.FileInfo{1};
    91 Ref_i=SeriesData.Ref_i{1};
    92 Ref_j=SeriesData.Ref_j{1};
    93 FileInput=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomTypeInput,Ref_i(1),Ref_i(2),Ref_j(1),Ref_j(2));
     91FileInput=SeriesData.RefFile{1};
    9492
    9593%% case of netcdf file as input, get the processing stage and look for corresponding images
     
    226224    time=SeriesData.Time{1};
    227225    %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml
    228     if isequal(MaxIndex_i,1) && ~isequal(MaxIndex_j,1)% .Time is a line vector
    229         if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D','once'))
    230             time=time';
    231             MaxIndex_i=MaxIndex_j;
    232             MaxIndex_j=1;
    233         end
    234     end
    235 end
    236 if isfield(SeriesData,'TimeUnit')
    237     TimeUnit=SeriesData.TimeUnit;
    238 end
     226%     if isequal(MaxIndex_i,1) && ~isequal(MaxIndex_j,1)% .Time is a line vector
     227%         if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D','once'))
     228%             time=time';
     229%             MaxIndex_i=MaxIndex_j;
     230%             MaxIndex_j=1;
     231%         end
     232%     end
     233end
     234if isfield(Param.IndexRange,'TimeUnit')&&~isempty(Param.IndexRange.TimeUnit)
     235    TimeUnit=Param.IndexRange.TimeUnit;
     236end
     237if isfield(SeriesData,'TimeSource')
     238    set(handles.ImaDoc,'String',SeriesData.TimeSource)
     239end 
    239240if isfield(SeriesData,'GeometryCalib')
    240241    tsai=SeriesData.GeometryCalib;
     
    247248end
    248249% timing set by video input
    249 if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader'))
    250     set(handles.ListPairMode,'Value',1);
    251     dt=1/get(MovieObject,'FrameRate');%time interval between successive frames
    252     if strcmp(NomTypeIma,'*')
    253         set(handles.ListPairMode,'String',{'series(Di)'})
    254         time=(dt*(0:MaxIndex_i-1))';%list of image times
    255     else
    256         set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}])
    257         time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times
    258         enable_j(handles,'on')
    259     end
    260     TimeUnit='s';
    261     set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter
    262 end
     250% if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader'))
     251%     set(handles.ListPairMode,'Value',1);
     252%     dt=1/get(MovieObject,'FrameRate');%time interval between successive frames
     253%     if strcmp(NomTypeIma,'*')
     254%         set(handles.ListPairMode,'String',{'series(Di)'})
     255%         time=(dt*(0:MaxIndex_i-1))';%list of image times
     256%     else
     257%         set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}])
     258%         time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times
     259%         enable_j(handles,'on')
     260%     end
     261%     TimeUnit='s';
     262%     set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter
     263% end
    263264
    264265%% timing display
     
    274275else
    275276    set(handles.ImaDoc,'String',''); %xml file not used for timing
    276     %    time=(i1_series(:,1)+0:size(i1_series,3)-1);% time=index i
    277     %    time=time'*ones(1,size(i1_series,2),1); %makes a time matrix with the same time for all j indices
    278277    TimeUnit='frame';
    279278    time=ones(MaxIndex_j-MinIndex_j+1,1)*(MinIndex_i:MaxIndex_i);
    280279    time=time+0.001*(MinIndex_j:MaxIndex_j)'*ones(1,MaxIndex_i-MinIndex_i+1);
    281280end
    282 time=[zeros(size(time,1),1) time]; %insert a vertical line of zeros (to deal with zero file indices)
    283 time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros
     281% time=[zeros(size(time,1),1) time]; %insert a vertical line of zeros (to deal with zero file indices)
     282% time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros
    284283CivInputData.Time=time;
    285284CivInputData.NomTypeIma=NomTypeIma;
    286285set(handles.civ_input,'UserData',CivInputData)
    287 %set(handles.ImaDoc,'UserData',time); %store the matrix of times
    288286set(handles.dt_unit,'String',['dt in m' TimeUnit]);%display dt in unit 10-3 of the time (e.g ms)
    289287set(handles.TimeUnit,'String',TimeUnit);
     
    292290set(handles.CoordUnit,'String',CoordUnit)
    293291set(handles.SearchRange,'UserData', pxcm_search);
    294 
    295 % set(handles.ImaExt,'String',ImaExt)
    296 % set(handles.NomType,'String',NomTypeIma)
    297292
    298293%% set the reference indices from the input file indices
     
    865860    mode=mode_list{mode_value};
    866861end
    867 displ_num=[];%default
     862% displ_num=[];%default
    868863ref_i=str2double(get(handles.ref_i,'String'));
    869864% last_i=str2num(get(handles.last_i,'String'));
     
    873868time=CivInputData.Time;
    874869siztime=size(CivInputData.Time);
    875 nbfield=siztime(2)-1;
    876 nbfield2=siztime(1)-1;
     870nbfield=siztime(1)-1;
     871nbfield2=siztime(2)-1;
    877872indchosen=1;  %%first pair selected by default
    878873%displ_num used to define the indices of the civ_input pairs
     
    916911    enable_j(handles, 'on')
    917912elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)')
    918     index=1:200;
    919     displ_num(1:2,index)=zeros(2,200);
    920     displ_num(3,index)=-floor(index/2);
    921     displ_num(4,index)=ceil(index/2);
     913%     index=1:200;
     914%     displ_num(1:2,index)=zeros(2,200);
     915%     displ_num(3,index)=-floor(index/2);
     916%     displ_num(4,index)=ceil(index/2);
    922917    enable_i(handles, 'on')
    923918    if nbfield2 > 1
     
    942937    end
    943938end
    944 set(handles.ListPairCiv1,'UserData',displ_num);
     939%set(handles.ListPairCiv1,'UserData',displ_num);
    945940errormsg=find_netcpair_civ( handles,1);
    946941    if ~isempty(errormsg)
     
    978973    set(handles.ListPairCiv2,'Value',index_pair);
    979974end
     975
     976%update first_i and last_i according to the chosen image pairs
     977% mode_list=get(handles.ListPairMode,'String');
     978% mode_value=get(handles.ListPairMode,'Value');
     979% mode=mode_list{mode_value};
     980% if isequal(mode,'series(Di)')
     981%     first_i=str2double(get(handles.first_i,'String'));
     982%     last_i=str2double(get(handles.last_i,'String'));
     983%     incr_i=str2double(get(handles.incr_i,'String'));
     984%     num_i=first_i:incr_i:last_i;
     985%     lastfield=str2double(get(handles.nb_field,'String'));
     986%     if ~isnan(lastfield)
     987%         test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ...
     988%             (num_i+ceil(index_pair/2)*ones(size(num_i))<=lastfield);
     989%         num_i=num_i(test_find);
     990%     end
     991%     set(handles.first_i,'String',num2str(num_i(1)));
     992%     set(handles.last_i,'String',num2str(num_i(end)));
     993% elseif isequal(mode,'series(Dj)')
     994%     first_j=str2double(get(handles.first_j,'String'));
     995%     last_j=str2double(get(handles.last_j,'String'));
     996%     incr_j=str2double(get(handles.incr_j,'String'));
     997%     num_j=first_j:incr_j:last_j;
     998%     lastfield2=str2double(get(handles.nb_field2,'String'));
     999%     if ~isnan(lastfield2)
     1000%         test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...
     1001%             (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2);
     1002%         num_j=num_j(test_find);
     1003%     end
     1004%     set(handles.first_j,'String',num2str(num_j(1)));
     1005%     set(handles.last_j,'String',num2str(num_j(end)));
     1006% end
     1007
     1008%------------------------------------------------------------------------
     1009% --- Executes on selection change in ListPairCiv2.
     1010function ListPairCiv2_Callback(hObject, eventdata, handles)
     1011%------------------------------------------------------------------------
     1012index_pair=get(handles.ListPairCiv2,'Value');%get the selected position index in the menu
    9801013
    9811014%update first_i and last_i according to the chosen image pairs
     
    10121045
    10131046%------------------------------------------------------------------------
    1014 % --- Executes on selection change in ListPairCiv2.
    1015 function ListPairCiv2_Callback(hObject, eventdata, handles)
    1016 %------------------------------------------------------------------------
    1017 index_pair=get(handles.ListPairCiv2,'Value');%get the selected position index in the menu
    1018 
    1019 %update first_i and last_i according to the chosen image pairs
    1020 mode_list=get(handles.ListPairMode,'String');
    1021 mode_value=get(handles.ListPairMode,'Value');
    1022 mode=mode_list{mode_value};
    1023 if isequal(mode,'series(Di)')
    1024     first_i=str2double(get(handles.first_i,'String'));
    1025     last_i=str2double(get(handles.last_i,'String'));
    1026     incr_i=str2double(get(handles.incr_i,'String'));
    1027     num_i=first_i:incr_i:last_i;
    1028     lastfield=str2double(get(handles.nb_field,'String'));
    1029     if ~isnan(lastfield)
    1030         test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ...
    1031             (num_i+ceil(index_pair/2)*ones(size(num_i))<=lastfield);
    1032         num_i=num_i(test_find);
    1033     end
    1034     set(handles.first_i,'String',num2str(num_i(1)));
    1035     set(handles.last_i,'String',num2str(num_i(end)));
    1036 elseif isequal(mode,'series(Dj)')
    1037     first_j=str2double(get(handles.first_j,'String'));
    1038     last_j=str2double(get(handles.last_j,'String'));
    1039     incr_j=str2double(get(handles.incr_j,'String'));
    1040     num_j=first_j:incr_j:last_j;
    1041     lastfield2=str2double(get(handles.nb_field2,'String'));
    1042     if ~isnan(lastfield2)
    1043         test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...
    1044             (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2);
    1045         num_j=num_j(test_find);
    1046     end
    1047     set(handles.first_j,'String',num2str(num_j(1)));
    1048     set(handles.last_j,'String',num2str(num_j(end)));
    1049 end
    1050 
    1051 %------------------------------------------------------------------------
    10521047function ref_i_Callback(hObject, eventdata, handles)
    10531048%------------------------------------------------------------------------
     
    11141109%% reads .nc subdirectoy and image numbers from the interface
    11151110SubDirImages=get(handles.Civ1_ImageA,'String');
     1111%TODO: determine
    11161112subdir_civ1=[SubDirImages get(handles.Civ1_ImageB,'String')];%subdirectory subdir_civ1 for the netcdf data
    11171113subdir_civ2=[SubDirImages get(handles.Civ2_ImageA,'String')];%subdirectory subdir_civ2 for the netcdf data
     
    11261122    ref_j=1;
    11271123end
    1128 time=get(handles.ImaDoc,'UserData');%get the set of times
     1124CivInputData=get(handles.civ_input,'UserData');
    11291125TimeUnit=get(handles.TimeUnit,'String');
     1126time=CivInputData.Time;
    11301127checkframe=strcmp(TimeUnit,'frame');
    1131 displ_num=get(handles.ListPairCiv1,'UserData');
     1128%displ_num=get(handles.ListPairCiv1,'UserData');
    11321129
    11331130%% eliminate the first pairs inconsistent with the position
    1134 if isempty(displ_num)
    1135     nbpair=0;
    1136 else
    1137     nbpair=length(displ_num(1,:));%nbre of displayed pairs
    1138     if  isequal(mode,'series(Di)')  %| isequal(mode,'st_series(Di)')
    1139         nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index
    1140     elseif  isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)')
    1141         nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index
    1142     end
    1143 end
    1144 nbpair=min(200,nbpair);%limit the number of displayed pairs to 200
     1131% if isempty(displ_num)
     1132%     nbpair=0;
     1133% else
     1134%     nbpair=length(displ_num(1,:));%nbre of displayed pairs
     1135%     if  isequal(mode,'series(Di)')  %| isequal(mode,'st_series(Di)')
     1136%         nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index
     1137%     elseif  isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)')
     1138%         nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index
     1139%     end
     1140% end
     1141% nbpair=min(200,nbpair);%limit the number of displayed pairs to 200
    11451142
    11461143%% case with no Civ1 operation, netcdf files need to exist for reading
    11471144displ_pair={''};
     1145nbpair=200;%default
    11481146select=ones(size(1:nbpair));%flag for displayed pairs =1 for display
    11491147testpair=0;
    11501148RootPath=get(handles.RootPath,'String');
    11511149RootFile=get(handles.Civ2_ImageB,'String');
     1150nbpair=200; %default
    11521151if index==1 % case civ1
    11531152    if ~get(handles.CheckCiv1,'Value') %
     
    12271226% in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices
    12281227% are relative to the reference indices ref_i and ref_j respectively.
     1228testpair=0; %TODO: check
    12291229if isequal(mode,'series(Di)')
    12301230    if testpair
Note: See TracChangeset for help on using the changeset viewer.