[BioC] Visualizing the region of classification uncertainty on thresholded images
alexg at ruggedtextile.com
Tue Aug 7 10:28:00 CEST 2012
On 06.08.2012 16:26, Ravi [guest] wrote:
> I am now able to calculate the percent area of a certain phase on an
> image(thanks to the excellent help that I have received from this
> forum). My follow-up question is as follows :
> Depending on the threshold level chosen to create a binary image, the
> percent area calculated will vary. I would like to have a means of
> visualizing the uncertain regions represented by a threshold band
> level on the original image. If we start with the following code :
> img = readImage(system.file("images", "nuclei.tif",
> t2c<-t1c+tdiff; t2=t2c/255 # A second threshold level
> plot(timg) # open to suggestions for better coding!
Gives you (almost) the same plot without the intermediate table step.
> imgB=!imgB #flip foreground to background
> # Attempt to visualise the area represented by a threshold band i,e,
> # does not appear to be correct
> # the area seems to much greater than the 0.5%
> # obtained from the results of thresholding with t1 & t2
I'm not sure where you get 0.5% from? I get ~2.5%
> (length(which(img >= t1 & img <= t2))/length(img))*100
Very hard for me to judge by eye, but the displayed image looks about
right and I can't see an error in the code/logic.
> I don't think that img2 gives what I am hoping to get. As I mentioned
> previously, my intention is to identify the regions in img with
> intensity levels between t1 and t2 (the threshold band level
> represented by the red lines in the image histogram figure).
> I am interested in the following :
> 1. To color the uncertain regions in img2 with letâ€™s say red colour
> and even have the choice of making it transparent. To then superpose
> img2 on top of the original image.
> 2. Maybe the reverse process is better. To make the original figure
> transparent and superpose it on img2.
Lots of different ways to do this, but does this get you started?
img3 = rgbImage((!img2)+img,img,img)
> I am perhaps asking for too much. But I would appreciate any tip that
> I can get.
> Ravi Sutradhara
> -- output of sessionInfo():
> R version 2.15.1 (2012-06-22)
> Platform: i386-pc-mingw32/i386 (32-bit)
>  LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252
>  LC_NUMERIC=C LC_TIME=Swedish_Sweden.1252
> attached base packages:
>  splines stats graphics grDevices utils datasets
> methods base
> other attached packages:
>  CRImage_1.6.0 aCGH_1.34.0 multtest_2.12.0
> Biobase_2.16.0 BiocGenerics_0.2.0
>  survival_2.36-14 cluster_1.14.2 DNAcopy_1.30.0
> EBImage_3.12.0 abind_1.4-0
> loaded via a namespace (and not attached):
>  class_7.3-4 codetools_0.2-8 e1071_1.6 foreach_1.4.0
> iterators_1.0.6 MASS_7.3-20 stats4_2.15.1
>  tools_2.15.1
> Sent via the guest posting facility at bioconductor.org.
> Bioconductor mailing list
> Bioconductor at r-project.org
> Search the archives:
More information about the Bioconductor