Hi Alex and list members,
Can't help adding one more question. I would like to have a look at the image matrix corresponding to any particular particle and understand the nature of the mis-classification at the boundaries. How can I locate any particle that I am interested in? By the indices of the image matrix? I would then like to outline the region around it and extract the image intensity data. By looking at the same matrix in the threshold image, I hope to understand the nature of the errors in classification. Hope that this does not take up too much of your time. I am grateful for the help that I have received so far.
Thanks,
Ravi


________________________________
 From: Alex Gutteridge <alexg@ruggedtextile.com>

Cc: Ravi [guest] <guest@bioconductor.org>; bioconductor@r-project.org; CRImage Maintainer <failmezger@cip.ifi.lmu.de> 
Sent: Tuesday, 7 August 2012, 15:51
Subject: Re: [BioC] Visualizing the region of classification uncertainty on thresholded images

On 07.08.2012 13:53, ravi wrote:
> Hi Alex,
> Thanks a lot for your reply. You are right about the 2.5% result. I
> made a mistake.
>
> Lots of different ways to do this, but does this get you started?
>
> img3 = rgbImage((!img2)+img,img,img)
> display(img3)
>
> I tried the above commands. What I get appears to be the same as the
> original figure. Is there something that I am missing?
> Some of the stuff that I have tried are :
> I get this error message with the following command :
>
>> img4

Sorry, try this (note the added line to set pixels outside the band to 
0 in img2):

library(CRImage)
img = readImage(system.file("images", "nuclei.tif", 
package="EBImage"))[,,1]
display(img)
t1=calculateOtsu(as.vector(img));t1c<-t1*255
tdiff<-30
t2c<-t1c+tdiff; t2=t2c/255 # A second threshold level
timg<-table(img)
names(timg)<-1:255
[[elided Yahoo spam]]
abline(v=c(t1c,t2c),col="red")

imgB=createBinaryImage(img,threshold=t1)
imgB=!imgB #flip foreground to background
imgS=bwlabel(imgB)
fShape=computeFeatures.shape(imgS)
percentArea=sum(fShape[,'s.area'])/length(img)*100
percentArea
# Attempt to visualise the area represented by a threshold band i,e, 
(t2-t1)
img2<-img
crop1<-which(img2<t1)
crop2<-which(img2>t2)
crop<-c(crop1,crop2)
img2[crop]<-1
#########Note must set all other pixels to 0######
img2[-crop]<-0
display(img2)

#Adds the band areas to the red channel
img3 = rgbImage((!img2)+img,img,img)
display(img3)

-- 
Alex Gutteridge
	[[alternative HTML version deleted]]

