Changeset 372


Ignore:
Timestamp:
Jan 16, 2012, 12:28:26 AM (12 years ago)
Author:
sommeria
Message:

many bugs repaired.

Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r371 r372  
    13481348            Param.Civ2.ImageB=filecell.ima2.civ2{ifile,j};
    13491349            if ~checkframe %&& size(time,1)>=i2_civ2(ifile) && size(time,2)>=j2_civ2(j)
    1350                 Param.Civ2.Dt=num2str(time(i2_civ2(ifile)+1,j2_civ2(j)+1)-time(i1_civ2(ifile)+1,j1_civ2(j)+1));
     1350                Param.Civ2.Dt=time(i2_civ2(ifile)+1,j2_civ2(j)+1)-time(i1_civ2(ifile)+1,j1_civ2(j)+1);
    13511351            else
    13521352                Param.Civ2.Dt=1;
    13531353            end
    1354             Param.Civ2.Time=num2str((time(i2_civ2(ifile)+1,j2_civ2(j)+1)+time(i1_civ2(ifile)+1,j1_civ2(j)+1))/2);
     1354            Param.Civ2.Time=(time(i2_civ2(ifile)+1,j2_civ2(j)+1)+time(i1_civ2(ifile)+1,j1_civ2(j)+1))/2;
    13551355            Param.Civ2.term_a=num2stra(j1_civ2(j),nom_type_nc);
    13561356            Param.Civ2.term_b=num2stra(j2_civ2(j),nom_type_nc);
  • trunk/src/civ_matlab.m

    r370 r372  
    282282    end
    283283    Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param {'Civ2_Time','Civ2_Dt'}];
    284     Data.Civ2_Time=str2double(par_civ2.Time);
    285     Data.Civ2_Dt=str2double(par_civ2.Dt);
     284%     Data.Civ2_Time=par_civ2.Time;
     285%     Data.Civ2_Dt=par_civ2.Dt;
    286286    nbvar=numel(Data.ListVarName);
    287287    Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C'}];%  cell array containing the names of the fields to record
  • trunk/src/find_file_series.m

    r371 r372  
    3737%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    3838
    39 function [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,fileinput)
     39function [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,fileinput,option)
    4040%------------------------------------------------------------------------
    41 
     41if ~exist('option','var')
     42    option='all';
     43end
    4244%% get input root name and nomenclature type
    4345[tild,tild,RootFile,tild,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fileinput);
     
    103105end
    104106
    105 if strcmp(NomType,'')||strcmp(NomType,'*')
     107if strcmp(NomType,'')||strcmp(NomType,'*')||strcmp(option,'filetype')
    106108    if exist(fullfileinput,'file')
    107109        [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing)
     
    251253        NomType='';
    252254    else
    253         [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ifile_min).name);
    254     end
     255        [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ifile_min).name);% update the representation of indices (number of 0 before the number)
     256    end
     257end
     258
     259%% update the file type if the input file does not exist (pb of 0001)
     260if strcmp(option,'filetype')
     261    return
     262elseif isempty(FileType)
     263    [tild,tild, tild,tild,tild,tild,FileType,Object]=find_file_series(RootPath,dirpair(ifile_min).name,'filetype');
    255264end
    256265
  • trunk/src/fullfile_uvmat.m

    r371 r372  
    4848    j2=[];
    4949end
     50if ~exist('j1','var')
     51    j1=[];
     52end
    5053if isequal(j1,j2)
    5154    j2=[];% suppress the secodn index if equal to the first
    52 end
    53 if ~exist('j1','var')
    54     j1=1;
    5555end
    5656if ~exist('i2','var')
  • trunk/src/proj_field.m

    r329 r372  
    249249                    eval(['ProjData.' VarName '(ipoint,1)=mean(Var);'])
    250250                    if isequal(ObjectData.ProjMode,'interp')
    251                          eval(['ProjData.' VarName '(ipoint,1)=griddata_uvmat(coord_x(indsel),coord_y(indsel),Var,Xpoint(1),Xpoint(2)))';])
     251                         ProjData.(VarName)(ipoint,1)=griddata_uvmat(coord_x(indsel),coord_y(indsel),Var,Xpoint(1),Xpoint(2));
    252252                    end
    253253               end
     
    15561556    end
    15571557end
    1558 ProjData
    1559 ProjData.VarDimName{3}
    15601558
    15611559%-----------------------------------------------------------------
  • trunk/src/read_civdata.m

    r364 r372  
    7575     return
    7676end
     77switch vel_type_out_cell{ichoice}
     78    case{'civ1','fix1','patch1'}
     79        Field.dt=Field.Civ1_Dt;
     80    case{'civ2','fix2','patch2'}
     81        Field.dt=Field.Civ2_Dt;
     82end
     83Field.ListGlobalAttribute=[Field.ListGlobalAttribute {'dt'}];
    7784var_ind=find(vardetect);
    7885for ivar=1:min(numel(var_ind),numel(Field.VarAttribute))
  • trunk/src/series.m

    r371 r372  
    454454[RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput);
    455455
    456 %% determine reference field indices
     456%% determine the selected reference field indices for pair dispaly
    457457ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV
    458458if ~isempty(i1)
     
    460460    if ~isempty(i2)
    461461        ref_i=floor((ref_i+i2)/2);% reference image number corresponding to the file
    462 %         SeriesData.browse_Di=i2-i1;
    463462    end
    464463end
    465464set(handles.ref_i,'String',num2str(ref_i));
    466 set(handles.num_first_i,'String',num2str(ref_i));
    467 set(handles.num_last_i,'String',num2str(ref_i));
    468465ref_j=1; %default  ref_j is a reference frame index used to find existing pairs from PIV
    469466if ~isempty(j1)
     
    471468    if ~isempty(j2)
    472469        ref_j=floor((j1+j2)/2);
    473 %         SeriesData.browse_Dj=j2-j1;
    474470    end         
    475471end
    476472set(handles.ref_j,'String',num2str(ref_j));
     473ref_i_Callback([],[], handles)
     474ref_j_Callback([],[], handles)
     475
     476%% update the first and last reference indices if empty
     477first_i=str2num(get(handles.num_first_i,'String'));
     478if isempty(first_i)
     479set(handles.num_first_i,'String',num2str(ref_i));
     480set(handles.num_last_i,'String',num2str(ref_i));
    477481set(handles.num_first_j,'String',num2str(ref_j))
    478482set(handles.num_last_j,'String',num2str(ref_j));
    479 TimeUnit=''; %default
    480 time=[];%default
    481 
    482 % read timing and total frame number from the current file (movie files) !! may be overrid by xml file
    483 FileBase=fullfile(RootPath,RootFile);
    484 
    485 testima=0; %test for image input
    486 if isequal(lower(FileExt),'.avi') %.avi file
    487     testima=1;
    488 elseif ~isempty(imformats(FileExt(2:end)))
    489     testima=1;
    490 elseif isequal(FileExt,'.vol')
    491      testima=1;
    492 end
     483end
     484
     485%
     486% % FileBase=fullfile(RootPath,RootFile);
     487% TimeUnit=''; %default
     488% time=[];%default
     489% testima=0; %test for image input
     490% if isequal(lower(FileExt),'.avi') %.avi file
     491%     testima=1;
     492% elseif ~isempty(imformats(FileExt(2:end)))
     493%     testima=1;
     494% elseif isequal(FileExt,'.vol')
     495%      testima=1;
     496% end
    493497
    494498%% fill the list of file series
    495 
    496 % insert the current file series at the head of the list
    497499InputTable=get(handles.InputTable,'Data');
    498 if addtest %insert the new data at the first line of the table
     500if addtest % display the input data as a new line in the table
    499501     val=size(InputTable,1)+1;
    500502     InputTable(val,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
     
    502504else % or re-initialise the list of  input  file series
    503505    val=1;
    504     InputTable=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]
     506    InputTable=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    505507    set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}])
    506508    set(handles.MinIndex,'Data',[{[]},{[]}])
     
    510512check_lines(val)=1; %select the edited line for refresh
    511513set(handles.REFRESH_INDICES,'UserData',check_lines);
     514
     515%% refresh menus with info fromthe new series
    512516REFRESH_INDICES_Callback([],[], handles)
    513517
    514 %store the root name for future opening of uvmat
     518%% store the root name for future opening of uvmat
    515519dir_perso=prefdir;
    516520profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     
    10881092%------------------------------------------------------------------------
    10891093%% Read parameters from series
    1090 Series=read_GUI(handles.series)%TODO: extend to all input param
     1094Series=read_GUI(handles.series);%TODO: extend to all input param
    10911095Series.hseries=handles.series; % handles to the series GUI
    10921096
     
    12721276%% RUN ACTION
    12731277Series.Action=action;%name of the processing programme
    1274 Series
    12751278set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
    12761279h_fun(Series);
     
    13441347mode=mode_list{mode_value};
    13451348SeriesData=get(handles.series,'UserData');
    1346 %NomTypeCell=get(handles.NomType,'String');
    1347 NomTypeCell=SeriesData.NomType;
    1348 if ~isempty(NomTypeCell)
    1349 Val=get(handles.NomType,'Value');
    1350 NomType=NomTypeCell{Val};
    1351 % for ilist=1:length(NomType)
    1352     if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')
    1353         if isequal(mode,'series(Di)')
    1354             find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
    1355 %             break
    1356         end
     1349if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)
     1350    if isequal(mode,'series(Di)')
     1351        find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
    13571352    end
    13581353end
     
    13651360mode=mode_list{mode_value};
    13661361SeriesData=get(handles.series,'UserData');
    1367 NomTypeCell=SeriesData.NomType;
    1368 if ~isempty(NomTypeCell)
    1369     Val=get(handles.NomType,'Value');
    1370     NomType=NomTypeCell{Val};
    1371     if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')
    1372         if isequal(mode,'series(Dj)')
    1373             find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
    1374         end
    1375     end
    1376 end
     1362if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)
     1363    if isequal(mode,'series(Di)')
     1364        find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
     1365    end
     1366end
     1367% NomTypeCell=SeriesData.NomType;
     1368% if ~isempty(NomTypeCell)
     1369%     Val=get(handles.NomType,'Value');
     1370%     NomType=NomTypeCell{Val};
     1371%     if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')
     1372%         if isequal(mode,'series(Dj)')
     1373%             find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
     1374%         end
     1375%     end
     1376% end
    13771377
    13781378%------------------------------------------------------------------------
     
    14971497% FileExt=get(handles.FileExt,'String');
    14981498% nb_series=length(FileExt);
    1499 InputFiles=get(handles.InputTable,'Data')
    1500 FileExt=InputFiles(:,5);
    1501 checkcell=find(cellfun('isempty',FileExt)~=0);
    1502 nb_series=0;
    1503 if ~isempty(checkcell)
    1504 nb_series=checkcell(end);
    1505 end
     1499InputTable=get(handles.InputTable,'Data');
     1500nb_series=size(InputTable,1);
     1501% if ~isempty(checkcell)
     1502% nb_series=checkcell(end);
     1503% end
    15061504% nb_series=size(InputFiles,1)
    15071505testima_series=1; %test for a list of images only
     
    15101508testciv_series=1;
    15111509for iview=1:nb_series
    1512      ext=FileExt{iview};
     1510     ext=InputTable{iview,5};
    15131511    if length(ext)<2
    15141512        ext='.none';
     
    15271525for ilist=1:length(varargout)-1
    15281526    switch varargout{ilist}
     1527
    15291528                       %RootFile always visible
    15301529%          case 'RootPath'   %visible by default
     
    15591558            end
    15601559        case 'VelTypeMenu'   %hidden by default
    1561             if isequal(lower(varargout{ilist+1}),'one') || isequal(lower(varargout{ilist+1}),'two')
     1560             if isequal(lower(varargout{ilist+1}),'one') || isequal(lower(varargout{ilist+1}),'two')
    15621561                set(handles.VelTypeMenu,'Enable','on')
    15631562                if nb_series >=1 && ~testima_series
    15641563                    set(handles.VelTypeMenu,'Visible','on')
    15651564                    set(handles.VelType_text,'Visible','on');
    1566                     set(handles.Field_frame,'Visible','on')
     1565%                     set(handles.Field_frame,'Visible','on')
    15671566                end
    1568             end
     1567             end
    15691568            if isequal(lower(varargout{ilist+1}),'two')
    15701569                set(handles.VelTypeMenu_1,'Enable','on')
     
    21462145        %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2})
    21472146        %update file series defined by the selected line
    2148         [InputTable{ind_list,1},InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list);
     2147        [InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list);
    21492148        if ~isempty(errormsg)
    21502149                msgbox_uvmat('ERROR',errormsg)
     
    21842183    ListView_Callback(hObject,eventdata,handles)
    21852184end
    2186 set(handles.Pairs,'Visible',state_InputFields)
     2185set(handles.Pairs,'Visible',state_Pairs)
    21872186enable_j(handles,state_j)
    21882187set(handles.REFRESH_INDICES,'BackgroundColor',[1 0 0])
    21892188set(handles.REFRESH_INDICES,'visible','off')
    21902189
    2191 % update min and max indices for a series
    2192 function [RootPath,RootFile,NomType,errormsg]=update_indices(handles,fileinput,iview)
    2193 
     2190% -----------------------------------------------------------------------
     2191% --- Update min and max indices of a file series by scanning with find_file_series
     2192% --- which also changes the root file and NomType in case of movie. Also adjust the string representation of indices (e.g;
     2193% --- 1 or 001 by the function find_file_series
     2194% --- This function also dispaly the set of availbale files in the series
     2195% --- and the menus appropriate to the file type as well as timing possibly set
     2196% --- by an xml image documentation file
     2197function [RootFile,NomType,errormsg]=update_indices(handles,fileinput,iview)
     2198% -----------------------------------------------------------------------
    21942199%% look for min and max indices existing in the file series and update SeriesData
    21952200errormsg='';
    2196 [RootPath,FileName,FileExt]=fileparts(fileinput);
    2197 [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,[FileName FileExt]);
     2201[RootPathSub,FileName,FileExt]=fileparts(fileinput);
     2202[RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPathSub,[FileName FileExt]);
    21982203if isempty(RootFile)&&isempty(i1_series)
    21992204    errormsg='no input file in the series';
     
    22292234SeriesData.FileType{iview}=FileType;
    22302235
    2231 %% represents the set of existing files as an image
     2236%% display the set of existing files as an image
    22322237set(handles.waitbar_frame,'Units','pixels')
    22332238pos=get(handles.waitbar_frame,'Position');
     
    22592264testveltype_1=isequal(get(handles.VelTypeMenu_1,'enable'),'on');
    22602265testtransform=isequal(get(handles.transform_fct,'Enable'),'on');
    2261 testnc=0;
    2262 testnc_1=0;
    2263 testcivx=0;
    2264 testcivx_1=0;
     2266% testnc=0;
     2267% testnc_1=0;
     2268% testcivx=0;
     2269% testcivx_1=0;
     2270% testima=0; %test for image input
     2271% if isequal(lower(FileExt),'.avi') %.avi file
     2272%     testima=1;
     2273% elseif ~isempty(imformats(FileExt(2:end)))
     2274%     testima=1;
     2275% elseif isequal(FileExt,'.vol')
     2276%      testima=1;
     2277% end
    22652278%TODO: update
    22662279% if length(FileExtCell)==1 || length(FileExtCell)>2
     
    22792292%     testcivx_1=isequal(FileTypeCell{2},'civx');
    22802293% end
    2281 if testfield && testnc
     2294switch FileType
     2295    case {'civx','civdata'}
    22822296    view_FieldMenu(handles,'on')
    2283     if testcivx
    2284         menustr=get(handles.FieldMenu,'String');
    2285         if isequal(menustr,{'get_field...'})
    2286             set(handles.FieldMenu,'String',{'get_field...';'velocity';'vort';'div';'more...'})
    2287         end
    2288     else
    2289         set(handles.FieldMenu,'Value',1)
    2290         set(handles.FieldMenu,'String',{'get_field...'})
    2291     end
    2292 else
     2297    menustr=get(handles.FieldMenu,'String');
     2298    if isequal(menustr,{'get_field...'})
     2299        set(handles.FieldMenu,'String',{'get_field...';'velocity';'vort';'div';'more...'})
     2300    end
     2301    set(handles.VelTypeMenu,'Visible','on')
     2302    set(handles.FieldTransform,'Visible','on')
     2303    %      view_TRANSFORM(handles,'on')
     2304    %     TODO: second menu
     2305    %           view_FieldMenu_1(handles,'on')
     2306    %     if testcivx_1
     2307    %         menustr=get(handles.FieldMenu_1,'String');
     2308    %         if isequal(menustr,{'get_field...'})
     2309    %             set(handles.FieldMenu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'})
     2310    %         end
     2311    %     else
     2312    %         set(handles.FieldMenu_1,'Value',1)
     2313    %         set(handles.FieldMenu_1,'String',{'get_field...'})
     2314    %     set(handles.VelTypeMenu_1,'Visible','on')
     2315    %     set(handles.VelType_text_1,'Visible','on');
     2316    %     end
     2317    %     view_FieldMenu_1(handles,'off')
     2318    case 'netcdf'
     2319    view_FieldMenu(handles,'on')
     2320    set(handles.FieldMenu,'Value',1)
     2321    set(handles.FieldMenu,'String',{'get_field...'})
     2322    set(handles.FieldTransform,'Visible','off')
     2323    %     view_TRANSFORM(handles,'off')
     2324    case {'image','multimage','video'}
    22932325    view_FieldMenu(handles,'off')
    2294 end
    2295 if testfield_1 && testnc_1
    2296     view_FieldMenu_1(handles,'on')
    2297     if testcivx_1
    2298         menustr=get(handles.FieldMenu_1,'String');
    2299         if isequal(menustr,{'get_field...'})
    2300             set(handles.FieldMenu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'})
    2301         end
    2302     else
    2303         set(handles.FieldMenu_1,'Value',1)
    2304         set(handles.FieldMenu_1,'String',{'get_field...'})
    2305     end
    2306 else
    23072326    view_FieldMenu_1(handles,'off')
    2308 end
    2309 if testveltype && testcivx
    2310     set(handles.VelTypeMenu,'Visible','on')
    2311     set(handles.VelType_text,'Visible','on');
    2312 else
    23132327    set(handles.VelTypeMenu,'Visible','off')
    23142328    set(handles.VelType_text,'Visible','off');
    23152329end
    2316 if testveltype_1 && testcivx_1
    2317     set(handles.VelTypeMenu_1,'Visible','on')
    2318     set(handles.VelType_text_1,'Visible','on');
    2319 else
    2320     set(handles.VelTypeMenu_1,'Visible','off')
    2321     set(handles.VelType_text_1,'Visible','off');
    2322 end
    2323 if testtransform && (testcivx || testima)
    2324     set(handles.FieldTransform,'Visible','on')
    2325 %      view_TRANSFORM(handles,'on')
    2326 else
    2327     set(handles.FieldTransform,'Visible','off')
    2328 %     view_TRANSFORM(handles,'off')
    2329 end
     2330
     2331
    23302332%TODO:update
    23312333% if ~isequal(FileExt,'.nc') && ~isequal(FileExt,'.cdf') && ~testima
     
    23362338%%  read image documentation file  if found%%%%%%%%%%%%%%%%%%%%%%%%%%%
    23372339ext_imadoc='';
    2338 FileBase=fullfile(RootPath,RootFile);
     2340FileBase=fullfile(RootPathSub,RootFile);
    23392341if isequal(FileExt,'.xml')||isequal(FileExt,'.civ')
    23402342    ext_imadoc=FileExt;
Note: See TracChangeset for help on using the changeset viewer.