Changeset 1058 for trunk


Ignore:
Timestamp:
Sep 7, 2018, 8:51:09 PM (6 years ago)
Author:
sommeria
Message:

merge_proj_polar updated + other corrected bugs

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_field_cells.m

    r1057 r1058  
    1717%              _image   : B/W image, (behaves like scalar)
    1818%              _vector_x,_y,_z: indices of variables giving the vector components x, y, z
    19 %              _warnflag: index of warnflag   
     19%              _warnflag: index of warnflag
     20%              _histo: index of variable used as histogram
    2021%       .DimIndex
    2122%      .ProjModeRequest= 'interp_lin', 'interp_tps' indicate whether lin interpolation  or derivatives (tps) is needed to calculate the requested field
     
    118119end
    119120ind_discrete=find(strcmp('discrete',Role));
    120 ind_coord_x=find(strcmp('coord_x',Role));
     121ind_coord_x=[find(strcmp('coord_x',Role)) find(strcmp('histo',Role))];
    121122ind_coord_y=find(strcmp('coord_y',Role));
    122123ind_coord_z=find(strcmp('coord_z',Role));
     124ind_histo=find(strcmp('histo',Role));
    123125ind_coord_tps=find(strcmp('coord_tps',Role));
    124126check_string=cellfun(@ischar,Data.VarDimName)==1;
     
    477479        Cell1DPlot{icell}.YIndex_discrete=[];
    478480        DimCell_x=Data.VarDimName{ind_coord_x(icell)};
    479         for ivar=ind_coord_y
     481        for ivar=[ind_coord_y ind_histo]
    480482            DimCell=Data.VarDimName{ivar};
    481483            if  numel(DimCell_x)==1 && strcmp(DimCell_x{1},DimCell{1})
  • trunk/src/plot_field.m

    r1048 r1058  
    585585TextDisplay=0;
    586586for icell=1:numel(CellInfo)
    587     if isfield(CellInfo{icell},'VarIndex_histo')
     587    if isfield(CellInfo{icell},'VarIndex_histo')% case of histogram plot
    588588        TextDisplay=1;
    589589        VarName=data.ListVarName{CellInfo{icell}.CoordIndex};
  • trunk/src/proj_field.m

    r1057 r1058  
    509509        if isfield(FieldData,'VarAttribute')&& numel(FieldData.VarAttribute)>=ivar
    510510            VarAttribute_var=FieldData.VarAttribute{ivar};
     511            VarAttribute_var.Role='coord_x';
    511512        end
    512513      %  VarAttribute_var.Role='coord_x';% the variable is now used as an absissa
  • trunk/src/read_field.m

    r1045 r1058  
    265265        A=imread(FileName);
    266266    case 'rdvision'
    267         [A,FileInfo,timestamps]=read_rdvision(FileName,num);
     267        [A,FileInfo,timestamps,errormsg]=read_rdvision(FileName,num);
    268268    case 'image_DaVis'
    269269        Input=readimx(FileName);
  • trunk/src/read_rdvision.m

    r1047 r1058  
    125125      % binrepertoire='2017-01-19T22.12.182'% EXP14 %%%%%%%%%%%%%%%%%%%%%%%%%
    126126        binfile=fullfile(RootPath,binrepertoire,sprintf('%s%.5d.bin',bin_file,data(ii).file_idx));
     127        if ~exist(binfile,'file')
     128            errormsg=[binfile ' does not exist'];
     129            return
     130        else
    127131        fid=fopen(binfile,'rb');
    128132        fseek(fid,data(ii).offset,-1);
    129133        A(:,:,i)=reshape(fread(fid,w*h,classname),w,h)';
    130134        fclose(fid);
     135        end
    131136    end
    132137   
  • trunk/src/series/merge_proj.m

    r1033 r1058  
    533533                end
    534534        end
    535 %         if isempty(FFName)
    536 %             FFName='FF';
    537 %         end
    538 %         MergeData.(FFName)(NbAver~=0)=0;% flag to 1 undefined summed data
    539 %         MergeData.(FFName)(NbAver==0)=1;% flag to 1 undefined summed data
    540535    end
    541536end
  • trunk/src/series/merge_proj_polar.m

    r1027 r1058  
    100100HeadData.ListVarName= {'radius','azimuth'} ;
    101101HeadData.VarDimName={'radius','azimuth'};
    102 HeadData.VarAttribute={'coord_y','coord_x'} ;
     102HeadData.VarAttribute{1}.Role='coord_y';
     103HeadData.VarAttribute{2}.Role='coord_x';
    103104HeadData.radius=radius_shifted;
    104105HeadData.azimuth=azimuth_arclength;   
     
    373374        ProjData{iview}.ListVarName= [ProjData{iview}.ListVarName ListVarName];
    374375        ProjData{iview}.VarDimName={'radius','azimuth'};
    375         ProjData{iview}.VarAttribute=[{'coord_x'} {'coord_y'} VarAttribute];
     376%         ProjData{iview}.VarAttribute{1}.Role='coord_y';
     377%         ProjData{iview}.VarAttribute{2}.Role='coord_x';
     378        ProjData{iview}.VarAttribute=[ProjData{iview}.VarAttribute VarAttribute];
    376379        for ivar=1:numel(ListVarName)
    377380            ProjData{iview}.VarDimName{ivar+2}={'radius','azimuth'};
     
    457460disp([ num2str(ellapsed_time/(60*NbField),3) ' minutes per iteration'])
    458461
     462% %'merge_field': concatene fields
     463% %------------------------------------------------------------------------
     464% function [MergeData,errormsg]=merge_field(Data)
     465% %% default output
     466% if isempty(Data)||~iscell(Data)
     467%     MergeData=[];
     468%     return
     469% end
     470% errormsg='';
     471% MergeData=Data{1};% merged field= first field by default, reproduces the global attributes of the first field
     472% NbView=length(Data);
     473% if NbView==1% if there is only one field, just reproduce it in MergeData
     474%     return
     475% end
     476%
     477% %% group the variables (fields of 'Data') in cells of variables with the same dimensions
     478% [CellInfo,NbDim,errormsg]=find_field_cells(Data{1});
     479% if ~isempty(errormsg)
     480%     return
     481% end
     482%
     483% %LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS
     484% for icell=1:length(CellInfo)
     485%     if NbDim(icell)~=1 % skip field cells which are of dim 1
     486%         switch CellInfo{icell}.CoordType
     487%             case 'scattered'  %case of input fields with unstructured coordinates: just concatene data
     488%                 for ivar=CellInfo{icell}.VarIndex %  indices of the selected variables in the list FieldData.ListVarName
     489%                     VarName=Data{1}.ListVarName{ivar};
     490%                     for iview=2:NbView
     491%                         MergeData.(VarName)=[MergeData.(VarName); Data{iview}.(VarName)];
     492%                     end
     493%                 end
     494%             case 'grid'        %case of fields defined on a structured  grid
     495%                 FFName='';
     496%                 if isfield(CellInfo{icell},'VarIndex_errorflag') && ~isempty(CellInfo{icell}.VarIndex_errorflag)
     497%                     FFName=Data{1}.ListVarName{CellInfo{icell}.VarIndex_errorflag};% name of errorflag variable
     498%                     MergeData.ListVarName(CellInfo{icell}.VarIndex_errorflag)=[];%remove error flag variable in MergeData (will use NaN instead)
     499%                     MergeData.VarDimName(CellInfo{icell}.VarIndex_errorflag)=[];
     500%                     MergeData.VarAttribute(CellInfo{icell}.VarIndex_errorflag)=[];
     501%                 end
     502%                 % select good data on each view
     503%                 for ivar=CellInfo{icell}.VarIndex  %  indices of the selected variables in the list FieldData.ListVarName
     504%                     VarName=Data{1}.ListVarName{ivar};
     505%                     for iview=1:NbView
     506%                         if isempty(FFName)
     507%                             check_bad=isnan(Data{iview}.(VarName));%=0 for NaN data values, 1 else
     508%                         else
     509%                             check_bad=isnan(Data{iview}.(VarName)) | Data{iview}.(FFName)~=0;%=0 for NaN or error flagged data values, 1 else
     510%                         end
     511%                         Data{iview}.(VarName)(check_bad)=0; %set to zero NaN or data marked by error flag
     512%                         if iview==1
     513%                             %MergeData.(VarName)=Data{1}.(VarName);% initiate MergeData with the first field
     514%                             MergeData.(VarName)(check_bad)=0; %set to zero NaN or data marked by error flag
     515%                             NbAver=~check_bad;% initiate NbAver: the nbre of good data for each point
     516%                         elseif size(Data{iview}.(VarName))~=size(MergeData.(VarName))
     517%                             errormsg='sizes of the input matrices do not agree, need to interpolate on a common grid using a projection object';
     518%                             return
     519%                         else
     520%                             MergeData.(VarName)=MergeData.(VarName) +double(Data{iview}.(VarName));%add data
     521%                             NbAver=NbAver + ~check_bad;% add 1 for good data, 0 else
     522%                         end
     523%                     end
     524%                     MergeData.(VarName)(NbAver~=0)=MergeData.(VarName)(NbAver~=0)./NbAver(NbAver~=0);% take average of defined data at each point
     525%                     MergeData.(VarName)(NbAver==0)=NaN;% set to NaN the points with no good data
     526%                 end
     527%         end
     528%   
     529%     end
     530% end
     531
     532
    459533%'merge_field': concatene fields
    460534%------------------------------------------------------------------------
     
    469543NbView=length(Data);
    470544if NbView==1% if there is only one field, just reproduce it in MergeData
    471     return
     545    return 
    472546end
    473547
     
    514588                            errormsg='sizes of the input matrices do not agree, need to interpolate on a common grid using a projection object';
    515589                            return
    516                         else
     590                        else                             
    517591                            MergeData.(VarName)=MergeData.(VarName) +double(Data{iview}.(VarName));%add data
    518592                            NbAver=NbAver + ~check_bad;% add 1 for good data, 0 else
     
    523597                end
    524598        end
    525         %         if isempty(FFName)
    526         %             FFName='FF';
    527         %         end
    528         %         MergeData.(FFName)(NbAver~=0)=0;% flag to 1 undefined summed data
    529         %         MergeData.(FFName)(NbAver==0)=1;% flag to 1 undefined summed data
    530     end
    531 end
    532 
    533 
    534    
     599    end
     600end   
  • trunk/src/series/sub_background.m

    r1033 r1058  
    140140   
    141141    %% setting of  parameters specific to sub_background
    142     nbaver_init=23; %default number of images used for the sliding background: to be adjusted later to include an integer number of bursts 
    143     if nbfield_i~=1
     142    CheckVolume='No';
     143    nbaver_init=23; %default number of images used for the sliding background: to be adjusted later to include an integer number of bursts
     144     if nbfield_i~=1
    144145        nbaver=floor(nbaver_init/nbfield_j); % number of bursts used for the sliding background,
    145146        if isequal(mod(nbaver,2),0)% if nbaver is even
     
    148149        nbaver_init=nbaver*nbfield_j;%propose by default an integer number of bursts
    149150    end
    150    
     151    BrightnessRankThreshold=0.1;
     152    CheckSubmedian='No';
     153    SaturationCoeff=0;
     154    if isfield(Param,'ActionInput')
     155        if isfield(Param.ActionInput,'CheckVolume') && Param.ActionInput.CheckVolume
     156            CheckVolume='Yes';
     157        end
     158        if isfield(Param.ActionInput,'SlidingSequenceLength')
     159         nbaver_init=Param.ActionInput.SlidingSequenceLength;
     160        end
     161        if isfield(Param.ActionInput,'BrightnessRankThreshold')
     162          BrightnessRankThreshold=Param.ActionInput.BrightnessRankThreshold;
     163        end
     164        if isfield(Param.ActionInput,'CheckSubmedian') && Param.ActionInput.CheckSubmedian
     165        CheckSubmedian='Yes';
     166        end
     167        if isfield(Param.ActionInput,'SaturationCoeff')
     168            SaturationCoeff=Param.ActionInput.SaturationCoeff;
     169        end
     170    end   
    151171    prompt = {'volume scan mode (Yes/No)';...
    152172        'Number of images for the sliding background (MUST FIT IN COMPUTER MEMORY)';...
    153173        'the luminosity rank chosen to define the background (0.1=for dense particle seeding, 0.5 (median) for sparse particles';...
    154174        'set to 0 image levels below median(Yes/No)';...
    155         'image rescaling coefficient(high values reduce the influence of bright particles), =0 for no rescaling' };
     175        'image rescaling coefficient(=2 to reduce the influence of bright particles), =0 for no rescaling' };
    156176    dlg_title = 'get (slice by slice) a sliding background and substract to each image';
    157177    num_lines= 5;
    158     def     = { 'No';num2str(nbaver_init);'0.1';'No';'2'};
     178    def     = { CheckVolume;num2str(nbaver_init);num2str(BrightnessRankThreshold);CheckSubmedian;num2str(SaturationCoeff)};
    159179    answer = inputdlg(prompt,dlg_title,num_lines,def);
    160180    if isempty(answer)
  • trunk/src/uvmat.m

    r1057 r1058  
    26372637    Mask.NbSlice_j=1;
    26382638    if isempty(j1_series)
     2639        if isempty(i1_series)
     2640            MaskNomType='*';
     2641        else
    26392642        Mask.NbSlice_i=i1_series(1,2,end);
     2643        end
    26402644    else
    26412645        Mask.NbSlice_j=j1_series(1,end,2);
     
    26672671    MaskIndex_i=str2num(get(handles.z_index,'String'));
    26682672else
    2669     MaskIndex_i=mod(str2num(get(handles.i1,'String')),Mask.NbSlice_i);
    2670 end
     2673    MaskIndex_i=mod(str2num(get(handles.i1,'String'))-1,Mask.NbSlice_i)+1;
     2674end
     2675MaskIndex_z=MaskIndex_i;%default
    26712676if Mask.NbSlice_j>1
    26722677    MaskIndex_j=str2num(get(handles.j1,'String'));
     2678    MaskIndex_z=MaskIndex_j;
    26732679else
    26742680    MaskIndex_j=1;
     
    27022708            return
    27032709        end
    2704         MaskField.ZIndex=MaskIndex_i;
     2710        MaskField.ZIndex=MaskIndex_z;
    27052711        %px to phys or other transform on field
    27062712         menu_transform=get(handles.TransformName,'String');
Note: See TracChangeset for help on using the changeset viewer.