Sie sind auf Seite 1von 6

Carter Chu

Ms. Meece

Capstone Period 7

16 November 2017

Track Reflection 5

I did a lot of coding and programming during my work with Dr. Amol Pednekar. Some of the
coding occurred at Texas Childrens Hospital, while the rest occurred in the comfort of my home. Its
difficult to say precisely when I coded these programs, but I spent several hours every week in order to
code the simulations and other data to contribute to my mentors research project. Im sure that I have
spent at least 5 hours on these programs that I will list and explain below.

Previously, I talked about how my mentor wanted me to write for and assist in the creation of a
research paper. He told me that the most important part of a research paper is the abstract, figures, and
conclusion. Those who read research papers first look at the abstract and figures to see if they are
interested, and if they are, they then read the rest of the paper in detail. The easiest thing to do is to
create the figures first, then write the rest of the paper. The first image below is a figure that was
created for the research paper. I had difficulty trying to explain how my algorithm worked with only
words, so I decided that using functions and variables would make it clearer. The equations describe
how the images are created, allowing for the recreation of them by readers. I also added some images
generated by my simulation and labeled them with its characteristics, fractal dimension (FD) value, and
perimetric ratio (PR) value. These captions would help readers visualize what kind of FD and PR values
different shapes get.

On the last reflection, I also described that my mentor was intrigued and curious about why
some of the PR values would be 1 but have high FD values. In order to solve this problem, I created a
program that generated ellipses of different measurements and orientations. Ellipses are round, and
thus have a PR value of 1, but the FD values can change. I googled the equation of an ellipse in
parametric form and altered the equation so that the measurements and orientation would be how I
desired. The results were quite interesting. I found that the orientation and shape of ellipses did indeed
have quite a large impact on FD values. I found that the FD value seemed to be higher for the ellipses
which had shapes that touched all four sides of the encompassing square. This seems to just be another
case of error due to embedding space.

Quite a long time ago, I discussed how I read that embedding space influences FD values in a
research paper. I then decided to create a program so that I could visualize and justify that conclusion. I
took an image from my simulation and slowly increased the embedding space, taking the FD value as I
went along. I got to visualize the negative correlation between embedding space and fractal dimension,
as more embedding space caused a significant decrease in FD value.

Lastly, to explore how orientation affects the FD value, I created a program that would rotate
my simulated images slowly and take the FD value. I seemed that rotation did not affect the FD much at
all, and it remained relatively stable across all angles in the 360 degrees. All of these findings are quite
significant in the justification of fractal analysis use for left ventricular noncompaction quantification.
function ellipseFD()
FDvalues = zeros(1, 500);
for n = 1:500
timg = zeros(201);
rth = rand * pi;
rrat = rand * 0.75 + 0.25;
theta = linspace(0, 2*pi, 700);
a = 100;
b = rrat * 100;
x = a * cos(theta) * cos(rth) - b * sin(theta) *
sin(rth);
y = a * cos(theta) * sin(rth) + b * sin(theta) *
cos(rth);
nx = x + 101; ny = y + 101;
for xx = 1:700
timg (round(nx(xx)), round(ny(xx))) = 1;
end
timg( ~any(timg,2), : ) = []; %rows
timg( :, ~any(timg,1) ) = []; %columns
if size(timg, 1) > size(timg, 2)
img = zeros(size(timg, 1));
img(1:size(timg, 1), floor((size(timg, 1)-
size(timg, 2))/2)+1:floor((size(timg, 1)-size(timg,
2))/2)+size(timg, 2)) = timg;
%img(ceil((size(timg, 2)-size(timg,
1))/2):floor((size(timg, 2)-size(timg, 1))/2)+size(timg,
1),1:size(timg, 2)) = timg;
elseif size(timg, 2) > size(timg, 1)
img = zeros(size(timg, 2));
%img(1:size(timg, 1), ceil((size(timg, 1)-
size(timg, 2))/2):floor((size(timg, 1)-size(timg,
2))/2)+size(timg, 2)) = timg;
img(floor((size(timg, 2)-size(timg,
1))/2)+1:floor((size(timg, 2)-size(timg, 1))/2)+size(timg,
1),1:size(timg, 2)) = timg;
end
imshow(img);
FDvalues(n) = fdcalculator(img);
imwrite(img,
['C:/Users/Carter/Desktop/Amol/carter/images/Ell_FD'
num2str(n) '.png']);
end
save('ellFD.mat', 'FDvalues');
end
function compareFDsize()
% Get input file names
[fname,pname] = uigetfile('*.mat','Select *.mat edge
file');
inImg = load(strcat(pname,fname));
testImg = inImg.img;

sizeInc = linspace(1,4,30);
FDvalues = zeros(1,length(sizeInc));

csz = size(testImg);
for n = 1:length(sizeInc)
tsz = [floor(csz(1)*sizeInc(n))
floor(csz(2)*sizeInc(n))];
dx = floor((floor(csz(1)*sizeInc(n)) - csz(1))/2);
dy = floor((floor(csz(2)*sizeInc(n)) - csz(2))/2);
timg = zeros(tsz);
timg(dx+1:dx+csz(1),dy+1:dy+csz(2)) = testImg;
imshow(timg); pause(1);
FDvalues(n) = fdcalculator(timg)
end

plot(sizeInc, FDvalues, 'o');


%plot(sizeInc.*csz(1),FDvalues, 'o'); %for square images
only
%FDmean=mean(FDvalues);
%FDstd=std(FDvalues);
%title(['frame size: mean=' num2str(FDmean) '; std='
num2str(FDstd)]);
%xlabel('frame dimension (as multiple of the img
dimension)');
%ylabel('fractal dimension');

end

function compareFDrotation()
% Get input file names
[fname,pname] = uigetfile('*.mat','Select *.mat edge
file');
inImg = load(strcat(pname,fname));
testImg = inImg.img;

rota = linspace(0,360,25);
FDvalues = zeros(1,length(rota));

for n = 1:length(rota)
rimg = imrotate(testImg,rota(n),'nearest','crop');
imshow(rimg); pause(1);
FDvalues(n) = hausDim(rimg);
end

plot(rota, FDvalues);

FDmean=mean(FDvalues);
FDstd=std(FDvalues);
title(['rotation: mean=' num2str(FDmean) '; std='
num2str(FDstd)]);
xlabel('rotation (degrees)');
ylabel('fractal dimension');
stop=1;
end

Das könnte Ihnen auch gefallen