Download this file

43 lines (39 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
%% Quantification of Trabeculae Inside the Heart from MRI Using Fractal Analysis
%% This code is written by-
%Md. Kamrul Hasan, M1 MAIA
%Md. Fakrul Islam Tushar, M1 MAIA
%%
function c = randcantor(p,n,d,varargin)
error(nargchk(1,4,nargin));
if nargin==1
n = 256;
d = 2;
elseif nargin==2
d = 2;
end
switch d
case 1, c = boxdiv1(true(1,n),p);
case 2, c = boxdiv2(true(n,n),p);
case 3, c = boxdiv3(true(n,n,n),p);
otherwise, error('Dimension should be 1, 2, or 3.');
end
if nargout==0 || any(strncmpi(varargin,'show',1))
switch d
case 1
imagesc(~c);
set(gca,'PlotBoxAspectRatio',[40 1 1]);
set(gca,'TickLength',[0 0]);
set(gca,'YTick',[]);
colormap gray
case 2
imagesc(~c);
axis image
colormap gray
case 3
warning('No display of 3D sets. Use the syntax C = BOXDIV(...)');
end
end;
if nargout==0
clear c
end
%% END