Hello,
I have problems using contrast enhancement on 16 bit gray-level images. My images have 99% of pixel values in the 5% of true min-max range, so an histogram with 256 bins will have huge pixel counts on a few bins. This gives inappropriate contrast enhancement since it seems that ImageJ uses 256 bin histogram for this function. I have an example image here: http://dl.dropbox.com/u/2539804/TD1.tif Good LUT range for this image is about 5 to 250 levels, but the "enhance contrast" with 0,35 gives 3 to 743, leading to a poorly contrasted display. INMHO computing histogram on more bins should solve the problem. Best regards, Charles |
How about:
run("Median...", "radius=0.5"); makeOval(488, 595, 34, 37); run("Measure"); run("Subtract...", "value=48"); run("Gamma...", "value=something you like run("Brightness/Contrast..."); -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Charles Brossollet Sent: Thursday, December 02, 2010 4:46 AM To: [hidden email] Subject: Enhance Contrast with 16 bit images only uses 256 bins Hello, I have problems using contrast enhancement on 16 bit gray-level images. My images have 99% of pixel values in the 5% of true min-max range, so an histogram with 256 bins will have huge pixel counts on a few bins. This gives inappropriate contrast enhancement since it seems that ImageJ uses 256 bin histogram for this function. I have an example image here: http://dl.dropbox.com/u/2539804/TD1.tif Good LUT range for this image is about 5 to 250 levels, but the "enhance contrast" with 0,35 gives 3 to 743, leading to a poorly contrasted display. INMHO computing histogram on more bins should solve the problem. Best regards, Charles ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= |
Michael,
Thanks but your macro modifies the image, and you'd have to select a different area for a different image... This is not ideal for me. Cheers, Charles Le 2 déc. 2010 à 14:36, Cammer, Michael a écrit : > How about: > run("Median...", "radius=0.5"); > makeOval(488, 595, 34, 37); > run("Measure"); > run("Subtract...", "value=48"); > run("Gamma...", "value=something you like > run("Brightness/Contrast..."); > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Charles Brossollet > Sent: Thursday, December 02, 2010 4:46 AM > To: [hidden email] > Subject: Enhance Contrast with 16 bit images only uses 256 bins > > Hello, > > I have problems using contrast enhancement on 16 bit gray-level images. My > images have 99% of pixel values in the 5% of true min-max range, so an > histogram with 256 bins will have huge pixel counts on a few bins. This > gives inappropriate contrast enhancement since it seems that ImageJ uses 256 > bin histogram for this function. > > I have an example image here: > http://dl.dropbox.com/u/2539804/TD1.tif > > Good LUT range for this image is about 5 to 250 levels, but the "enhance > contrast" with 0,35 gives 3 to 743, leading to a poorly contrasted display. > INMHO computing histogram on more bins should solve the problem. > > Best regards, > Charles > > ------------------------------------------------------------ > This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. > ================================= |
Hi Charles,
here is a simple macro that should do it. I have written it for 16-bit images only; float images would need a slightly different version. saturated = 0.01; // 1%, you may change this values = newArray(65536); counts = newArray(65536); nPixels = getWidth()*getHeight(); getHistogram(values, counts, 65536); n = 0; for (i=0; i< 65536; i++) { n+= counts[i]; if(n>nPixels*saturated) { lower = calibrate(i); i = 65536; //break } } n = 0; for (i=65536-1; i>=0; i--) { n+= counts[i]; if(n>nPixels*saturated) { upper = calibrate(i); i = 0; //break } } print(lower+"-"+upper); setMinAndMax(lower, upper); Michael (another one) ________________________________________________________________ On 2 Dec 2010, at 16:18, Charles Brossollet wrote: > Michael, > > Thanks but your macro modifies the image, and you'd have to select > a different area for a different image... This is not ideal for me. > > Cheers, > Charles > > Le 2 déc. 2010 à 14:36, Cammer, Michael a écrit : > >> How about: >> run("Median...", "radius=0.5"); >> makeOval(488, 595, 34, 37); >> run("Measure"); >> run("Subtract...", "value=48"); >> run("Gamma...", "value=something you like >> run("Brightness/Contrast..."); >> >> -----Original Message----- >> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf >> Of Charles Brossollet >> Sent: Thursday, December 02, 2010 4:46 AM >> To: [hidden email] >> Subject: Enhance Contrast with 16 bit images only uses 256 bins >> >> Hello, >> >> I have problems using contrast enhancement on 16 bit gray-level >> images. My >> images have 99% of pixel values in the 5% of true min-max range, >> so an >> histogram with 256 bins will have huge pixel counts on a few bins. >> This >> gives inappropriate contrast enhancement since it seems that >> ImageJ uses 256 >> bin histogram for this function. >> >> I have an example image here: >> http://dl.dropbox.com/u/2539804/TD1.tif >> >> Good LUT range for this image is about 5 to 250 levels, but the >> "enhance >> contrast" with 0,35 gives 3 to 743, leading to a poorly contrasted >> display. >> INMHO computing histogram on more bins should solve the problem. >> >> Best regards, >> Charles >> >> ------------------------------------------------------------ >> This email message, including any attachments, is for the sole use >> of the intended recipient(s) and may contain information that is >> proprietary, confidential, and exempt from disclosure under >> applicable law. Any unauthorized review, use, disclosure, or >> distribution is prohibited. If you have received this email in >> error please notify the sender by return email and delete the >> original message. Please note, the recipient should check this >> email and any attachments for the presence of viruses. The >> organization accepts no liability for any damage caused by any >> virus transmitted by this email. >> ================================= |
Thank you very much, it did the trick.
Will see if I can submit a patch to have this in normal use Best, Charles Le 3 déc. 2010 à 18:48, Michael Schmid a écrit : > Hi Charles, > > here is a simple macro that should do it. > I have written it for 16-bit images only; float images would need a slightly different version. > > > saturated = 0.01; // 1%, you may change this > values = newArray(65536); > counts = newArray(65536); > nPixels = getWidth()*getHeight(); > getHistogram(values, counts, 65536); > n = 0; > for (i=0; i< 65536; i++) { > n+= counts[i]; > if(n>nPixels*saturated) { > lower = calibrate(i); > i = 65536; //break > } > } > n = 0; > for (i=65536-1; i>=0; i--) { > n+= counts[i]; > if(n>nPixels*saturated) { > upper = calibrate(i); > i = 0; //break > } > } > print(lower+"-"+upper); > setMinAndMax(lower, upper); > > > Michael (another one) > ________________________________________________________________ > > On 2 Dec 2010, at 16:18, Charles Brossollet wrote: > >> Michael, >> >> Thanks but your macro modifies the image, and you'd have to select a different area for a different image... This is not ideal for me. >> >> Cheers, >> Charles >> >> Le 2 déc. 2010 à 14:36, Cammer, Michael a écrit : >> >>> How about: >>> run("Median...", "radius=0.5"); >>> makeOval(488, 595, 34, 37); >>> run("Measure"); >>> run("Subtract...", "value=48"); >>> run("Gamma...", "value=something you like >>> run("Brightness/Contrast..."); >>> >>> -----Original Message----- >>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Charles Brossollet >>> Sent: Thursday, December 02, 2010 4:46 AM >>> To: [hidden email] >>> Subject: Enhance Contrast with 16 bit images only uses 256 bins >>> >>> Hello, >>> >>> I have problems using contrast enhancement on 16 bit gray-level images. My >>> images have 99% of pixel values in the 5% of true min-max range, so an >>> histogram with 256 bins will have huge pixel counts on a few bins. This >>> gives inappropriate contrast enhancement since it seems that ImageJ uses 256 >>> bin histogram for this function. >>> >>> I have an example image here: >>> http://dl.dropbox.com/u/2539804/TD1.tif >>> >>> Good LUT range for this image is about 5 to 250 levels, but the "enhance >>> contrast" with 0,35 gives 3 to 743, leading to a poorly contrasted display. >>> INMHO computing histogram on more bins should solve the problem. >>> >>> Best regards, >>> Charles >>> >>> ------------------------------------------------------------ >>> This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. >>> ================================= |
In reply to this post by Charles Brossollet-2
On Dec 2, 2010, at 4:45 AM, Charles Brossollet wrote:
> Hello, > > I have problems using contrast enhancement on 16 bit gray-level images. My > images have 99% of pixel values in the 5% of true min-max range, so an > histogram with 256 bins will have huge pixel counts on a few bins. This > gives inappropriate contrast enhancement since it seems that ImageJ uses 256 > bin histogram for this function. > > I have an example image here: > http://dl.dropbox.com/u/2539804/TD1.tif > > Good LUT range for this image is about 5 to 250 levels, but the "enhance > contrast" with 0,35 gives 3 to 743, leading to a poorly contrasted display. > INMHO computing histogram on more bins should solve the problem The Process>Enhance Contrast command in the 1.44l daily build uses 65536 bin histograms with 16-bit images. -wayne |
Free forum by Nabble | Edit this page |