Hi,
I have a problem with the 'threshold' dialog. I would like to adjust the Brightness and Contrast settings (B&C dialog) and then choose a threshold using the sliders on the 'threshold' dialog. Whenever I make any changes on the 'threshold' dialog, ImageJ resets the Brightness and Contrast settings to default. I am assuming it is trying to display the complete intensity histogram for thresholding but I don't want that. In my particular case, I have images with a few bright pixels and the relevant signal at much lower intensities. I cannot choose a useful threshold without seeing the low intensity signal. Is there a way to prevent ImageJ to reset the intensity scaling for thresholding? thanks in advance, Johannes |
On Jan 28, 2012, at 1:32 PM, Johannes Larsch wrote:
> Hi, > > I have a problem with the 'threshold' dialog. I would like to adjust the > Brightness and Contrast settings (B&C dialog) and then choose a > threshold using the sliders on the 'threshold' dialog. > > Whenever I make any changes on the 'threshold' dialog, ImageJ resets the > Brightness and Contrast settings to default. I am assuming it is trying > to display the complete intensity histogram for thresholding but I don't > want that. > In my particular case, I have images with a few bright pixels and the > relevant signal at much lower intensities. I cannot choose a useful > threshold without seeing the low intensity signal. > > Is there a way to prevent ImageJ to reset the intensity scaling for > thresholding? The Image>Adjust>Threshold dialog resets the brightness/contrast settings of 16-bit and 32-bit (float) images. To work around this problem, adjust the brightness/contrast, convert to 8-bits (Image>Type>8-bit), then set the threshold. If intensity measurements are needed, convert the threshold to a selection (Edit>Selection>Create Selection), then revert to the original image (File>Revert). -wayne |
hi wayne, thanks for your response.
I am afraid this is not a workable solution for me because 1) I need to select the threshold on the 16bit image to track particles based on the selected threshold and then take intensity measurements based on particle information 2) I would like to be able to go back and forth between the B&C and threshold dialogs quickly to determine a useful threshold. I am doing this as part of a semi automated script that goes through hundreds of stacks, therefore I would rather not have to take this extra conversion step each time. Is there a way do disable the resetting feature of the threshold dialog? I don't mind digging deeper into the ImageJ code, I just don't know where the problem originates. thanks, Johannes On 1/28/2012 6:02 PM, Rasband, Wayne (NIH/NIMH) [E] wrote: > On Jan 28, 2012, at 1:32 PM, Johannes Larsch wrote: > >> Hi, >> >> I have a problem with the 'threshold' dialog. I would like to adjust the >> Brightness and Contrast settings (B&C dialog) and then choose a >> threshold using the sliders on the 'threshold' dialog. >> >> Whenever I make any changes on the 'threshold' dialog, ImageJ resets the >> Brightness and Contrast settings to default. I am assuming it is trying >> to display the complete intensity histogram for thresholding but I don't >> want that. >> In my particular case, I have images with a few bright pixels and the >> relevant signal at much lower intensities. I cannot choose a useful >> threshold without seeing the low intensity signal. >> >> Is there a way to prevent ImageJ to reset the intensity scaling for >> thresholding? > > The Image>Adjust>Threshold dialog resets the brightness/contrast settings of 16-bit and 32-bit (float) images. To work around this problem, adjust the brightness/contrast, convert to 8-bits (Image>Type>8-bit), then set the threshold. If intensity measurements are needed, convert the threshold to a selection (Edit>Selection>Create Selection), then revert to the original image (File>Revert). > > -wayne |
Hi Johannes,
probably your wish is a more common one - I would also be happier with the threshold not killing the B&C settings. Unfortunately, it is not so easy, and in addition one has to take care not to break any existing plugins/macros with such a modification. Currently, the display for thresholding is done by modifying the lookup table; all thresholded values get a red color in the lookup table of the 8-bit image that the 16-bit or float image is converted to for display (which, by the way, also leads to some rounding errors). As the threshold can be any value, this means that all values must be in the LUT. If we have increased contrast, part of the image will be saturated and there is no way to differentiate between thresholded and non-thresholded pixels in the saturated area, because all pixels there have the same 8-bit value. That's where the current behavior comes from. Possible ways out: (1) Modifying the ShortProcessor and FloatProcessor: setThreshold would not revert to getMin(), getMax(), and use the current grayscale scaling (min, max) to calculate the minT, maxT values that are used for the 8-bit display. The question is what to do if one of the threshold values is beyond the grayscale min, max range (and not at the global minimum or maximum of the pixel values). One could extend the min, max range in such a case; but one has to consider what happens if the user just quickly moves the threshold slider through the 'forbidden' range... One might also think about a modified getBufferedImage() method, which does not simply use the standard 'convertToByte', but a modified conversion method that has one special gray value for thresholded saturated pixels; and the ImageProcessor class must be modified for this (which sounds a bit like an ugly hack). To keep compatibility with old macros that might rely on the current behavior, one should then have a checkbox somewhere in the options "Allow Thresholding with modified B&C" or the like. (2) Adding some type of overlay. The overlay image could be either the full image or just the red thresholded area (IndexColorModel with transparency). This would be more memory-consuming, probably also slower performance, and less easy to integrate in ImageJ (but it would have the advantage that it could be applied to RGB images, where the danger of destroying the image by Color Threshold would be reduced). If someone as a good and easy-to-implement solution, I would also be happy to see it in ImageJ! Michael ________________________________________________________________ On Jan 29, 2012, at 01:09, Johannes Larsch wrote: > hi wayne, thanks for your response. > I am afraid this is not a workable solution for me because > 1) I need to select the threshold on the 16bit image to track particles based on the selected threshold and then take intensity measurements based on particle information > 2) I would like to be able to go back and forth between the B&C and threshold dialogs quickly to determine a useful threshold. I am doing this as part of a semi automated script that goes through hundreds of stacks, therefore I would rather not have to take this extra conversion step each time. > > Is there a way do disable the resetting feature of the threshold dialog? I don't mind digging deeper into the ImageJ code, I just don't know where the problem originates. > > thanks, > Johannes > > On 1/28/2012 6:02 PM, Rasband, Wayne (NIH/NIMH) [E] wrote: >> On Jan 28, 2012, at 1:32 PM, Johannes Larsch wrote: >> >>> Hi, >>> >>> I have a problem with the 'threshold' dialog. I would like to adjust the >>> Brightness and Contrast settings (B&C dialog) and then choose a >>> threshold using the sliders on the 'threshold' dialog. >>> >>> Whenever I make any changes on the 'threshold' dialog, ImageJ resets the >>> Brightness and Contrast settings to default. I am assuming it is trying >>> to display the complete intensity histogram for thresholding but I don't >>> want that. >>> In my particular case, I have images with a few bright pixels and the >>> relevant signal at much lower intensities. I cannot choose a useful >>> threshold without seeing the low intensity signal. >>> >>> Is there a way to prevent ImageJ to reset the intensity scaling for >>> thresholding? >> >> The Image>Adjust>Threshold dialog resets the brightness/contrast settings of 16-bit and 32-bit (float) images. To work around this problem, adjust the brightness/contrast, convert to 8-bits (Image>Type>8-bit), then set the threshold. If intensity measurements are needed, convert the threshold to a selection (Edit>Selection>Create Selection), then revert to the original image (File>Revert). >> >> -wayne |
Free forum by Nabble | Edit this page |