HDFGroup/hdfview

Image View bug

Opened this issue · 2 comments

Whenever I switch to view my data in image form and move through the dataset, a random patch of white pixels will be removed throughout the image and as I go on, more appear until the majority of the image is not visible.
HDFView 3.1.4. Windows 11. Tried this on 3 systems (windows 10 and 11), with the same bug appearing.

(SUPPORT-1896)

I have tried this with the next release, HDFView-3.3.0, which should release next week and I can't reproduce it that version.

This is still present in version 3.3.1. But it isn't really a bug afaik. It is (to my knowledge) due to the IMAGE_MINMAXRANGE image attribute not being set, or not being set correctly. I had the same issue. See documentation here.

Your image data probably has the following attributes:

CLASS: "IMAGE"
IMAGE_SUBCLASS: "IMAGE_GRAYSCALE"

or perhaps IMAGE_SUBCLASS is "IMAGE_TRUECOLOR"? I think either way HDFView automatically sets the brightness range (colorbar) of the image to the min and max of the first displayed image. So if your first image has the brightness range from -2 to +5, and the next image has the brightness range of -2 to +6, then all pixels over the brightness of 5 will turn white, because the IMAGE_MINMAXRANGE was automatically set to (-2, 5) when you first opened the image series.

If you look at the brightness range (colorbar), you will see that it doesn't change as you go through the image series.

As a sidenote, you can verify this by closing the dataset view when at another image. Then reopen it, the brightness range (colorbar) will be different, and you will get different white patches.

Solution

The solution is to set the IMAGE_MINMAXRANGE attr for the image data. For example, in my case my dtype is float32, but I know my data goes from -2pi to +2pi, therefore I can set my attrs to roughly:

CLASS: "IMAGE"
IMAGE_SUBCLASS: "IMAGE_GRAYSCALE"
IMAGE_MINMAXRANGE: (-7, +7)

Now, as I move through my image series, there are no white patches appearing.