Date: Mar 4, 2013 12:32 PM Author: Tony Kittler Subject: Re: ROC curve of target and source images "S C.Carl" wrote in message <kh1rmd$9n8$1@newscl01ah.mathworks.com>...

> "Alan B" <monguin61REM@OVETHIS.yahoo.com> wrote in message <kgqn0c$8pv$1@newscl01ah.mathworks.com>...

> > "Carl S." wrote in message <kgjuaj$6d3$1@newscl01ah.mathworks.com>...

> > > "Alan B" <monguin61REM@OVETHIS.yahoo.com> wrote in message <kgjkn4$b5j$1@newscl01ah.mathworks.com>...

> > > > > "Carl S." wrote in message <kgfk3g$9i5$1@newscl01ah.mathworks.com>...

> > > > > I have performed the following process:

> > > > > 1) I have applied Dice similarity measurement for automatically segmented images and obtained the following similarity coefficients

> > > >

> > > > ROC curves are more generally applicable than just your application, so it is not clear what you expect your function to do. If you want help, you might want to try explaining what you are trying to do in more detail.

> > >

> > > Thanks Alan,

> > > I would like to compare different segmentation algorithms. I have obtained segmented images from these algorithms. I have manually segmented images. I want to draw ROC curve. To draw ROC curve, I need some values such as positive true, negative true values. When I searched matlab functions to obtain these values, the functions ask Label and Scores. But I dont know how can I decide the labels and scores. Think that you have segmented brain image. How can you decide ?

> > >

> > > Shortly, I have automatically segmented images obtained from different algorithms. And manually segmented reference images. Now, I need an application that gets these images as input and draws ROC curves.

> > > Help me pls

> >

> > This isn't a matlab-specific question; there are several different ways you might do that. If you can explain exactly what algorithm you are trying to implement, then you can expect an answer here. If you aren't sure what algorithm is appropriate to use for your problem, then your teacher/boss/reference paper is a better place to get that information.

>

> I have updated the codes but still the results are unexpected :((

> Could you PLEASE run the following codes for your images and inform me whether you get correct results or not. I need your help

>

> clear all; close all;

>

> TargetImg=imread('GRAYSCALEref.png');

> Test(:,:,1)=imread('GRAYSCALEtest1.png');

> Test(:,:,2)=imread('GRAYSCALEtest2.png');

>

> [u v]=size(TargetImg);

> TPrate=zeros(1, u, 2); FPrate=zeros(1, u, 2);

>

> for i=1:2

>

> TestImg=Test(:,:,i);

>

> TargetMask = zeros(size(TargetImg(:,:,1)));

> TargetMask = TargetImg(:,:,1)>0;

> NotTargetMask = logical(1-TargetMask);

>

> TestMask = zeros(size(TestImg));

> TestMask= TestImg>0;

>

> FPimg = TestMask.*NotTargetMask

> FP = sum(FPimg(:))

>

> TPimg = TestMask.*TargetMask

> TP = sum(TPimg(:))

>

> FNimg = TargetMask-TPimg

> FN = sum(FNimg(:))

>

> TNimg = 1- FPimg

> TN =sum(TNimg(:))

>

> TPrate(1,:,i)=TP/(TP+FN);

> FPrate(1,:,i)=FP/(FP+TN);

>

> Sensitivity(i)= TP/(TP+FN)*100

> Specificity(i)= TN/(TN+FP)*100

> Accuracy(i)=(TP+TN)/(TP+TN+FN+FP)*100

>

> end

> plot(sort(FPrate(:,:,1)), sort(TPrate(:,:,1)),'-y','LineWidth',3);

> plot(sort(FPrate(:,:,2)), sort(TPrate(:,:,2)),'-g','LineWidth',3);

> axis([0:1,0:1]);

The values from my target and test images , which have the same size (256,256), from the above codes are :

TP = 1371

FN = 205

FP = 12171

TN = 51789

As you see, FP is high (means that classifier indicates some pixels as foreground but they are actually background). Therefore, I guess that the accuracy is lower than about 50%, but the formula, Accuracy=(TP+TN)/(TP+TN+FN+FP)*100 gives the result as 81.11.

Similarly, sensitivity and specificity values are 86.99 and 80.97, which are too high for this test image

According to these metrics the classifier is successful. But the foreground on the test image seems very different from the foreground on the target image. I mean the classifier is not successful but the results do not say the same thing. WHY ? Please correct me

if I wrong (Note: I used zero as the threshold value to separate the foreground(grayscale) and background that is already zero)

My other question is that the following codes

> TPrate(1,:,i)=TP/(TP+FN);

> FPrate(1,:,i)=FP/(FP+TN);

give a point. I would like to see the curve. How to draw the curve ?