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

Reading LIFs, scene names vs. project structure #277

Closed
psobolewskiPhD opened this issue Jul 8, 2021 · 8 comments
Closed

Reading LIFs, scene names vs. project structure #277

psobolewskiPhD opened this issue Jul 8, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@psobolewskiPhD
Copy link
Contributor

psobolewskiPhD commented Jul 8, 2021

Use Case

I use LAS X (Leica) Navigator to image and generate LIF projects of multi-well plate imaging.
The LIFs have either tilescans or multiple RoI per well.
Importing to ImageJ using ReadMyLIFs
https://twitter.com/jmutterer/status/1387740202484092934?s=20
lets me see the full names and select what I need for analysis.
Example:
image
This is R1 in well B/2.

Importing this same LIF with aicsimageio just lists R1, but if I have many wells, then I have many R1...
Also, I may have upwards of 60 ROI in a well, that I would like to import at once, but not merge.
Example:
image
This well has 60 ROI (not part of a mosaic merge).
Again, in ImageJ ReadMyLIFs I can mark the start and end of an import to get all 60 into a stack.

Here's a link to a representative LIF:
https://www.dropbox.com/s/jk9se8i1kpzqvsn/20210428_24w_L929_Ho_B2C3.lif?dl=0
B is row B, then B/n/ are wells in the B row. R1-R5 are actually mosaic merges, but that's not material to this issue. Same with C/
At the end is B/3/R1-R60 which ideally would be able to be imported together.

Solution

Ideally, importing via aicsimageio would be aware of the Leica project structure so that tile scans and multiple ROI scans would be 1) distinguishable (most important) and 2) able to be imported together.

Alternatives

N/A

@evamaxfield evamaxfield added the bug Something isn't working label Jul 9, 2021
@psobolewskiPhD
Copy link
Contributor Author

I should add that these projects were generated using the Navigator feature.
I see readlif has an issue regarding the structure:
Arcadia-Science/readlif#19

On a related note, with the above linked .LIF, I can't seem to access scenes by index—I thought this would be a way to get around the double scenes names. However:

img.set_scene(1)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/TF-StarDist-napari/lib/python3.9/site-packages/aicsimageio/aics_image.py", line 286, in set_scene
    raise IndexError(
IndexError: Scene id: 1 is not present in available image scenes: ('Image002', 'Image003', 'Image004', 'Image005', 'Image006', 'Image 1', 'R1', 'R4', 'R5', 'R2', 'R3', 'R1_Merged', 'R4_Merged', 'R5_Merged', 'R2_Merged', 'R3_Merged', 'R1', 'R4', 'R5', 'R2', 'R3', 'R1_Merged', 'R4_Merged', 'R5_Merged', 'R2_Merged', 'R3_Merged', 'R1', 'R4', 'R5', 'R2', 'R3', 'R1_Merged', 'R4_Merged', 'R5_Merged', 'R2_Merged', 'R3_Merged', 'R1', 'R4', 'R5', 'R2', 'R3', 'R1_Merged', 'R4_Merged', 'R5_Merged', 'R2_Merged', 'R3_Merged', 'B4_no_dye', 'R1', 'R2', 'R3', 'R4', 'R5', 'R6', 'R7', 'R8', 'R9', 'R10', 'R11', 'R12', 'R13', 'R14', 'R15', 'R16', 'R17', 'R18', 'R19', 'R20', 'R21', 'R22', 'R23', 'R24', 'R25', 'R26', 'R27', 'R28', 'R29', 'R30', 'R31', 'R32', 'R33', 'R34', 'R35', 'R36', 'R37', 'R38', 'R39', 'R40', 'R41', 'R42', 'R43', 'R44', 'R45', 'R46', 'R47', 'R48', 'R49', 'R50', 'R51', 'R52', 'R53', 'R54', 'R55', 'R56', 'R57', 'R58', 'R59', 'R60')

img.current_scene_index
works...

@evamaxfield
Copy link
Collaborator

Ahhh well if readlif has an issue then yes we will as well. I can maybe dive deep into the issue for them but I am unfortunately not a LIF expert :/


On the scene index note, that's my bad. I merged those changes in but haven't released them. https://allencellmodeling.github.io/aicsimageio/CHANGELOG.html#unreleased

Sorry! Will do so now!

@evamaxfield
Copy link
Collaborator

aicsimageio v4.0.4 has been released. You should now be able to upgrade and properly use set_scene(<int>)

@psobolewskiPhD
Copy link
Contributor Author

Oh, shit I'm sorry I didn't realize what was in the docs wasn't for 4.0.3.

Works like a charm btw...

Regarding readlif I will link this issue over there. I think there may be more than one aspect at play: scene names and the channel issue observed by that OP.

@evamaxfield
Copy link
Collaborator

No worries! Our docs are aligned with main branch and generally main is always released but I just totally forgot last time.

@psobolewskiPhD
Copy link
Contributor Author

So now I'm a bit unsure if this issue belongs here or over at readlif.
I don't want to be bothering the wrong person!

Anyhow, based on your post in a different issue, I exported the xml and looked.
big-lif.xml.zip
Here's the start of the last section of images:
<Attributes><Attribute>ExtendedMemoryBlock</Attribute><Attribute>_DCSERVER_PREVENT_MEMKILL</Attribute></Attributes><Memory Size="2764800" MemoryBlockID="MemBlock_1050" /><Children /></Element><Element Name="B3 60 10x" Visibility="1" CopyOption="1" UniqueID="a6f972e2-a82c-11eb-bc72-a4bb6dca3902"><Data><Collection ChildTypeTest="AcceptAll"><ChildTypeList /></Collection></Data> <Memory Size="0" MemoryBlockID="MemBlock_1319" /><Children><Element Name="B" Visibility="1" CopyOption="1" UniqueID="a6f972e3-a82c-11eb-bc72-a4bb6dca3902"><Data><Collection ChildTypeTest="AcceptAll"><ChildTypeList /></Collection></Data> <Memory Size="0" MemoryBlockID="MemBlock_1320" /><Children><Element Name="3" Visibility="1" CopyOption="1" UniqueID="a6f972e4-a82c-11eb-bc72-a4bb6dca3902"><Data><Collection ChildTypeTest="AcceptAll"><ChildTypeList /></Collection></Data> <Memory Size="0" MemoryBlockID="MemBlock_1321" /><Children><Element Name="R1" Visibility="1" CopyOption="1" UniqueID="a6f972e5-a82c-11eb-bc72-a4bb6dca3902"><Data><Image TextDescription=""><Attachment Name="TileScanInfo" Application="LAS AF" FlipX="0" FlipY="0" SwapXY="0"><Tile FieldX="0" FieldY="0" PosX="0.0534542067" PosY="0.0256040830" />

You can see
<Element Name="B3 60 10x" Visibility="1" CopyOption="1" UniqueID="a6f972e2-a82c-11eb-bc72-a4bb6dca3902">
And then Children:
<Children><Element Name="B" Visibility="1" CopyOption="1" UniqueID="a6f972e3-a82c-11eb-bc72-a4bb6dca3902">
<Children><Element Name="3" Visibility="1" CopyOption="1" UniqueID="a6f972e4-a82c-11eb-bc72-a4bb6dca3902">
<Children><Element Name="R1" Visibility="1" CopyOption="1" UniqueID="a6f972e5-a82c-11eb-bc72-a4bb6dca3902">

At the moment, aicsimageio is just returning the last value, R1, as the scene name (img.scenes).
So to now make the feature request more precise, I'd like to see those parent names, so something like:
"B3 60 10x B3 R1"
In an ideal world, the scene would be "B3 60 10x B3" and then all the R1-60 would be part of that as M values.

@evamaxfield
Copy link
Collaborator

I think this issue should probably be moved over / recreated on readlif. All we are doing is parsing the result of readlif "image name" metadata: https://github.com/AllenCellModeling/aicsimageio/blob/main/aicsimageio/readers/lif_reader.py#L93

@psobolewskiPhD
Copy link
Contributor Author

Yeah, sorry about that, I had no idea about readlif.
Thank you for your patience, not to mention the awesome package!

psobolewskiPhD added a commit to psobolewskiPhD/aicsimageio that referenced this issue Oct 3, 2021
`Readlif` has been update to better handle scene names that have a parent/child structure.
This change addresses the issue originally reported here: AllenCellModeling#277
Bumping the version requirement on `readlif` is a significant quality-of-life improvement for `aicsimageio` users, as well as the new multi-scene reading widget in `napari-aicsimageio`. For example, in the case of multi-well experiments, regions of interest may have the same names (R1, R1 ...), but the parent (well) names will differ (A1, B2, etc.).
evamaxfield pushed a commit that referenced this issue Oct 3, 2021
`Readlif` has been update to better handle scene names that have a parent/child structure.
This change addresses the issue originally reported here: #277
Bumping the version requirement on `readlif` is a significant quality-of-life improvement for `aicsimageio` users, as well as the new multi-scene reading widget in `napari-aicsimageio`. For example, in the case of multi-well experiments, regions of interest may have the same names (R1, R1 ...), but the parent (well) names will differ (A1, B2, etc.).
janeknowsbest77 added a commit to janeknowsbest77/aicsimageio that referenced this issue Jul 25, 2024
`Readlif` has been update to better handle scene names that have a parent/child structure.
This change addresses the issue originally reported here: AllenCellModeling/aicsimageio#277
Bumping the version requirement on `readlif` is a significant quality-of-life improvement for `aicsimageio` users, as well as the new multi-scene reading widget in `napari-aicsimageio`. For example, in the case of multi-well experiments, regions of interest may have the same names (R1, R1 ...), but the parent (well) names will differ (A1, B2, etc.).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants