Skip to content

Commit 6d901c9

Browse files
restructuring - copied private function to utilities, since it is used in tutorial documentation
git-svn-id: svn+ssh://svn.fcdonders.nl/home/svnroot/fieldtrip/trunk@9860 0cf7c7f0-3615-4144-b4e6-68da3bce3cd0
1 parent 8aba272 commit 6d901c9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

utilities/strel_bol.m

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function se = strel_bol(r)
2+
3+
% STREL_BOL constructs a 3D sphere with the specified radius
4+
% that can be used as structural element in 3D image processing
5+
%
6+
% See STREL, IMERODE, IMDILATE (image processing toolbox)
7+
8+
dim = [2*r+1, 2*r+1, 2*r+1];
9+
se = zeros(dim);
10+
for i=1:dim(1)
11+
for j=1:dim(2)
12+
for k=1:dim(3)
13+
x = i-1-r;
14+
y = j-1-r;
15+
z = k-1-r;
16+
if norm([x y z])<=r
17+
se(i,j,k) = 1;
18+
end
19+
end
20+
end
21+
end
22+

0 commit comments

Comments
 (0)