AllenCellModeling/aicsimageio

does not open the latest leica formats for .lif

ronnkling opened this issue · 11 comments

Discussed in #484

Originally posted by ronnkling April 9, 2023
This would be for LAS X version 3.5.0

ImageJ and Fiji do but I'm looking for a pure python app

I get the error

from aicsimageio import AICSImage
img = AICSImage("E:\Users\klingr\FLIM\Example_FLIM.lif")
File "", line 1
img = AICSImage("E:\Users\klingr\FLIM\Example_FLIM.lif")
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Hi @ronnkling , I am unable to reproduce this error unfortunately (or maybe fortunately?). I tried your image with a local build, and release builds 4.11.0 & 4.10.0. I suggest creating a new environment to test this out if possible or let us know some more information about your environment (OS / aicsimageio version). I'll close this issue out in a few days if I don't hear back, if I do feel free to re-open!

How do I tell what version I am running? And did you try the image that I uploaded?

Yep, my tests were with the image you had uploaded in the discussion.

In the environment you run the python command to run your script you can run something like pip show aicsimageio and check the version printed or pip freeze to check out all the python packages installed currently. Alternatively (or in addition), you can create a new environment using virtualenv (or however you want) by running python3.10 -m venv venv && source venv/bin/activate && pip install aicsimageio==4.11.0 (You'll need to deactivate your current virtual environment if using one and/or select a different python version if you don't have 3.10.

I followed the instructions and got python 3.10.11 and did the pip install like above. And I get the same error. This is on a windows 10 machine running the latest anaconda with the python 10 environment activated.
image

Pulling multiple threads together...

I think this one may be related? AllenCellModeling/napari-aicsimageio#76

cc @psobolewskiPhD

I think this might just be a Windows issue due to the backslash character used in paths interacting with Unicode escapes?
Perhaps it's sufficient to use \\ or use r before the quoted string?
https://stackoverflow.com/questions/2953834/how-should-i-write-a-windows-path-in-a-python-string-literal

Ehhhh I was assuming it was a metadata decode issue. We have tests that run on windows that look just like this type of pathing.

I dunno, I can't reproduce with the linked file on macOS 🤷
image

@ronnkling From your screenshot this definitely looks like a path string problem with backslash. try

img = AICSImage("E:\\Users\\klingr\\FLIM\\Example_FLIM.lif")

You definitely need to "escape" the backslashes by doubling them up.

OK, I just went into directory first and then tried the img = AICSImage("Example_FLIM.lif")

Got an error about needing to install readlif>=0.6.4 so I installed it. Now the

img = AICSImage("Example_FLIM.lif")

loads.

Closing with #517 as a potential follow-up bug