Changeset 637 for trunk/src/series


Ignore:
Timestamp:
May 20, 2013, 10:12:57 AM (11 years ago)
Author:
sommeria
Message:

civ_series cleaned. Introduction of a nc file as input (to further debug)

Location:
trunk/src/series
Files:
3 edited

Legend:

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

    r635 r637  
    2525
    2626
    27 % Last Modified by GUIDE v2.5 04-Apr-2013 22:08:23
     27% Last Modified by GUIDE v2.5 20-May-2013 09:55:30
    2828% Begin initialization code - DO NOT EDIT
    2929gui_Singleton = 1;
     
    8282%% input file info
    8383RootPath=Param.InputTable{1,1};
    84 set(handles.RootPath,'String',RootPath)
     84%set(handles.RootPath,'String',RootPath)
    8585RootFile=Param.InputTable{1,3};
    8686SubDir=Param.InputTable{1,2};
     
    9898switch FileType
    9999         case {'image','multimage','video','mmreader'}
    100           NomTypeIma=NomTypeInput;
     100          NomTypeImaA=NomTypeInput;
    101101    case 'civdata'
    102102        if ~strcmp(Param.Action.ActionName,'civ_series')
     
    111111        else
    112112            set(handles.ListCompareMode,'Value',1)
    113             set(handles.RootFile_1,'Visible','Off');
     113%            set(handles.RootFile_1,'Visible','Off');
    114114        end
    115115        imageinput='';
     
    117117        [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);
    118118        [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);
     119%         set(handles.Civ1_ImageA,'String',Civ1_ImageA)
     120%         set(handles.Civ1_ImageB,'String',Civ1_ImageB)
     121        if ~isempty(Data.Civ2_ImageA)
    119122        [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA);
    120123        [PathCiv2_ImageB,Civ2_ImageB,FileExtA]=fileparts(Data.Civ2_ImageB);
    121         set(handles.Civ1_ImageA,'String',Civ1_ImageA)
    122         set(handles.Civ1_ImageB,'String',Civ1_ImageB)
    123         set(handles.Civ2_ImageA,'String',Civ2_ImageA)
    124         set(handles.Civ2_ImageB,'String',Civ2_ImageB)
     124%         set(handles.Civ2_ImageA,'String',Civ2_ImageA)
     125%         set(handles.Civ2_ImageB,'String',Civ2_ImageB)
     126        end
     127        hhseries=guidata(gcbf);
     128        if size(Param.InputTable,1)==1
     129        series('display_file_name',hhseries,Data.Civ1_ImageA,'append');
     130        end
    125131    if isfield(Data,'Txt')
    126132        errormsg=Data.Txt;
     
    155161
    156162%display the parameters stored on the GUI series
    157 % set(handles.first_i,'String',num2str(Param.IndexRange.first_i))
    158 % set(handles.incr_i,'String',num2str(Param.IndexRange.incr_i))
    159 % set(handles.last_i,'String',num2str(Param.IndexRange.last_i))
    160163set(handles.ref_i,'String',num2str(Param.IndexRange.first_i))
    161164if isfield(Param.IndexRange,'first_j')
    162 %     set(handles.first_j,'String',num2str(Param.IndexRange.first_j))
    163 %     set(handles.incr_j,'String',num2str(Param.IndexRange.incr_j))
    164 %     set(handles.last_j,'String',num2str(Param.IndexRange.last_j))
    165165    set(handles.ref_j,'String',num2str(Param.IndexRange.first_j))
    166166end
     
    193193
    194194%%  set the menus of image pairs and default selection for civ_input   %%%%%%%%%%%%%%%%%%%
    195 %check_letter=~isempty(regexp(NomTypeIma,'[ab|AB]$'));%detect pair label by letter
    196 %if  isequal(NomTypeNc,'_1-2')||isempty(MaxIndex_j)|| (MaxIndex_j==1)
    197195MaxIndex_i=Param.IndexRange.MaxIndex_i(1);
    198196MinIndex_i=Param.IndexRange.MinIndex_i(1);
     
    256254    end
    257255end
    258 % timing set by video input
    259 % if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader'))
    260 %     set(handles.ListPairMode,'Value',1);
    261 %     dt=1/get(MovieObject,'FrameRate');%time interval between successive frames
    262 %     if strcmp(NomTypeIma,'*')
    263 %         set(handles.ListPairMode,'String',{'series(Di)'})
    264 %         time=(dt*(0:MaxIndex_i-1))';%list of image times
    265 %     else
    266 %         set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}])
    267 %         time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times
    268 %         enable_j(handles,'on')
    269 %     end
    270 %     TimeUnit='s';
    271 %     set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter
    272 % end
    273256
    274257%% timing display
     
    288271    time=time+0.001*(MinIndex_j:MaxIndex_j)'*ones(1,MaxIndex_i-MinIndex_i+1);
    289272end
    290 % time=[zeros(size(time,1),1) time]; %insert a vertical line of zeros (to deal with zero file indices)
    291 % time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros
    292273CivInputData.Time=time;
    293 CivInputData.NomTypeIma=NomTypeIma;
     274CivInputData.NomTypeIma=NomTypeImaA;
    294275set(handles.civ_input,'UserData',CivInputData)
    295276set(handles.dt_unit,'String',['dt in m' TimeUnit]);%display dt in unit 10-3 of the time (e.g ms)
    296277set(handles.TimeUnit,'String',TimeUnit);
    297 % set(handles.nb_field,'String',num2str(MaxIndex_i));
    298 % set(handles.nb_field2,'String',num2str(MaxIndex_j));
    299 
    300278set(handles.CoordUnit,'String',CoordUnit)
    301279set(handles.SearchRange,'UserData', pxcm_search);
     
    597575% end
    598576set(handles.PairIndices,'Visible','on')
    599 set(handles.Civ1_ImageB,'Visible','on')
    600 set(handles.TitleSubdirCiv1,'Visible','on')
     577%set(handles.Civ1_ImageB,'Visible','on')
     578%set(handles.TitleSubdirCiv1,'Visible','on')
    601579if opening==0
    602580    errormsg=find_netcpair_civ(handles,1); % select the available netcdf files
     
    607585if max(checkbox(4:6))% case of civ2 pair choice needed
    608586    set(handles.TitlePairCiv2,'Visible','on')
    609     set(handles.TitleSubdirCiv2,'Visible','on')
    610     set(handles.Civ2_ImageA,'Visible','on')
     587%    set(handles.TitleSubdirCiv2,'Visible','on')
     588%    set(handles.Civ2_ImageA,'Visible','on')
    611589    %set(handles.ListSubdirCiv2,'Visible','on')
    612590    set(handles.ListPairCiv2,'Visible','on')
     
    618596    end
    619597else
    620     set(handles.TitleSubdirCiv2,'Visible','off')
    621     set(handles.Civ2_ImageA,'Visible','off')
     598%    set(handles.TitleSubdirCiv2,'Visible','off')
     599%    set(handles.Civ2_ImageA,'Visible','off')
    622600    set(handles.ListPairCiv2,'Visible','off')
    623601end
     
    11181096
    11191097%% reads .nc subdirectoy and image numbers from the interface
    1120 SubDirImages=get(handles.Civ1_ImageA,'String');
     1098%SubDirImages=get(handles.Civ1_ImageA,'String');
    11211099%TODO: determine
    1122 subdir_civ1=[SubDirImages get(handles.Civ1_ImageB,'String')];%subdirectory subdir_civ1 for the netcdf data
    1123 subdir_civ2=[SubDirImages get(handles.Civ2_ImageA,'String')];%subdirectory subdir_civ2 for the netcdf data
     1100%subdir_civ1=[SubDirImages get(handles.Civ1_ImageB,'String')];%subdirectory subdir_civ1 for the netcdf data
     1101%subdir_civ2=[SubDirImages get(handles.Civ2_ImageA,'String')];%subdirectory subdir_civ2 for the netcdf data
    11241102ref_i=str2double(get(handles.ref_i,'String'));
    11251103ref_j=[];
     
    11421120select=ones(size(1:nbpair));%flag for displayed pairs =1 for display
    11431121testpair=0;
    1144 RootPath=get(handles.RootPath,'String');
    1145 RootFile=get(handles.Civ2_ImageB,'String');
     1122% RootPath=get(handles.RootPath,'String');
     1123% RootFile=get(handles.Civ2_ImageB,'String');
    11461124nbpair=200; %default
    1147 if index==1 % case civ1
    1148     if ~get(handles.CheckCiv1,'Value') %
    1149         if ~exist(fullfile(RootPath,subdir_civ1),'dir')
    1150             errormsg=['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist'];
    1151             set(handles.ListPairCiv1,'String',{});
    1152             return
    1153         end
    1154         for ipair=1:nbpair
    1155             filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,...
    1156                 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair));
    1157             select(ipair)=exist(filename,'file')==2;% put flag to 0 if the file does not exist
    1158         end
    1159         % case of no displayed pair
    1160         if isequal(select,zeros(size(1:nbpair)))
    1161             if isfield(browse,'incr_pair') && ~isequal(browse.incr_pair,[0 0])
    1162                 num_i1=ref_i-floor(browse.incr_pair(1)/2);
    1163                 num_i2=ref_i+ceil(browse.incr_pair(1)/2);
    1164                 num_j1=ref_j-floor(browse.incr_pair(2)/2);
    1165                 num_j2=ref_j+ceil(browse.incr_pair(2)/2);
    1166                 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2);
    1167                 select(1)=exist(filename,'file')==2;
    1168                 testpair=1;
    1169             else
     1125% if index==1 % case civ1
     1126%     if ~get(handles.CheckCiv1,'Value') %
     1127%         if ~exist(fullfile(RootPath,subdir_civ1),'dir')
     1128%             errormsg=['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist'];
     1129%             set(handles.ListPairCiv1,'String',{});
     1130%             return
     1131%         end
     1132%         for ipair=1:nbpair
     1133%             filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,...
     1134%                 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair));
     1135%             select(ipair)=exist(filename,'file')==2;% put flag to 0 if the file does not exist
     1136%         end
     1137%         % case of no displayed pair
     1138%         if isequal(select,zeros(size(1:nbpair)))
     1139%             if isfield(browse,'incr_pair') && ~isequal(browse.incr_pair,[0 0])
     1140%                 num_i1=ref_i-floor(browse.incr_pair(1)/2);
     1141%                 num_i2=ref_i+ceil(browse.incr_pair(1)/2);
     1142%                 num_j1=ref_j-floor(browse.incr_pair(2)/2);
     1143%                 num_j2=ref_j+ceil(browse.incr_pair(2)/2);
     1144%                 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2);
     1145%                 select(1)=exist(filename,'file')==2;
     1146%                 testpair=1;
     1147%             else
     1148% %                 if  isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)')
     1149% %                     errormsg=['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1];
     1150% %                 else
     1151%                     errormsg=['no civ1 file available for the selected reference indices (i,j)= ' num2str(ref_i) ', ' num2str(ref_j) ' and subdirectory ' subdir_civ1];
     1152% %                 end
     1153%                 set(handles.ListPairCiv1,'String',{''});
     1154%                 %COMPLETER CAS STEREO
     1155%                 return
     1156%             end
     1157%         end
     1158%     end
     1159% else %case civ2 alone
     1160%     if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value')
     1161%         if ~exist(fullfile(RootPath,subdir_civ2),'dir')
     1162%             msgbox_uvmat('ERROR',['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist'])
     1163%             set(handles.ListPairCiv2,'Value',1);
     1164%             set(handles.ListPairCiv2,'String',{''});
     1165%             return
     1166%         end
     1167%         for ipair=1:nbpair
     1168%             filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,...
     1169%                 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair));
     1170%             select(ipair)=exist(filename,'file')==2;
     1171%         end
     1172%         if  isequal(select,zeros(size(1:nbpair)))
     1173%             if isfield(browse,'incr_pair')
     1174%                 num_i1=ref_i-floor(browse.incr_pair(1)/2);
     1175%                 num_i2=ref_i+floor((browse.incr_pair(1)+1)/2);
     1176%                 num_j1=ref_j-floor(browse.incr_pair(2)/2);
     1177%                 num_j2=ref_j+floor((browse.incr_pair(2)+1)/2);
     1178%                 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2);
     1179%                 select(1)=exist(filename,'file')==2;
     1180%             else
    11701181%                 if  isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)')
    1171 %                     errormsg=['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1];
     1182%                     errormsg=['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2];
    11721183%                 else
    1173                     errormsg=['no civ1 file available for the selected reference indices (i,j)= ' num2str(ref_i) ', ' num2str(ref_j) ' and subdirectory ' subdir_civ1];
     1184%                     errormsg=['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2];
    11741185%                 end
    1175                 set(handles.ListPairCiv1,'String',{''});
    1176                 %COMPLETER CAS STEREO
    1177                 return
    1178             end
    1179         end
    1180     end
    1181 else %case civ2 alone
    1182     if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value')
    1183         if ~exist(fullfile(RootPath,subdir_civ2),'dir')
    1184             msgbox_uvmat('ERROR',['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist'])
    1185             set(handles.ListPairCiv2,'Value',1);
    1186             set(handles.ListPairCiv2,'String',{''});
    1187             return
    1188         end
    1189         for ipair=1:nbpair
    1190             filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,...
    1191                 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair));
    1192             select(ipair)=exist(filename,'file')==2;
    1193         end
    1194         if  isequal(select,zeros(size(1:nbpair)))
    1195             if isfield(browse,'incr_pair')
    1196                 num_i1=ref_i-floor(browse.incr_pair(1)/2);
    1197                 num_i2=ref_i+floor((browse.incr_pair(1)+1)/2);
    1198                 num_j1=ref_j-floor(browse.incr_pair(2)/2);
    1199                 num_j2=ref_j+floor((browse.incr_pair(2)+1)/2);
    1200                 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2);
    1201                 select(1)=exist(filename,'file')==2;
    1202             else
    1203                 if  isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)')
    1204                     errormsg=['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2];
    1205                 else
    1206                     errormsg=['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2];
    1207                 end
    1208                 set(handles.ListPairCiv2,'Value',1);
    1209                 set(handles.ListPairCiv2,'String',{''});
    1210                 return
    1211             end
    1212         end
    1213     end
    1214 end
     1186%                 set(handles.ListPairCiv2,'Value',1);
     1187%                 set(handles.ListPairCiv2,'String',{''});
     1188%                 return
     1189%             end
     1190%         end
     1191%     end
     1192% end
    12151193
    12161194%% determine the menu display in .ListPairCiv1
     
    21812159% --- Executes on button press in TestCiv2.
    21822160function TestCiv2_Callback(hObject, eventdata, handles)
    2183 
    2184 
    2185 
  • trunk/src/series/civ_series.m

    r635 r637  
    208208        end
    209209end
    210 if ~isempty(find(strcmp(FileType_A,{'mmreader','video'})))% case of video input
     210if isempty(time) && ~isempty(find(strcmp(FileType_A,{'mmreader','video'})))% case of video input
    211211    time=zeros(2,FileInfo_A.NumberOfFrames+1);
    212212    time(2,:)=(0:1/FileInfo_A.FrameRate:(FileInfo_A.NumberOfFrames)/FileInfo_A.FrameRate);
     
    215215    ColorType='truecolor';
    216216end
     217if isempty(time)% time = index i +0.001 index j by default
     218    time=(MinIndex_i:MaxIndex_i)'*ones(1,MaxIndex_j-MinIndex_j+1);
     219    time=time+0.001*ones(MaxIndex_i-MinIndex_i+1,1)*(MinIndex_j:MaxIndex_j);
     220    time=[zeros(1,MaxIndex_j-MinIndex_j+1);time];% insert a first line of zeros
     221    time=[zeros(MaxIndex_i-MinIndex_i+2,1) time];% insert a first column of zeros
     222end
     223   
    217224if length(FileInfo_A) >1 %case of image with multiple frames
    218225    nbfield=length(FileInfo_A);
     
    269276            j2=j2_series_Civ1(ifield);
    270277        end
    271         Data.Civ1_Time=(time(j2+1,i2+1)+time(j1+1,i1+1))/2;
    272         Data.Civ1_Dt=time(j2+1,i2+1)-time(j1+1,i1+1);
     278        Data.Civ1_Time=(time(i2+1,j2+1)+time(i1+1,j1+1))/2;
     279        Data.Civ1_Dt=time(i2+1,j2+1)-time(i1+1,j1+1);
    273280        for ilist=1:length(list_param)
    274281            Data.(Civ1_param{4+ilist})=Param.ActionInput.Civ1.(list_param{ilist});
Note: See TracChangeset for help on using the changeset viewer.