-
Notifications
You must be signed in to change notification settings - Fork 22
Behavior: Animal tracking
Biafra Ahanonu edited this page Jul 23, 2021
·
2 revisions
Please use the online documentation website going forward: https://bahanonu.github.io/ciatah/
Code for ImageJ and Matlab based image tracking.
Functions needed (have entire miniscope_analysis
loaded anyways):
-
mm_tracking.ijm
is the tracking function for use in ImageJ, place inplugins
folder. -
removeIncorrectObjs.m
is a function to clean-up the ImageJ output. -
createTrackingOverlayVideo
is a way to check the output from the tracking by overlaying mouse tracker onto the video.
Example screen after running mm_tracking
within ImageJ, click to expand.
Once ImageJ is finished, within Matlab run the following code (cleans up the ImageJ tracking by removing small objects and adding NaNs for missing frames along with making a movie to check output). Modify to point toward paths specific for your data.
% CSV file from imageJ and AVI movie path used in ImageJ
moviePath = 'PATH_TO_AVI_USED_IN_IMAEJ';
csvPath = 'PATH_TO_CSV_OUTPUT_BY_IMAGEJ';
% clean up tracking
[trackingTableFilteredCell] = removeIncorrectObjs(csvPath,'inputMovie',{moviePath});
% make tracking video
% frames to use as example check
nFrames=1500:2500;
inputMovie = loadMovieList(moviePath,'frameList',nFrames);
[inputTrackingVideo] = createTrackingOverlayVideo(inputMovie,movmean(trackingTableFilteredCell.XM(nFrames),5),movmean(trackingTableFilteredCell.YM(nFrames),5));
playMovie(inputTrackingVideo);
- Refer to https://github.com/schnitzer-lab/miniscope_analysis/issues/21 for additional details about testing this function.