The contrast enhancement of a FloatProcessor does not change the pixel values.
It is used only for display purposes and during conversion to adjust to the proper visual(!) dynamic range.
You compute the contrast map by calling resetMinAndMax. This takes the active selection as an input.
Or if there is none - the entire image.
This is in contrast with the ByteProcessor where adjustment of contrast updates the byte array and hence is irreversible in the general case.
I am used to first converting to ByteProcessor, then selecting an appropriate LUT, and then converting to RGB for display/publication purposes.
Date: Mon, 18 Jan 2021 06:19:55 -0600
From: Kenneth R Sloan <[hidden email]>
Subject: Re: Code review?
I have not tried that, yet. Intuitively, it seems possible to lose precision in cases where the "Enhance" step further narrows the range.
But, perhaps the conversion to Byte is itself more careful than the conversion from 32-bit directly to Color.
I will try it. It looks like I should write a comprehensive set of test cases to sort this out.
For that matter, I should probably try to replicate the failures I saw earlier. Perhaps the problem was with something unrelated to the conversions.
I'm at the stage now where what I have works for the (moderately
challenging) set of test cases I have - but I don't have a clear understanding on WHY some steps are necessary. Perhaps they are not?
All I know is that the 32-to-color case was broken and now works. Now, I should try to break it again.
This is a bit separate from my original question, which is: I know that
some(most) of my steps are NOT necessary for source images that are NOT 32-bit. I was wondering if anyone had an opinion that these steps were actually harmful (other than wasting time or space.
On the one hand, I come from a long tradition of counting every cycle and every byte. On the other hand I like straight line code that is easy to read, without special cases.
Thank you for the suggestion. I will experiment further.
On Mon, Jan 18, 2021 at 03:04 Dimiter Prodanov (imec) < [hidden email]> wrote:
> Dear Ken,
> Have you also tried first to convert to a ByteProcessor ?
> When I resetMinAndMax before conversion I don't see issues with the
> range during conversion.
> Best regards,
> ImageJ mailing list:
> https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage > j.nih.gov%2Fij%2Flist.html&data=04%7C01%7CDimiter.Prodanov%40imec.