Skip to content
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

blob_dog/log/doh do not work the same with float and non-float dtype images #6657

Open
haesleinhuepf opened this issue Dec 18, 2022 · 4 comments
Labels
Milestone

Comments

@haesleinhuepf
Copy link
Contributor

haesleinhuepf commented Dec 18, 2022

Description:

I tried to make blob_dog work on the human_mitosis dataset and it was hard. @tlambert03 gave the hint that this function may only work with images of type float. We were now wondering if this might be a bug, or if a comment should be added to the documentation. My tests furthermore suggest that also blog_doh and blog_log suffer from the same problem.

I propose to make sure that results are same or similar independent from the pixel data type.

Way to reproduce:

from skimage.data import human_mitosis
from skimage.feature import blob_dog
from skimage.io import imshow

data = human_mitosis()

print("\nDoG")
print(len(blob_dog(data,               min_sigma=1, max_sigma=10)))
print(len(blob_dog(data.astype(float), min_sigma=1, max_sigma=10)))
print("\nLoG")
print(len(blob_log(data,               min_sigma=1, max_sigma=10)))
print(len(blob_log(data.astype(float), min_sigma=1, max_sigma=10)))
print("\nDoH")
print(len(blob_doh(data,               min_sigma=1, max_sigma=10)))
print(len(blob_doh(data.astype(float), min_sigma=1, max_sigma=10)))

Traceback or output:

DoG
0
471

LoG
52
10131

DoH
19
5317

Version information:

3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:41:22) [MSC v.1929 64 bit (AMD64)]
Windows-10-10.0.19045-SP0
scikit-image version: 0.19.3
numpy version: 1.23.5
@imagesc-bot
Copy link

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/how-to-use-scikit-images-blob-dog/75150/5

@jni
Copy link
Member

jni commented Dec 19, 2022

@haesleinhuepf I suspect that the issue is the perpetual image data types and what they mean. Looking at the docstring of the function, I see that there is an absolute intensity threshold (threshold=), which will have different meanings for differently-scaled functions. In the case of uint8, we probably do a img_as_float() inside that rescales the intensity to [0, 1]. However, we do no such thing with a float image, so you end up with a much smaller height threshold and many more peaks exceeding that threshold.

There's possibly a quick documentation fix here along the lines of adding the line "the meaning of this threshold depends on the image data type; image data may be rescaled depending on the input dtype; for more information see (image data types and what they mean)." to the threshold parameter documentation.

The longer term fix is that skimage2 will no longer do any of this rescaling so this should just go away when that is implemented. I'll add the right milestone/tag here.

@jni jni added this to the skimage2 milestone Dec 19, 2022
@github-actions
Copy link

Hey, there hasn't been any activity on this issue for more than 180 days. For now, we have marked it as "dormant" until there is some new activity. You are welcome to reach out to people by mentioning them here or on our forum if you need more feedback! If you think that this issue is no longer relevant, you may close it by yourself; otherwise, we may do it at some point (either way, it will be done manually). In any case, thank you for your contributions so far!

@github-actions github-actions bot added the 😴 Dormant no recent activity label Jun 18, 2023
@haesleinhuepf
Copy link
Contributor Author

😴

@github-actions github-actions bot removed the 😴 Dormant no recent activity label Jun 19, 2023
@lagru lagru added the 🐛 Bug label Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants