-
Notifications
You must be signed in to change notification settings - Fork 206
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
bug-fix: wrong metadata used for scale in ZEISS tifs #2056
bug-fix: wrong metadata used for scale in ZEISS tifs #2056
Conversation
for zeiss tiff reader
Additional problems found (for sure not for this PR)I have found also that hyperspy has the problem with getting time and date. I tracked the problem and it is originating from Tifffile library... well, not exactly, the Time and Date gets not parsed by Gohlke's Tifffile library as it is for some unknown reasons saved inconsistently inside Zeiss tag. Most of tags have key and argument separated by "=", but date and time with ":". try:
name, value = line.split('=')
except ValueError:
continue when is changed with this: try:
name, value = line.split('=')
except ValueError:
try:
name, value = line.split(':', 1)
except :
continue I am wondering if that is optimal way... |
I remember to have been annoyed with this and I could not sorted out because I have been provided with only one file! Could you please open an separate issue on the date/time bug, since this is going to take a bit of time to get sorted out? |
Ok, this than can be reviewed. |
Some Zeiss tiff file doesn't have the A 512 pixel image is ~200kB, so it should be fine to add it to the test suite? |
interesting... I need to meditate this :) Well this is not worse case actually, the even older versions had no human readable key-value tags, but list of tuples with some essential and not so essential metadata, which is still prepending the readable part even in the latest format. |
One can get to lean for the the logic like this :
But, considering the above shared image sample... |
I am thinking if not to close this PR, as I am considering to push PR for #2057 with complete update of Tifffiles, where lots of tiff.py in io_plugins changes, as newest tifffiles simplifies lots of things a lot. So I could shoot the different problems with Zeiss tif reading in single PR. Unless that PR will be fiercely rejected, then I should implement it with this PR. I am nearly done with test adoption for most recent |
This is exactly what I was hoping for: find a more universal approach! And if you work something out then, that's great! :)
Yes, you can use this file, it is not mine but I have asked for permission.
Up to you, what you think it is more sensible/convenient. |
I am closing this as PR #2064 addresses this issue better. |
Current problem
Currently loading 0.5k, 2k and 3k resolution zeiss tif files gets wrong scale.
Detailed description
Zeiss SEM can produce different resolution images. There is one unfortunate detail, tag contains two parameters for resolution:
AP_pixel_size
andAP_image_pixel_size
, where currently first one is used in hyperspy. If image is taken at 1k resolution, both parameters are the same, however if 0.5k, 2k or 3k, those attributes differ (2x, 0.5x, 0.(3)x).AP_pixel_size
does not represent the real pixel size of the image, but only physical pixel size on physical monitor.AP_image_pixel_size
however presents the real pixel size.Description of the change
Change the attribute for scale from
AP_pixel_size
toAP_image_pixel_size
so that 2k and 3k images could be load with the right scale.Progress of the PR
I am not sure it would be good to upload 2k zeiss image (additional 3MB) to the test folder, current test should be enough.