Thresholding an image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Thresholding an image

Yevgeniy Romin
Hello everybody

I found something peculiar and was wondering whether this is a bug.  If I threshold an image and hit apply, it usually generates a binary mask of the thresholded region.  If I do the same thing after running the "tubeness" algorithm on the image, a prompt pops up that asks whether I want to set the background pixels as NaN.  If I say yes, it keeps the image as is without the non-thresholded pixels, and if I say cancel, it generates the standard binary mask.  After looking around a bit, it seems that the set background pixels as NaN option only works on 32-bit floating images (very specific).  I found this option to be very useful, is there any way to have it or something similar (like setting background pixes to 0) when thresholding regular images?  Because it's very convenient, at least for what I am doing.

Thanks very much in advance,

Yevgeniy Romin

=====================================================================

     Please note that this e-mail and any files transmitted from
     Memorial Sloan Kettering Cancer Center may be privileged, confidential,
     and protected from disclosure under applicable law. If the reader of
     this message is not the intended recipient, or an employee or agent
     responsible for delivering this message to the intended recipient,
     you are hereby notified that any reading, dissemination, distribution,
     copying, or other use of this communication or any of its attachments
     is strictly prohibited.  If you have received this communication in
     error, please notify the sender immediately by replying to this message
     and deleting this message, any attachments, and all copies and backups
     from your computer.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Thresholding an image

Wayne Rasband-2
> On Jul 7, 2017, at 5:03 PM, Yevgeniy Romin <[hidden email]> wrote:
>
> Hello everybody
>
> I found something peculiar and was wondering whether this is a bug.  If I threshold an image and hit apply, it usually generates a binary mask of the thresholded region.  If I do the same thing after running the "tubeness" algorithm on the image, a prompt pops up that asks whether I want to set the background pixels as NaN.  If I say yes, it keeps the image as is without the non-thresholded pixels, and if I say cancel, it generates the standard binary mask.  After looking around a bit, it seems that the set background pixels as NaN option only works on 32-bit floating images (very specific).  I found this option to be very useful, is there any way to have it or something similar (like setting background pixes to 0) when thresholding regular images?  Because it's very convenient, at least for what I am doing.

You can do this using a simple macro. For example, this one thresholds the 8-bit AuPbSn sample image and sets the background to zero.

   run("AuPbSn 40 (56K)");
   setAutoThreshold("Default");
   getThreshold(t0, t1);
   changeValues(0, t0-1, 0);
   changeValues(t1+1, 255, 0);
   resetThreshold();

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html