Changeset 41 for trunk/src/series


Ignore:
Timestamp:
Mar 10, 2010, 11:03:36 AM (15 years ago)
Author:
sommeria
Message:

-relabel_i_j: improve the question dlg box for image transform
-aver_stat,time_series,merge_proj: include modification of field transform and call of set_object.
-series: introduce a browser for set_object
-ima2vol: create volume images (png images of a slice concacened along y) for PIV 3D
-set_object: suppress TITLE, introduce Tooltip helps for parameters
-civ: fixed bug on BATCH sequences

Location:
trunk/src/series
Files:
1 added
4 edited

Legend:

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

    r38 r41  
    3232WaitbarPos=get(hseries.waitbar_frame,'Position');
    3333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     34
     35%projection object
     36test_object=get(hseries.GetObject,'Value');
     37if test_object%isfield(Series,'sethandles')
     38    hset_object=findobj(allchild(0),'Name','set_object');
     39    ProjObject=read_set_object(guidata(hset_object));
     40    %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]});
     41    answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' ProjObject.Style ' before averaging']);
     42    if ~isequal(answeryes,'Yes')
     43        return
     44    end
     45end
     46
    3447%root input file and type
    3548if ~iscell(Series.RootPath)% case of a single input field series
     
    145158end
    146159if ~isequal(FieldName,{'get_field...'})
     160    if isequal(FieldName,{''}) && ~testima
     161        msgbox_uvmat('ERROR','an input field needs to be selected')
     162        return
     163    end
    147164    testcivx=testnc;
    148165end
     
    235252% Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
    236253subdir_result='aver_stat';
    237 % filebasesub=fullfile(RootPath{1},subdir_result,RootFile{1});
    238 % if isempty(SubDir{1}) % create a subdirectory '/aver_stat'
    239 %     subdir_result='aver_stat';
    240 %     filebasemean=fullfile(RootPath{1},subdir_result);
    241254if ~exist(fullfile(RootPath{1},subdir_result),'dir')
    242255    dircur=pwd; %record current working directory
     
    249262end
    250263filebase_out=filebase{1};
    251 % else
    252 %    subdir_result=SubDir{1};
    253 %    filebase_out=[filebase{1} '_mean'];% output root name obtained by adding the suffix _mean to the input
    254 % end
    255 %output nomtype (to generalise)
    256264NomTypeOut=nomtype2pair(NomType{1},num_i2{end}(end)-num_i1{1}(1),num_j2{end}(end)-num_j1{1}(1));
    257    
    258 % if NbSlice==1 
    259 %     filebase_out=[filebasesub '_mean'];
    260 % else
    261 %     filebase_out=[filebasesub '_' NbSlice_name 'mean'];
    262 %     answeryes=questdlg({['will make average in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']});
    263 %     if ~isequal(answeryes,'Yes')
    264 %         return
    265 %     end
    266 % end
    267265
    268266% coordinate transform or other user defined transform
    269 Coord_menu=get(hseries.CoordType,'String');
    270 menu_val=get(hseries.CoordType,'Value');
    271 usrfct=Coord_menu{menu_val};
    272 testfct=~isequal(usrfct,'');
     267transform_fct=[];%default
     268if isfield(Series,'transform_fct')
     269    transform_fct=Series.transform_fct;
     270end
    273271
    274272%slice loop
     
    312310             end   
    313311             % coordinate transform (or other user defined transform)
    314              if ~isequal(Series.CoordType,'')
     312             if ~isempty(transform_fct)
    315313                 % z index
    316314                if ~isempty(NbSlice_calib)
     
    318316                end
    319317                if nbview==2
    320                     [Data{1},Data{2}]=feval(Series.CoordType,Data{1},XmlData{1},Data{2},XmlData{2});
     318                    [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
    321319                    if isempty(Data{2})
    322320                        Data(2)=[];
    323321                    end
    324322                else
    325                     Data{1}=feval(Series.CoordType,Data{1},XmlData);
     323                    Data{1}=transform_fct(Data{1},XmlData);
    326324                end
    327325             end     
     
    338336                Field=Data{1};
    339337            end
    340             if isfield(Series,'ProjObject')
    341                 [Field,errormsg]=proj_field(Field,Series.ProjObject);
     338            if test_object
     339                [Field,errormsg]=proj_field(Field,ProjObject);
    342340                 if ~isempty(errormsg)
    343341                    msgbox_uvmat('ERROR',['error in aver_stat/proj_field:' errormsg])
  • trunk/src/series/merge_proj.m

    r29 r41  
    2323WaitbarPos=get(hseries.waitbar_frame,'Position'); %positiopn of waitbar frame
    2424%-------------------------------------------------
     25
     26%projection object
     27test_object=get(hseries.GetObject,'Value');
     28if test_object
     29    hset_object=findobj(allchild(0),'Name','set_object');
     30    ProjObject=read_set_object(guidata(hset_object));
     31    if ~isfield(ProjObject,'Style')
     32            msgbox_uvmat('ERROR','Undefined projection object style')
     33            return
     34    end
     35    if ~isequal(ProjObject.Style,'plane')
     36            msgbox_uvmat('ERROR','The projection object must be a plane')
     37            return
     38    end
     39    %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]});
     40    answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' ProjObject.Style]);
     41    if ~isequal(answeryes,'Yes')
     42        return
     43    end
     44end
    2545
    2646%numbers of view fields (nbre of inputs in RootPath)
     
    125145end
    126146
     147% coordinate transform or other user defined transform
     148transform_fct=[];%default
     149if isfield(Series,'transform_fct')
     150    transform_fct=Series.transform_fct;
     151end
     152
    127153% Field and velocity type (the same for all views)
    128154Field_str=get(hseries.FieldMenu,'String');
     
    170196    testcivx=testnc;
    171197end
     198
    172199%name of output files and directory:
    173200% res_subdir=fullfile(Series.RootPath{1},[Series.SubDir{1} '_STAT']);
     
    178205if isequal(length(RootPath),1)
    179206    fulldir=RootPath{1};
    180     subdir='GRID';
     207    subdir='merge_proj';
    181208    res_subdir=fullfile(fulldir,subdir);
    182209else
     
    209236filebasesub=fullfile(res_subdir,Series.RootFile{1});
    210237filebase_merge=fullfile(res_subdir,'merged');%root name for the merged files
    211 
    212 %projection object
    213 if isfield(Series,'sethandles')
    214     if ishandle(Series.sethandles.set_object)
    215         Series.ProjObject=read_set_object(Series.sethandles);
    216         if ~isfield(Series.ProjObject,'Style')
    217             msgbox_uvmat('ERROR','Undefined projection object style')
    218             return
    219         end
    220         if ~isequal(Series.ProjObject.Style,'plane')
    221             msgbox_uvmat('ERROR','The projection object must be a plane')
    222             return
    223         end
    224     end
    225 end
    226238
    227239    %MAIN LOOP
     
    271283                Field{iview}.ZIndex=mod(num_i1{iview}(ifile)-1,NbSlice_calib{1})+1;
    272284            end
    273             if ~isequal(transform,'')
    274                 Field{iview}=feval(Series.CoordType,Field{iview},XmlData{iview});%transform to phys if requested
     285            if ~isempty(transform_fct)
     286                Field{iview}=transform_fct(Field{iview},XmlData{iview});%transform to phys if requested
    275287            end
    276288            if testcivx
     
    279291
    280292            %projection on object (gridded plane)
    281             if isfield(Series,'ProjObject')
    282                 Field{iview}=proj_field(Field{iview},Series.ProjObject);
     293            if test_object
     294                Field{iview}=proj_field(Field{iview},ProjObject);
    283295            end
    284296        end   
  • trunk/src/series/relabel_i_j.m

    r40 r41  
    2929nbfield2=size(XmlData.Time,2)
    3030
    31 answer=msgbox_uvmat('CONFIRMATION','apply image rescaling function levels.m')
     31answer=msgbox_uvmat('INPUT_Y-N','apply image rescaling function levels.m')
    3232test_level=isequal(answer,'Yes')
    3333
  • trunk/src/series/time_series.m

    r38 r41  
    3434%projection object
    3535test_object=get(hseries.GetObject,'Value');
    36 if test_object%isfield(Series,'sethandles')
    37     Series.ProjObject=read_set_object(Series.sethandles);
     36if test_object
     37    hset_object=findobj(allchild(0),'Name','set_object');
     38    ProjObject=read_set_object(guidata(hset_object));
    3839    %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]});
    39     answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' Series.ProjObject.Style]);
     40    answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' ProjObject.Style]);
    4041    if ~isequal(answeryes,'Yes')
    4142        return
     
    170171
    171172% Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
    172 filebasesub=fullfile(RootPath{1},RootFile{1});
    173 if NbSlice==1
    174     filebase_out=[filebasesub '_time'];
    175 else
    176     filebase_out=[filebasesub '_' NbSlice_name 'mtim'];
    177     increment=num_i1{1}(2)-num_i1{1}(1);
    178     if ~isequal(increment,1) % if an increment is set
    179         answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']);
    180     else   
    181         answeryes=msgbox_uvmat('INPUT_Y-N',{['will take time series in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']});
    182     end
    183     if ~isequal(answeryes,'Yes')
    184         return
    185     end
    186 end
     173% filebasesub=fullfile(RootPath{1},RootFile{1});
     174% if NbSlice==1
     175%     filebase_out=[filebasesub '_time'];
     176% else
     177%     filebase_out=[filebasesub '_' NbSlice_name 'mtim'];
     178%     increment=num_i1{1}(2)-num_i1{1}(1);
     179%     if ~isequal(increment,1) % if an increment is set
     180%         answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']);
     181%     else   
     182%         answeryes=msgbox_uvmat('INPUT_Y-N',{['will take time series in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']});
     183%     end
     184%     if ~isequal(answeryes,'Yes')
     185%         return
     186%     end
     187% end
    187188VelType_str=get(hseries.VelTypeMenu,'String');
    188189VelType_val=get(hseries.VelTypeMenu,'Value');
     
    269270end
    270271
    271 % image or scalar processing programme set by user
    272 Coord_menu=get(hseries.CoordType,'String');
    273 menu_val=get(hseries.CoordType,'Value');
    274 usrfct=Coord_menu{menu_val};
    275 testfct=~isequal(usrfct,'');
     272% Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
     273subdir_result='time_series';
     274% filebasesub=fullfile(RootPath{1},subdir_result,RootFile{1});
     275% if isempty(SubDir{1}) % create a subdirectory '/aver_stat'
     276%     subdir_result='aver_stat';
     277%     filebasemean=fullfile(RootPath{1},subdir_result);
     278if ~exist(fullfile(RootPath{1},subdir_result),'dir')
     279    dircur=pwd; %record current working directory
     280    cd(RootPath{1})% goes to the iamge directory
     281    [m1,m2,m3]=mkdir(subdir_result);
     282    if ~isequal(m2,'')
     283         msgbox_uvmat('CONFIRMATION',m2);%error message for directory creation
     284    end
     285    cd(dircur) %back to the initial working directory
     286end
     287filebase_out=filebase{1};
     288NomTypeOut=nomtype2pair(NomType{1},num_i2{end}(end)-num_i1{1}(1),num_j2{end}(end)-num_j1{1}(1));
     289
     290% coordinate transform or other user defined transform
     291transform_fct=[];%default
     292if isfield(Series,'transform_fct')
     293    transform_fct=Series.transform_fct;
     294end
    276295
    277296% to update:
     
    331350                end
    332351             end
    333             % geometry transform or other user defined transform
    334             if ~isequal(Series.CoordType,'')           
     352             
     353             % coordinate transform (or other user defined transform)
     354            if ~isempty(transform_fct)
     355                 % z index
     356                if ~isempty(NbSlice_calib)
     357                    Data{iview}.ZIndex=mod(num_i1{iview}(ifile)-1,NbSlice_calib{1})+1;%Zindex for phys transform
     358                end
    335359                if nbview==2
    336                     [Data{1},Data{2}]=feval(Series.CoordType,Data{1},XmlData{1},Data{2},XmlData{2});
     360                    [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
    337361                    if isempty(Data{2})
    338362                        Data(2)=[];
    339363                    end
    340364                else
    341                     Data{1}=feval(Series.CoordType,Data{1},XmlData{1});
    342                 end
    343             end
     365                    Data{1}=transform_fct(Data{1},XmlData);
     366                end
     367            end     
    344368            if testcivx
    345369                    Data{iview}=calc_field(FieldName,Data{iview});%calculate field (vort..)
     
    354378                Field=Data{1};
    355379            end
    356             if isfield(Series,'ProjObject')
    357                 Series.ProjObject
    358                 [Field,errormsg]=proj_field(Field,Series.ProjObject);
     380            if test_object
     381                [Field,errormsg]=proj_field(Field,ProjObject);
    359382                if ~isempty(errormsg)
    360383                    msgbox_uvmat('ERROR',['error in time_series/proj_field:' errormsg])
     
    393416                                end
    394417                                % check whether the variable ivar is a dimension variable
    395                                 %index=Field.VarDimIndex{ivar};%dimension indices of the variable #ivar
    396418                                DimCell=Field.VarDimName{ivar};
    397419                                if ischar(DimCell)
     
    416438                    if testsum(ivar)==2% test for recorded variable
    417439                        eval(['VarVal=Field.' VarName ';']);
    418                         if isequal(Series.ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
     440                        if isequal(ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
    419441                            if isempty(VarVal)
    420442                                msgbox_uvmat('ERROR',['empty result at frame index ' num2str(num_i1{iview}(ifile))])
Note: See TracChangeset for help on using the changeset viewer.