Changeset 618


Ignore:
Timestamp:
Apr 24, 2013, 4:22:52 PM (8 years ago)
Author:
sommeria
Message:

particle_tracking updated

File:
1 edited

Legend:

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

    r616 r618  
    1616%
    1717% Method:
    18    dexing
    1918%       Series.NbSlice: %number of slices defined on the interface
    2019% global A rangx0 rangy0 minA maxA; % make current image A accessible in workspace
     
    7877        msgbox_uvmat('WARNING','the first input file does not exist')
    7978    end
    80     return
    8179    % parameters specific to the function 'particle_tracking'
    8280    %Par.Nblock=25;%size of image subblocks for analysis
     
    8987    Par.ThreshLum=-2000;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
    9088    ParamOut.ActionInput=Par;
     89    return
    9190end
    9291
     
    125124if ~isempty(errormsg),display(errormsg),return,end
    126125
     126%% frame index for movie or multimage file input 
     127if ~isempty(j1_series{1})
     128    frame_index=j1_series{1};
     129else
     130    frame_index=i1_series{1};
     131end
     132
    127133%% check the input file type 
    128 [FileType,FileInfo,MovieObject]=get_file_type(filecell{1,1});
     134[FileType,FileInfo,VideoObject]=get_file_type(filecell{1,1});
    129135ImageTypeOptions={'image','multimage','mmreader','video'};
    130136if isempty(find(strcmp(FileType,ImageTypeOptions)))
     
    138144%%%%%%%%%%%%   SPECIFIC PART (to edit) %%%%%%%%%%%%
    139145%filter for particle center of mass(luminosity)
    140 Nblock=Param.InputAction.Nblock;
    141 ThreshLum=Param.InputAction.ThreshLum;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
     146Nblock=Param.ActionInput.Nblock;
     147ThreshLum=Param.ActionInput.ThreshLum;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
    142148
    143149hh=ones(5,5);
     
    206212%     errordlg('number of images in a slice smaller than the proposed number of images for the sliding average')
    207213%     return
    208 % end
    209 A=[];
    210      
    211 
    212 % [A,time,dt,rangx0,rangy0]=view_ima(handles,filename,[],1,1,1,1);
    213 % pxcm=str2num(get(handles.pxcm,'String')); %scales pixels per cm
    214 % pycm=str2num(get(handles.pycm,'String'));
    215 % np=size(A);
    216 
    217 %BACKGROUND LEVEL
    218 % Backg=zeros(size(A));
    219 % nburst(1)=1;
     214
    220215for ifile=1:nbfield
    221216    if checkrun
     
    226221        end
    227222    end
    228     filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1_series(ifile),[],j1);
     223    if ~isempty(j1_series)&&~isequal(j1_series,{[]})
     224        j1=j1_series{1}(ifile);
     225    end
     226    filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1_series{1}(ifile),[],j1);
    229227    A=read_image(filename,FileType,VideoObject,frame_index(ifile));
    230228    if ndims(A)==3;%color images
    231         A=sum(double(Aread),3);% take the sum of color components
     229        A=sum(double(A),3);% take the sum of color components
    232230    end
    233231    if ThreshLum<0
    234232        A=max(max(A))-A;%take the negative
    235233    end
    236     if TestMask
     234    if CheckMask
    237235        A=A.*Mask;
    238236    end
     
    251249        A=A-imresize(Backg/nburst(1),size(A),'bilinear');% interpolate to the initial size image and substract
    252250    end
    253     Aflagmax=sparse(imregionalmax(Ap));%find local maxima
    254     Plum=imfilter(Ap,hh);% sum A on 5x% domains
     251    Aflagmax=sparse(imregionalmax(A));%find local maxima
     252    Plum=imfilter(A,hh);% sum A on 5x% domains
    255253    Plum=Aflagmax.*Plum;% Plum gives the particle luminosity at each particle location, 0 elsewhere
    256254    %make statistics on particles,restricted to a subdomain Sub
     
    262260    nbtotal=nbtotal(1);
    263261    %particle size
    264     Parea=Aflagmax.*(Plum./Ap); %particle luminosity/max luminosity=area
     262    Parea=Aflagmax.*(Plum./A); %particle luminosity/max luminosity=area
    265263    Pdiam=sqrt(Parea);
    266264    [Js,Is,diam]=find(Pdiam);%particle location
     
    276274   
    277275    % get the particle centre of mass
    278     dx=imfilter(Ap,hdX);
    279     dy=imfilter(Ap,-hdY);
     276    dx=imfilter(A,hdX);
     277    dy=imfilter(A,-hdY);
    280278    dx=Aflagmax.*(dx./Plum);
    281279    dy=Aflagmax.*(dy./Plum);
Note: See TracChangeset for help on using the changeset viewer.