Note: The scripts do not support debugging and have other limitations making them only useful for exploiting information from Diatrack. Commenting of the code is not supported and every line should be terminated with a colon. Purchase a Matlab license and start contributing your own scripts!
1) Change Renderer to openGL. OpenGL is not the default renderer in Diatrack because certain combinations of video card and drivers do not support it. OpenGL permits transparency, which is convenient when observing tracks passing through objects segmented in 3D. The following script switches the renderer to Opengl. Simply cut and paste in the scripting window.
Script (semasopht):
set(gcf,’renderer’,’opengl’);
2) Change the line width to a value larger than the default of 1 pixel to draw thicker displacement vectors. This can also be achieved using the option menu.
Script (semasopht):
- LineWidth=2;
- SaveChanges;
3) Count the number of objects found in each frame and display the result in a graph
Script: (semasopht)
- buff=zeros(1,sizeT);
- for frame=1:sizeT buff(frame)=size(find(tracks{frame}.RefinedCooX),2); end;
- figure;plot(1:sizeT,buff,'r.');
- for frame=1:sizeT buff(frame)=size(find(tracks{frame}.RefinedCooX),2); end;
4) Collects tracks in an N*3 array and calculate the corresponding diffusion coefficient by fitting the squared distance growth by a a line. All time differences are collected to increase the number of data points available. This script can be preceded by a track selection step where only tracks longer than e.g. ten time points are kept.
Script (semasopht):
- counterTrack=1;
- for frame=firstFrameSub:lastFrameSub
- for part=find(tracks{frame}.Predecessor==0)
- framsav=frame;
- partsav=part;
- accumtrack(1,:)=[tracks{frame}.RefinedCooY(part),tracks{frame}.RefinedCooX(part),tracks{frame}.RefinedCooZ(part)];
- while(tracks{frame}.Successor(part)&&frame<lastFrameSub)
- part=tracks{frame}.Successor(part);
- accumtrack(frame-framsav+2,:)=[tracks{frame+1}.RefinedCooY(part),tracks{frame+1}.RefinedCooX(part),tracks{frame+1}.RefinedCooZ(part)];
- frame=frame+1;
- end;
- v=accumtrack(1:frame-framsav+1,:);
- if size(v,1)>1
- v(:,3)=v(:,3)*ratioPixelzx;
- vtot=zeros(1,size(v,1)-1);
- for gap=1:(size(v,1)-1)
- for posStart=1:(size(v,1)-gap)
- vd=v(posStart+gap,:)-v(posStart,:);
- vs=sum(vd.^2);
- vtot(gap)=vtot(gap)+vs;
- end;
- vtot(gap)=vtot(gap)/(size(v,1)-gap);
- end;
- slopeavg=polyfit([0:size(v,1)-1],[0,vtot],1);
- myTrajStat=slopeavg(1);
- else
- myTrajStat=Inf;
- end;
- diff(counterTrack)= myTrajStat;
- counterTrack=counterTrack+1;
- frame=framsav;
- part=partsav;
- accumtrack=[];
- end;
- end;
- figure;hist(diff(diff<10000),100);
- for frame=firstFrameSub:lastFrameSub






