Changeset 618 for trunk/src/series
- Timestamp:
- Apr 24, 2013, 4:22:52 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/particle_tracking.m
r616 r618 16 16 % 17 17 % Method: 18 dexing19 18 % Series.NbSlice: %number of slices defined on the interface 20 19 % global A rangx0 rangy0 minA maxA; % make current image A accessible in workspace … … 78 77 msgbox_uvmat('WARNING','the first input file does not exist') 79 78 end 80 return81 79 % parameters specific to the function 'particle_tracking' 82 80 %Par.Nblock=25;%size of image subblocks for analysis … … 89 87 Par.ThreshLum=-2000;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles 90 88 ParamOut.ActionInput=Par; 89 return 91 90 end 92 91 … … 125 124 if ~isempty(errormsg),display(errormsg),return,end 126 125 126 %% frame index for movie or multimage file input 127 if ~isempty(j1_series{1}) 128 frame_index=j1_series{1}; 129 else 130 frame_index=i1_series{1}; 131 end 132 127 133 %% 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}); 129 135 ImageTypeOptions={'image','multimage','mmreader','video'}; 130 136 if isempty(find(strcmp(FileType,ImageTypeOptions))) … … 138 144 %%%%%%%%%%%% SPECIFIC PART (to edit) %%%%%%%%%%%% 139 145 %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 particles146 Nblock=Param.ActionInput.Nblock; 147 ThreshLum=Param.ActionInput.ThreshLum;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles 142 148 143 149 hh=ones(5,5); … … 206 212 % errordlg('number of images in a slice smaller than the proposed number of images for the sliding average') 207 213 % 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 220 215 for ifile=1:nbfield 221 216 if checkrun … … 226 221 end 227 222 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); 229 227 A=read_image(filename,FileType,VideoObject,frame_index(ifile)); 230 228 if ndims(A)==3;%color images 231 A=sum(double(A read),3);% take the sum of color components229 A=sum(double(A),3);% take the sum of color components 232 230 end 233 231 if ThreshLum<0 234 232 A=max(max(A))-A;%take the negative 235 233 end 236 if TestMask234 if CheckMask 237 235 A=A.*Mask; 238 236 end … … 251 249 A=A-imresize(Backg/nburst(1),size(A),'bilinear');% interpolate to the initial size image and substract 252 250 end 253 Aflagmax=sparse(imregionalmax(A p));%find local maxima254 Plum=imfilter(A p,hh);% sum A on 5x% domains251 Aflagmax=sparse(imregionalmax(A));%find local maxima 252 Plum=imfilter(A,hh);% sum A on 5x% domains 255 253 Plum=Aflagmax.*Plum;% Plum gives the particle luminosity at each particle location, 0 elsewhere 256 254 %make statistics on particles,restricted to a subdomain Sub … … 262 260 nbtotal=nbtotal(1); 263 261 %particle size 264 Parea=Aflagmax.*(Plum./A p); %particle luminosity/max luminosity=area262 Parea=Aflagmax.*(Plum./A); %particle luminosity/max luminosity=area 265 263 Pdiam=sqrt(Parea); 266 264 [Js,Is,diam]=find(Pdiam);%particle location … … 276 274 277 275 % get the particle centre of mass 278 dx=imfilter(A p,hdX);279 dy=imfilter(A p,-hdY);276 dx=imfilter(A,hdX); 277 dy=imfilter(A,-hdY); 280 278 dx=Aflagmax.*(dx./Plum); 281 279 dy=Aflagmax.*(dy./Plum);
Note: See TracChangeset
for help on using the changeset viewer.