-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from bassemhermila/TREES2
Add abel_tree function
- Loading branch information
Showing
2 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
beta/* | ||
*/*.asv | ||
*/*.asv | ||
|
||
.MATLABDriveTag | ||
*.DS_Store | ||
|
||
# Windows default autosave extension | ||
*.asv | ||
|
||
# OSX / *nix default autosave extension | ||
*.m~ | ||
|
||
|
||
# Packaged app and toolbox files | ||
*.mlappinstall | ||
*.mltbx | ||
|
||
# Generated helpsearch folders | ||
helpsearch*/ | ||
|
||
# Simulink code generation folders | ||
slprj/ | ||
sccprj/ | ||
|
||
# Matlab code generation folders | ||
codegen/ | ||
|
||
# Simulink autosave extension | ||
*.autosave | ||
|
||
# Simulink cache files | ||
*.slxc | ||
|
||
# Octave session info | ||
octave-workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
% ABEL_TREE Euclidean length of tree segments (mean). | ||
% (trees package) | ||
% | ||
% abel = abel_tree (intree, options) | ||
% ---------------------------------- | ||
% | ||
% Returns the average Euclidean distance between branch points and | ||
% termination points [in um]. | ||
% | ||
% Input | ||
% ----- | ||
% - intree ::integer: index of tree in trees or structured tree | ||
% - options ::string: | ||
% '-s' : show | ||
% {DEFAULT: ''} | ||
% | ||
% Output | ||
% ------- | ||
% - abel ::double: average Euclidean distance | ||
% | ||
% Example | ||
% ------- | ||
% abel_tree (sample_tree, '-s') | ||
% | ||
% See also len_tree | ||
% Uses len_tree C_tree delete_tree ver_tree | ||
% | ||
% the TREES toolbox: edit, generate, visualise and analyse neuronal trees | ||
% Copyright (C) 2009 - 2023 Hermann Cuntz | ||
|
||
function abel = abel_tree (intree, options) | ||
|
||
ver_tree (intree); % verify that input is a tree structure | ||
|
||
if (nargin < 2) || isempty (options) | ||
% {DEFAULT: no option} | ||
options = ''; | ||
end | ||
|
||
iC = C_tree (intree); | ||
iC (1) = 0; | ||
dtree = delete_tree (intree, find (iC)); | ||
len = len_tree (dtree); | ||
abel = mean (len); | ||
|
||
if contains (options, '-s') % show option | ||
clf; | ||
hold on; | ||
clf; | ||
HP = plot_tree (dtree, len, [], [], [], '-b'); | ||
set (HP, ... | ||
'edgecolor', 'none'); | ||
colorbar; | ||
title ( ... | ||
['ABEL: ' (num2str (round (mean (len)))) ' µm']); | ||
xlabel ('x [µm]'); | ||
ylabel ('y [µm]'); | ||
zlabel ('z [µm]'); | ||
view (2); | ||
grid on; | ||
axis image; | ||
end | ||
|
||
|
||
|