Skip to content

Commit c782b13

Browse files
committed
Update to version 1.6
- Fixed bug causing crash when using multiple ROIs - Fixed bug causing saved GUI settings to not be applied (despite showing on GUI) - Fixed bug causing multiple incorrect tracking points during image registration - Changed naming in single mode to remove video extension on resulting analysis folder
1 parent cf888ea commit c782b13

13 files changed

+106
-17
lines changed

BehaviorDEPOT_GUI_v1_6.mlapp

134 KB
Binary file not shown.

BehaviorDEPOTv1.6.mlappinstall

294 KB
Binary file not shown.

BehaviorDEPOTv1.6.prj

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<deployment-project plugin="plugin.apptool" plugin-version="1.0">
2+
<configuration build-checksum="2926307672" file="C:\BehaviorDEPOT\BehaviorDEPOTv1.6.prj" location="C:\BehaviorDEPOT" name="BehaviorDEPOTv1.6" target="target.mlapps" target-name="Package App">
3+
<param.appname>BehaviorDEPOTv1.6</param.appname>
4+
<param.authnamewatermark>C. Gabriel, Z. Zeidler, B. Jin, L. DeNardo</param.authnamewatermark>
5+
<param.email />
6+
<param.company />
7+
<param.icon />
8+
<param.icons />
9+
<param.summary>BehaviorDEPOT v1.6 application for analyzing top-down rodent DLC/SLEAP tracking and automatic behavior classification</param.summary>
10+
<param.description />
11+
<param.screenshot>C:\Users\chris\AppData\Local\Temp\tpe03402fa_0134_443d_97fe_253027d8a554.png</param.screenshot>
12+
<param.version>1.6</param.version>
13+
<param.products.name>
14+
<item>MATLAB</item>
15+
<item>Curve Fitting Toolbox</item>
16+
<item>Parallel Computing Toolbox</item>
17+
<item>Signal Processing Toolbox</item>
18+
<item>Statistics and Machine Learning Toolbox</item>
19+
</param.products.name>
20+
<param.products.id>
21+
<item>1</item>
22+
<item>60</item>
23+
<item>80</item>
24+
<item>8</item>
25+
<item>19</item>
26+
</param.products.id>
27+
<param.products.version>
28+
<item>9.12</item>
29+
<item>3.7</item>
30+
<item>7.6</item>
31+
<item>9.0</item>
32+
<item>12.3</item>
33+
</param.products.version>
34+
<param.platforms />
35+
<param.output>${PROJECT_ROOT}</param.output>
36+
<param.guid>c70783ed-8870-4f9e-b919-45aa12649ba7</param.guid>
37+
<unset>
38+
<param.email />
39+
<param.company />
40+
<param.icon />
41+
<param.icons />
42+
<param.description />
43+
<param.platforms />
44+
<param.output />
45+
</unset>
46+
<fileset.main>
47+
<file>${PROJECT_ROOT}\BehaviorDEPOT_GUI_v1_6.mlapp</file>
48+
</fileset.main>
49+
<fileset.depfun />
50+
<fileset.resources>
51+
<file>${PROJECT_ROOT}\code</file>
52+
</fileset.resources>
53+
<fileset.package />
54+
<build-deliverables>
55+
<file location="C:\" name="BehaviorDEPOT" optional="false">C:\BehaviorDEPOT</file>
56+
</build-deliverables>
57+
<workflow />
58+
<matlab>
59+
<root>C:\Program Files\MATLAB\R2022a</root>
60+
<toolboxes />
61+
</matlab>
62+
<platform>
63+
<unix>false</unix>
64+
<mac>false</mac>
65+
<windows>true</windows>
66+
<win2k>false</win2k>
67+
<winxp>false</winxp>
68+
<vista>false</vista>
69+
<linux>false</linux>
70+
<solaris>false</solaris>
71+
<osver>10.0</osver>
72+
<os32>false</os32>
73+
<os64>true</os64>
74+
<arch>win64</arch>
75+
<matlab>true</matlab>
76+
</platform>
77+
</configuration>
78+
</deployment-project>

code/BehDEPOT_mainscript.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ function BehDEPOT_mainscript(P)
3232
if P.batchSession == 1
3333
analyzed_folder_name = strcat(P.basedir, addSlash(), P.video_folder_list(j), addSlash(), P.video_folder_list(j), '_analyzed');
3434
else
35-
analyzed_folder_name = strcat(P.video_file,"_analyzed");
35+
[~,vid_no_ext] = fileparts(P.video_file);
36+
analyzed_folder_name = strcat(vid_no_ext, "_analyzed");
3637
end
3738

3839
saveDataPrep(analyzed_folder_name, Params, Tracking, Metrics);

code/classifiers/calculateTMaze.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
% T-Maze Classifier
22
% C.G. 3/1/22
3-
43

5-
%INPUT: Params, Tracking, Metrics (from BehaviorDEPOT output)
6-
%OUTPUT: TMaze Structure
4+
% INPUT: Params, Metrics (from BehaviorDEPOT output)
5+
% OUTPUT: TMaze Structure
76

87
% FUNCTION: Classify total & percent time (in s), distance traveled (in cm), and number of
98
% entries into each ROI
109

1110
% PARAMS:
12-
1311
% 1) windowWidth: for convolving inROI vectors
1412
% 2) countThreshold: for convolving inROI vectors
1513
% 3) ROI_Labels:
@@ -47,11 +45,13 @@
4745
all_ROIs{i} = convolveFrames(all_ROIs{i}, Params.TMaze.windowWidth, Params.TMaze.countThreshold);
4846
end
4947

50-
%% Analysis
48+
%% TMaze Analysis
5149

50+
% Collect frame-wise distance traveled
5251
dist_traveled_frame = Metrics.Movement.DistanceTraveled;
5352

5453
for i = 1:length(all_ROIs)
54+
5555
% Calculate percent time in each arm (o1, o2, c1, c2) + center
5656
TMaze.(roi_names{i}).Bouts = findStartStop(all_ROIs{i});
5757
TMaze.(roi_names{i}).Vector = all_ROIs{i};

code/functions/drawROIs.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
if r > 1
2121
hold on;
2222
for nroi = 1:(r-1)
23-
plot(polyshape(P.roi_limits{nroi}), 'FaceAlpha', 0.25)
23+
plot(polyshape(roi_limits{nroi}), 'FaceAlpha', 0.25)
2424
end
2525
end
2626

code/functions/videoInterface.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
P.Video.location = video_name;
1818

1919
% Collect 5 random frames
20-
frame_idx = randi(vid.numFrame,1, 5); % take random frame to verify tracking
20+
frame_idx = randi(vid.numFrame, 1, 5); % take random frame to verify tracking
2121

2222
Frame = struct();
2323

code/gui_settings.mat

558 Bytes
Binary file not shown.

code/modules/BD_dataPrep.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
%% BehaviorDEPOT Data Prep Module
2+
% C.G. 2/24/22
3+
4+
% PURPOSE: Import user input from BehaviorDEPOT GUI (stored in P) and apply
5+
% to run 'j'; performs pose registration, ROI drawing interface, data smoothing/interpolation, and metric calculation
6+
7+
% INPUTS:
8+
% P: Structure array of user parameters imported from GUI
9+
% j: Counting variable (integer) for batch analysis runs
10+
11+
% OUTPUTS:
12+
% Params: Structure array of parameters for current run
13+
% Tracking: Structure array of raw and smoothed pose tracking data
14+
% Metrics: Structure array of extracted metrics from registered animal
15+
% P: User input structure to be run on future runs; includes updates for
16+
% reused-ROI and part registration
17+
118
function [Params, Tracking, Metrics, P] = BD_dataPrep(P, j)
219

320
%% Select current dataset

code/plotting/plotPointTracking.m

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
%plotPointTracking
22

3-
%INPUT: Tracking, Params, frame, frame index
4-
%OUTPUT: Behavior.Freezing structure
5-
6-
%FUNCTION: calculate the freezing frames via transformation of data from
7-
%the Metrics structure and save into Behavior structure
8-
9-
% Future: Calculate average velocity of body; test in place of
10-
% RearBackVelocity
11-
123
function pointValidation = plotPointTracking(Tracking, Params, frame, frame_idx)
134
% visual verification of point tracking and body part indexing
5+
frame_idx = str2num(frame_idx(2:end));
6+
147
part_names = Params.part_names;
158
leg = {};
169
figure('Name','Example point alignment and body part indexing');

0 commit comments

Comments
 (0)