Changeset 1058 for trunk/src/series
- Timestamp:
- Sep 7, 2018, 8:51:09 PM (7 years ago)
- Location:
- trunk/src/series
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/merge_proj.m
r1033 r1058 533 533 end 534 534 end 535 % if isempty(FFName)536 % FFName='FF';537 % end538 % MergeData.(FFName)(NbAver~=0)=0;% flag to 1 undefined summed data539 % MergeData.(FFName)(NbAver==0)=1;% flag to 1 undefined summed data540 535 end 541 536 end -
trunk/src/series/merge_proj_polar.m
r1027 r1058 100 100 HeadData.ListVarName= {'radius','azimuth'} ; 101 101 HeadData.VarDimName={'radius','azimuth'}; 102 HeadData.VarAttribute={'coord_y','coord_x'} ; 102 HeadData.VarAttribute{1}.Role='coord_y'; 103 HeadData.VarAttribute{2}.Role='coord_x'; 103 104 HeadData.radius=radius_shifted; 104 105 HeadData.azimuth=azimuth_arclength; … … 373 374 ProjData{iview}.ListVarName= [ProjData{iview}.ListVarName ListVarName]; 374 375 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]; 376 379 for ivar=1:numel(ListVarName) 377 380 ProjData{iview}.VarDimName{ivar+2}={'radius','azimuth'}; … … 457 460 disp([ num2str(ellapsed_time/(60*NbField),3) ' minutes per iteration']) 458 461 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 459 533 %'merge_field': concatene fields 460 534 %------------------------------------------------------------------------ … … 469 543 NbView=length(Data); 470 544 if NbView==1% if there is only one field, just reproduce it in MergeData 471 return 545 return 472 546 end 473 547 … … 514 588 errormsg='sizes of the input matrices do not agree, need to interpolate on a common grid using a projection object'; 515 589 return 516 else 590 else 517 591 MergeData.(VarName)=MergeData.(VarName) +double(Data{iview}.(VarName));%add data 518 592 NbAver=NbAver + ~check_bad;% add 1 for good data, 0 else … … 523 597 end 524 598 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 600 end -
trunk/src/series/sub_background.m
r1033 r1058 140 140 141 141 %% 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 144 145 nbaver=floor(nbaver_init/nbfield_j); % number of bursts used for the sliding background, 145 146 if isequal(mod(nbaver,2),0)% if nbaver is even … … 148 149 nbaver_init=nbaver*nbfield_j;%propose by default an integer number of bursts 149 150 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 151 171 prompt = {'volume scan mode (Yes/No)';... 152 172 'Number of images for the sliding background (MUST FIT IN COMPUTER MEMORY)';... 153 173 'the luminosity rank chosen to define the background (0.1=for dense particle seeding, 0.5 (median) for sparse particles';... 154 174 'set to 0 image levels below median(Yes/No)';... 155 'image rescaling coefficient( high valuesreduce 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' }; 156 176 dlg_title = 'get (slice by slice) a sliding background and substract to each image'; 157 177 num_lines= 5; 158 def = { 'No';num2str(nbaver_init);'0.1';'No';'2'};178 def = { CheckVolume;num2str(nbaver_init);num2str(BrightnessRankThreshold);CheckSubmedian;num2str(SaturationCoeff)}; 159 179 answer = inputdlg(prompt,dlg_title,num_lines,def); 160 180 if isempty(answer)
Note: See TracChangeset
for help on using the changeset viewer.