Extraction of blood vessel using entropic thresholding

hello sir m working with extraction of blood vessels..i want to extract the blood vessels using entropic thresholding method .I also have a code..but when i execute it i get a plain blank image i tried varying the values but still its the same.can somebody please help me on this..please?
Heres my entire code
function GABOR_Callback(hObject, eventdata, handles)
% hObject handle to GABOR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
A = getimage();
I = A(:,:,2);
%A(:,:,1) =0;
%A(:,:,3) =0;
N = 12;
Sx = 8;
Sy = 2;
f = 0.1;
nf = 1;
theta = 0;
I = im2double(I);
img_out = zeros(size(I,1),size(I,2),N);
for i = 1:12
theta = (i*15*pi)/180;
for x = -fix(Sx):fix(Sx)
for y = -fix(Sy):fix(Sy)
xPrime = x * cos(theta) + y * sin(theta);
yPrime = y * cos(theta) - x * sin(theta);
G(fix(Sx)+x+1,fix(Sy)+y+1) = exp(-nf*pi*((xPrime/Sx)^2+(yPrime/Sy)^2))*cos(2*pi*f*xPrime);
end
end
%G = max(G(:))-G;
%s=sum(G(:));
%mn=s/357;
%G=G-mn;
%figure;
%imshow(real(G));
%title('real image');
c = conv2(I,real(G),'same');
%figure;
%imshow(c);
%title('convo image');
img_out=zeros(size(c,1),size(c,2),N);
img_out(:,:,i)= c;
image3D = cat(3,img_out(:,:,1),img_out(:,:,2), img_out(:,:,3),img_out(:,:,4),img_out(:,:,5), img_out(:,:,6),img_out(:,:,7),img_out(:,:,8), img_out(:,:,9),img_out(:,:,10),img_out(:,:,11),img_out(:,:,12));
% Find the max along dimension #3.
maxG = max(image3D, [], 3);
end
figure;
imshow(maxG);
title('convoluted image');
rt = fix(maxG);
[M,N] =size(rt);
cmtx = zeros(256,256);
for m = 1:M-1
for n = 1:N-1
cmtx(rt(m,n)+1,rt(m,n+1)+1) = cmtx(rt(m,n)+1,rt(m+1,n+1)+1) + 1;
end
end
scmtx = sum(cmtx(:));
prob = cmtx/scmtx;
emax = -100;
for i=1:255
probA = 0;
probC = 0;
subProbA = prob(1:i,1:i);
probA = sum(subProbA(:));
HA(i) = -0.5*(probA*log2(probA+0.0000001));
subProbC = prob(i+1:256,i+1:256);
probC = sum(subProbC(:));
HC(i) = -0.5*(probC*log2(probC+0.0000001));
e1(i) = HA(i) + HC(i);
if e1(i) >= emax
emax = e1(i);
tt1 = i;
end
end
figure;
imshow(e1(i));
and my image for thresholding is (this image is the output of convolution)
%

7 Comments

Well you edited and messed up all the nice formatting I did for you! Did you read the link I gave you?
Tip: Paste your code into a MATLAB editor window, type control-a, then control-i, then control-c and come back here and type control-v to paste in the fixed code. Then highlight all the code and click {}Code.
I'll try to look at your code tomorrow.
sir m extremly sorry...i did not mean to mess up your code...sorry i was in hurry.its my mistake..but sir please do look into my code and help me please
There's some problem:
Attempted to access cmtx(2.51537,4.48218); index must be a positive integer or logical.
Error in test (line 60)
cmtx(rt(m,n)+1,rt(m,n+1)+1) = cmtx(rt(m,n)+1,rt(m+1,n+1)+1) + 1;
I didn't dig into the code, I just ran it. But you can't have fractional indexes - they must be integers, like row 2, column 4. There is no 2.51537th row or 4.48218th column.
right sir ..i edited the above code..i fixed this error using rt = fix(maxG) i donno whether m right by doing this
I don't know what you did, but if you fixed it, then you are doing the right thing.
since the values are in double try converting the output to uint8 im2uint8(image) or use mat2gray(image).

Sign in to comment.

Answers (1)

Evidently no pixels are above your threshold. What is the threshold that your code chose?

3 Comments

Sir i changed my code..can u now suggest me what is the problem..is there any mistake in my code please
What you posted seems to start past the beginning of your code. Please attach your m-file.
sir i have pasted my m-file code

Sign in to comment.

Categories

Asked:

on 25 Nov 2013

Commented:

on 23 Dec 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!