Skip to content

Commit

Permalink
Merge pull request #9 from bassemhermila/TREES2
Browse files Browse the repository at this point in the history
Add abel_tree function
  • Loading branch information
hermanncuntz committed Dec 18, 2023
2 parents 67269a1 + 0b6dfc0 commit 54363f5
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 1 deletion.
35 changes: 34 additions & 1 deletion .gitignore
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
65 changes: 65 additions & 0 deletions metrics/abel_tree.m
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



0 comments on commit 54363f5

Please sign in to comment.