-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blobs.gif opens as 3-channel image #393
Comments
I also observed this, but thought it is intentional: the GIF format defines a palette with a subset of 256 colors (out of the 24-bit RGB colors) for each image. As such, gif images are always color images. My understanding was that ImageJ1 takes a shortcut here and displays the image as 8-bit if it detects that the R, G and B channel values are the same at each pixel position (i.e. if the image is grayscale). If we want a true 8-bit sample image, we shouldn't use GIF. |
I would call it a hack, not a shortcut. It might be highly unexpected for the user to receive a single-channel
Yes, PNG is better for that. |
@imagejan @ctrueden I just came across this and find it highly irritable that it has 3 channels in IJ2, especially since it's often used as an example image in workshops etc.. So this might also be weird for anyone working with Macros / Scripts in ImageJ in the past. I would have expected the indexed palette to be loaded as a LUT and not as RGB channels, but I also don't know anything about how LUTs are implemented. |
@frauzufall There are three kinds of indexed color images:
The Bio-Formats library provides the
I extracted this information from the Bio-Formats source code using this invocation:
Note that Bio-Formats has no capacity for (3) above—for every data source, it makes either false color or non-false color judgment, according to the table above. As you can see, GIF files are treated as non-false color, meaning their data is assumed to be the lookup table values rather than the indices of the table. This is vital for cases where the LUT is not just a trivial grayscale map, but actually representing the actual color values of e.g. an image acquired by a typical camera. Treating the indices as the values would be wrong here. So, I know it's annoying that the Blobs image is reported as RGB, but the fact is that GIF files do have three channels like that. The fact that the values are encoded using 8-bit indexed color is an internal implementation detail that should not be exposed by Bio-Formats or SCIFIO (which has analogous logic here). The solution here is not to change ImageJ, but to stop using blobs.gif for demos. |
@ctrueden Thank you for the detailed explanation! Since I am working on some examples which use the blob image (also https://imagej.nih.gov/ij/images/t1-head.gif) I would like to switch appropriately - I could save the blob and the head as TIF and request an upload to https://samples.fiji.sc/? Is there a better place? |
Even setting aside the GIF format issue, I suggest caution with the Blobs image, because:
That said, if you really want to continue using it, I think posting a converted version of it to https://samples.fiji.sc would be OK. I tested conversion to a couple different formats:
So PNG is the winner here. Therefore may I present... https://samples.fiji.sc/blobs.png ! |
Thank you! I would also use a different picture as long as it is a motivating example for Biologists and easy to show blur / segmentation / cell counting. |
Hey @ctrueden, hey @frauzufall , I just observed an issue on computers of students and I think it's related to this issue here. After running "Cache sample images" in Fiji, opening blobs.gif from the samples opens a bioformats dialog. An error message later, blobs opens properly. Thus, it is no longer possible to open blobs from a macro, because it opens a bioformats window instead of opening the image. To reproduce this issue:
These windows pop up: Are you sure that there is everything alright with the cached blobs.gif image? Thanks! Cheers, |
I don't know. This is an ImageJ1 feature, implemented here. The fact that it tries to use Bio-Formats is odd. Possible culprits:
Do you have time to research this further yourself? I am juggling too many other things right now: updating from maven.imagej.net to maven.scijava.org; completing the SCIFIO release; releasing other ImageJ & Fiji components in general. |
I can dig deeper in approx 4-5 weeks. Thanks for the hints so far! Cheers, |
Dear all,
I just tried opening blobs.gif using scifio in imagej environment. The code looks like this:
The image opens as three channel image even though it was saved as single channel gif.
Is there a way to open it correctly or is this a bug?
Thanks!
Cheers,
Robert
The text was updated successfully, but these errors were encountered: