Skip to content

Commit 78ff57d

Browse files
committed
Update to V1.0
1 parent 3827207 commit 78ff57d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1900
-832
lines changed

BehaviorDEPOT.prj

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<deployment-project plugin="plugin.apptool" plugin-version="1.0">
2+
<configuration build-checksum="83420990" file="C:\BehaviorDEPOT\BehaviorDEPOT.prj" location="C:\BehaviorDEPOT" name="BehaviorDEPOT" target="target.mlapps" target-name="Package App">
3+
<param.appname>BehaviorDEPOT</param.appname>
4+
<param.authnamewatermark>C. Gabriel, Z. Zeidler, B. Jin, L. DeNardo</param.authnamewatermark>
5+
<param.email>[email protected]</param.email>
6+
<param.company />
7+
<param.icon />
8+
<param.icons />
9+
<param.summary>BehaviorDEPOT v1.0 application for analyzing top-down rodent pose tracking and automatic behavior classification</param.summary>
10+
<param.description />
11+
<param.screenshot />
12+
<param.version>1.0</param.version>
13+
<param.products.name>
14+
<item>MATLAB</item>
15+
<item>Curve Fitting Toolbox</item>
16+
<item>Image Processing 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>17</item>
24+
<item>8</item>
25+
<item>19</item>
26+
</param.products.id>
27+
<param.products.version>
28+
<item>9.8</item>
29+
<item>3.5.11</item>
30+
<item>11.1</item>
31+
<item>8.4</item>
32+
<item>11.7</item>
33+
</param.products.version>
34+
<param.platforms />
35+
<param.output>${PROJECT_ROOT}\installation</param.output>
36+
<param.guid>786e8f67-a371-44fa-8876-10a81a869d58</param.guid>
37+
<unset>
38+
<param.company />
39+
<param.icon />
40+
<param.icons />
41+
<param.description />
42+
<param.screenshot />
43+
<param.version />
44+
<param.platforms />
45+
</unset>
46+
<fileset.main>
47+
<file>${PROJECT_ROOT}\BehaviorDEPOT_GUI_v1_0.mlapp</file>
48+
</fileset.main>
49+
<fileset.depfun />
50+
<fileset.resources>
51+
<file>${PROJECT_ROOT}\code</file>
52+
<file>${PROJECT_ROOT}\code\classifiers</file>
53+
<file>${PROJECT_ROOT}\code\functions</file>
54+
<file>${PROJECT_ROOT}\code\modules</file>
55+
<file>${PROJECT_ROOT}\code\plotting</file>
56+
</fileset.resources>
57+
<fileset.package />
58+
<build-deliverables>
59+
<file location="${PROJECT_ROOT}" name="installation" optional="false">C:\BehaviorDEPOT\installation</file>
60+
</build-deliverables>
61+
<workflow />
62+
<matlab>
63+
<root>C:\Program Files\MATLAB\R2020a</root>
64+
<toolboxes>
65+
<toolbox name="matlabcoder" />
66+
<toolbox name="gpucoder" />
67+
<toolbox name="neuralnetwork" />
68+
</toolboxes>
69+
<toolbox>
70+
<matlabcoder>
71+
<enabled>true</enabled>
72+
</matlabcoder>
73+
</toolbox>
74+
<toolbox>
75+
<gpucoder>
76+
<enabled>true</enabled>
77+
</gpucoder>
78+
</toolbox>
79+
<toolbox>
80+
<neuralnetwork>
81+
<enabled>true</enabled>
82+
</neuralnetwork>
83+
</toolbox>
84+
</matlab>
85+
<platform>
86+
<unix>false</unix>
87+
<mac>false</mac>
88+
<windows>true</windows>
89+
<win2k>false</win2k>
90+
<winxp>false</winxp>
91+
<vista>false</vista>
92+
<linux>false</linux>
93+
<solaris>false</solaris>
94+
<osver>10.0</osver>
95+
<os32>false</os32>
96+
<os64>true</os64>
97+
<arch>win64</arch>
98+
<matlab>true</matlab>
99+
</platform>
100+
</configuration>
101+
</deployment-project>

BehaviorDEPOTApp.m

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
classdef BehaviorDEPOTApp < handle
2+
%
3+
% Usage:
4+
% app.BehaviorDEPOTApp
5+
6+
properties
7+
AppHandle;
8+
AppCount = 0;
9+
Output;
10+
CurrClass;
11+
end
12+
13+
properties (Constant)
14+
AppPathBase = {'/BehaviorDEPOT'};
15+
AppClass = 'BehaviorDEPOTApp';
16+
Increment = 1;
17+
Decrement = 0;
18+
Version = '13a';
19+
end
20+
21+
properties (Dependent)
22+
AppPath;
23+
end
24+
25+
methods (Static)
26+
function count = refcount(increment)
27+
persistent AppCount;
28+
if(isempty(AppCount))
29+
AppCount = 1;
30+
else
31+
if(increment)
32+
AppCount = plus(AppCount,1);
33+
else
34+
AppCount = minus(AppCount,1);
35+
if AppCount < 0
36+
AppCount = 0;
37+
end
38+
end
39+
end
40+
count = AppCount;
41+
end
42+
end
43+
44+
methods
45+
% Create the application object
46+
function obj = BehaviorDEPOTApp()
47+
obj.CurrClass = metaclass(obj);
48+
startApp(obj)
49+
end
50+
51+
function value = get.AppPath(obj)
52+
myAppsLocation = char(com.mathworks.appmanagement.MlappinstallUtil.getAppInstallationFolder);
53+
value = cellfun(@(x) fullfile(myAppsLocation, x), obj.AppPathBase, 'UniformOutput', false);
54+
end
55+
56+
% Start the application
57+
function startApp(obj)
58+
% Increment the reference count by one and lock the file
59+
mlock;
60+
BehaviorDEPOTApp.refcount(obj.Increment);
61+
62+
% Verify we are about to execute the correct function - if not we
63+
% should error and exit now. We need to make sure the paths are
64+
% equal using canonical paths.
65+
existVal = exist(fullfile(pwd,'BehaviorDEPOT_GUI_v1_0')); %#ok<EXIST>
66+
doesShadowExist = existVal >= 2 && existVal <= 6;
67+
68+
pathOne = java.io.File(pwd);
69+
pathOne = pathOne.getCanonicalPath();
70+
pathTwo = java.io.File(obj.AppPath{1});
71+
pathTwo = pathTwo.getCanonicalPath();
72+
73+
if (doesShadowExist && ~pathOne.equals(pathTwo))
74+
% We are trying to execute the wrong BehaviorDEPOT_GUI_v1_0
75+
errordlg(message('MATLAB:apps:runapp:WrongEntryPoint', 'BehaviorDEPOT_GUI_v1_0').getString, ...
76+
message('MATLAB:apps:runapp:WrongEntryPointTitle').getString);
77+
appinstall.internal.stopapp([],[],obj)
78+
return;
79+
end
80+
81+
% Must load function (force by using function handle) or nargout lies.
82+
% Check if the app is a GUIDE app
83+
if nargout(@BehaviorDEPOT_GUI_v1_0) == 0
84+
eval('BehaviorDEPOT_GUI_v1_0');
85+
else
86+
obj.AppHandle = eval('BehaviorDEPOT_GUI_v1_0');
87+
end
88+
89+
if(ishandle(obj.AppHandle))
90+
% Traditional graphics handle based app
91+
obj.attachOncleanupToFigure(obj.AppHandle);
92+
elseif isa(obj.AppHandle, 'matlab.apps.AppBase')
93+
% appdesigner based app
94+
obj.attachOncleanupToFigure(appdesigner.internal.service.AppManagementService.getFigure(obj.AppHandle));
95+
elseif isa(obj.AppHandle,'handle') && ~isvalid(obj.AppHandle)
96+
% Cleanup in the case where the handle was invalidated before here
97+
appinstall.internal.stopapp([],[],obj)
98+
else
99+
% There will be no call to stopapp, instead decrease the refcount
100+
% now to prevent future clearing issues
101+
BehaviorDEPOTApp.refcount(obj.Increment);
102+
munlock;
103+
end
104+
end
105+
106+
function attachOncleanupToFigure(obj, fig)
107+
% Setup cleanup code on figure handle using onCleanup object
108+
cleanupObj = onCleanup(@()appinstall.internal.stopapp([],[],obj));
109+
appdata = getappdata(fig);
110+
appfields = fields(appdata);
111+
found = cellfun(@(x) strcmp(x,'AppCleanupCode'), appfields);
112+
if(~any(found))
113+
setappdata(fig, 'AppCleanupCode', cleanupObj);
114+
end
115+
end
116+
end
117+
end

BehaviorDEPOT_GUI_v1_0.mlapp

161 KB
Binary file not shown.

README.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
11
# BehaviorDEPOT ReadME
22

3-
- BehaviorDEPOT is currently pre-release and is undergoing a substantial update (v1.0), which is now available on the 'development' branch of the repository! Check it out and feel free to provide feedback on bugs and features you'd like to see!
3+
- BehaviorDEPOT v1.0 is now live and under initial testing! Please give it a try and let us know of any issues you may encounter.
44

55
- To find out more about BehaviorDEPOT or to cite the software in your own paper, see our pre-print on bioRxiv: https://www.biorxiv.org/content/10.1101/2021.06.20.449150v2
66

77
- Demo data is now available that can be used to test installation, classifiers, spatial/temporal filtering, and modules. Due to limitations on file size, the original video file (necessary to run the analysis module from scratch) is not available on Github but can be downloaded from: https://drive.google.com/drive/folders/1VNv9FuXyiI4xgt-RokcVvWk-1dBovuqO?usp=sharing
88

99
- Sample DeepLabCut networks that have been trained on our data are available for use. These may work on your own data, depending on the individual camera/chamber setup, but these models can serve as starting points for quickly training your own new networks! Find them here: https://drive.google.com/drive/folders/1Fl4PmLz6CWQcqOjfQ1q_60ZCZjI5949-?usp=sharing
1010

11-
**Patch Notes v0.51**
12-
- Updated smoothing algorithm to better perform on behavior videos
13-
- Updated freezing algorithm sliding convolution values
14-
- Removed option to select video file type; changed code to automatically detect video
15-
- Patched minor bugs in analysis, exploration, and optimization modules
16-
- Updated code structure of validation and inter-rater modules
17-
- Updated inter-rater module to match current directory structure
18-
- Updated inter-rater module to automatically identify 'hB' and 'analyzed folders'
19-
- Updated validation module to match current directory structure
20-
- Updated validation module with enhanced plotting features
21-
- Updated prepBatch.m to automatically ignore results folders in data directories
11+
**Patch Notes v1.0**
12+
- Integrate pipeline with custom classifier selection
13+
- Update GUI design for support modules
14+
- Update GUI design for analysis module
15+
- Add readout of classifiers in GUI with interactive selectivity
16+
- Write function that runs the classifier functions using the info stored in P and the Params, Tracking, and Metrics structs
17+
- Add additional behavior classifiers
18+
- Re-work classifier files to use separate 'P_' files to store parameters
19+
- Write a function that can apply a minDuration threshold to selected Behavior data
20+
- Edit GUI to allow custom classifier usage
21+
- Add convertHumanAnnotations functionality to GUI
22+
- Update convertHumanAnnotations_BD code
23+
- Update Metrics structure; make more straightforward to add or modify metrics
24+
- Merge mainscript files
25+
- Add new metrics to calculateMetrics
26+
- Clean up metric naming in calculateMetrics
27+
- Update GUI to set [batch=0 or 1] to replace mainscript_single
28+
- Reformat rearing classifier
29+
- Reformat freezing classifier
30+
- Reformat moving classifier
31+
- Write function to standardize generation of behavior structures (genBehStruct)
32+
- Split freezing scripts into separate files (jitter and velocity)
33+
- Write function to detect start/stop inds (findStartStop)
34+
- Write function to apply min time threshold to behaviors (applyMinThreshold)
35+
- Add smoothing options to GUI
36+
- Add hampel filtering option to GUI
37+
- Update spatiotemporal filtering options
2238

2339
**----------------------------------------------------------------------------------------------------**
2440

@@ -44,7 +60,7 @@ BehaviorDEPOT is written to be flexible to enable users to generate custom class
4460
If you’re curious about any of the code, want to tweak it, or create your own classifier, you can access the underlying scripts by simply right clicking on the app and navigating to where the app files are installed. To edit the GUI, you can open the BehaviorDEPOT.mlapp file in MATLAB’s ‘App Designer’.
4561

4662
## Credits
47-
BehaviorDEPOT was developed by Chris Gabriel, Benita Jin, Zachary Zeidler, and Laura DeNardo. If you find this tool useful, please cite the work:
63+
BehaviorDEPOT was developed by Chris Gabirel, Benita Jin, Zachary Zeidler, and Laura DeNardo. If you find this tool useful, please cite the work:
4864
{will be updated upon publication}
4965

5066
## License

0 commit comments

Comments
 (0)