Lab book for Zebrafish experiments

January 11, 2014

Validation of Ctrax using the 5-zebrafish video

Filed under: Tracking — alperezescudero @ 3:08 pm

Name of this file: Cuaderno20140111T131557.m

After several trials, it seems that the best parameters in Ctrax for zebrafish videos are the following: – Default background parameters – Default background subtraction parameters – Default tracking parameters, except: Use “manually set bounds on shape”, and set all parameters with very extreme values (minimums at 0 and maximums at thousands), so that they have no effect. Except minimum size, that must be set at a reasonable value (100 for the 5-zebrafish video), to prevent the fish to be cut in several pieces when they turn. Then, check “enforce shape bounds”.

pwd


ans =

D:\Hipertec\ReconocePeces\nuevos

Load results of Ctrax, and build trajectories

load(‘D:\Hipertec_pesados\5zebrafish\5Zebrafish_nocover_22min_ctrax.mat’)
[trajectories_ctrax,pretrajectories,trozox]=ctrax2trajectories(ntargets,identity,x_pos,y_pos,5);

Id 28 with 614 frames has been dropped
Id 14 with 188 frames has been dropped

Load results of tracking, and build corrected trajectories

load(‘D:\Hipertec_pesados\5zebrafish_original\segm\datosegm.mat’)
datosegm=variable;
load(
‘D:\Hipertec_pesados\5zebrafish_original\segm\npixelsyotros.mat’)
npixelsyotros=variable;
load(
‘D:\Hipertec_pesados\5zebrafish_original\segm\mancha2pez_corregidomanual_10000frames.mat’)
[trajectories_corr,probtrayectorias]=mancha2pez2trayectorias(datosegm,mancha2pez,[],[],npixelsyotros.mancha2centro);

Align both trajectories

This is necessary because the corrected trajectories come from the original video, and the ctrax from the compressed video, and resolution is different. Also, ctrax uses the lower corner as a reference, and matlab uses the upper one.

trajectories_ctrax(:,:,2)=-trajectories_ctrax(:,:,2); % Invert the y axis
[traj_ctrax,params_alin]=alineatrayectorias(trajectories_ctrax,trajectories_corr,100);


m =

2.0217e+05

m =

1.8584e+03

m =

1.8584e+03

m =

1.8584e+03

m =

1.8584e+03

Relation between the individuals, frame-by-frame

[relacion,umbral,relacion_todos,distancias]=relacionatrayectorias(traj_ctrax,trajectories_corr,6.5);

Assigned 93.3822% of the blobs (67407 out of 72184)

Show results

figure
subplot(1,2,1)
imagesc(pretrajectories)
title(‘Ctrax id”s’)
subplot(1,2,2)
imagesc(relacion)
title(
‘Relation between ctrax and corrected idTracker’)

correctos=sum(relacion==repmat(relacion(1,:),[size(relacion,1) 1]))./sum(~isnan(relacion))
mean(correctos)


correctos =

0.2206 0.3146 0.1914 0.2328 0.3260

ans =

0.2571

About 25% correct frames.

Published with MATLAB® R2013b

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.