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

Add export and impo(rt) commands #62

Merged
merged 6 commits into from
Dec 4, 2024
Merged

Add export and impo(rt) commands #62

merged 6 commits into from
Dec 4, 2024

Conversation

dominikl
Copy link
Member

I just need a better way to export rendering settings from a pilot and import them again on IDR prod, the approach via Ids doesn't work, because they are obviously different on the machines. This PR adds an export and impo(rt) command, which exports rendering settings as yml files (.yml) resp. imports them again. This can be done either one per dataset, or traverse datasets and export one renderings settings yml for each image.

It only works for Project/Dataset/Image for now, not for Screen/Plate/Well, yet. I'll just open that as draft PR, if anyone else want to use it, install it from my branch. Assume it won't be merged anyway.

@dominikl dominikl force-pushed the export branch 2 times, most recently from 4345bfa to b06b9a8 Compare January 30, 2024 12:03
@will-moore
Copy link
Member

I tried:

$ omero render export Dataset:251 --traverse

Which seems to work, but then I wanted to import all those same rendering settings. Just using the same server, I did

$ omero render export Dataset:251

But then I realised after a few tries that it actually wants a File. But I don't have a File for the Dataset. Is there a way to import for a Dataset?
I tried the name of a yaml that had just been exported:

$ omero render impo "bar|P-TRE_10_R3D_D3D.dv"
Using session for will@localhost:4064. Idle timeout: 10 min. Current group: Swedlow Lab
Could not read bar|P-TRE_10_R3D_D3D.dv

Don't know what's going on there?

The yaml contents is:

---
channels:
    1:
        active: true
        color: 0000FF
        end: 2024.0
        label: '457.0'
        max: 32767.0
        min: -32768.0
        start: 70.0
    2:
        active: true
        color: 00FF00
        end: 4203.0
        label: '528.0'
        max: 32767.0
        min: -32768.0
        start: 48.0
    3:
        active: true
        color: FF0000
        end: 4708.0
        label: '617.0'
        max: 32767.0
        min: -32768.0
        start: 98.0
greyscale: false
t: 1
version: 2
z: 43

@dominikl
Copy link
Member Author

dominikl commented Jan 30, 2024

Guess I have describe the options a bit better.
omero render export Dataset:251 --traverse will export one renderings settings yml for each image of this dataset.
omero render export Dataset:251 will export only one rendering settings yml (of the first image of the dataset); for example if they have all the same settings anyway, which is often case.

omero render impo "bar|P-TRE_10_R3D_D3D.dv" will look for the image P-TRE_10_R3D_D3D.dv of the dataset bar to set the settings. Should work actually, don't know why you got this error. Edit: This has to be the yaml file. So maybe "bar|P-TRE_10_R3D_D3D.dv.yml"?

Just tried on a pilot using idr0144:

omero render export Dataset:16852
-> creates one yml (for first image): Bone Part 2|F_01.ome.tiff.yml

Change greyscale to true, then:

omero render impo Bone\ Part\ 2|F_01.ome.tiff.yml
-> Changed only this image to greyscale.

omero render impo --dataset Bone\ Part\ 2|F_01.ome.tiff.yml
-> Changed whole 'Bone Part 2' dataset to greyscale.

@will-moore
Copy link
Member

Thanks @dom, yes it works if I actually point it to the .yml instead of the .dv!

It feels a little painful to use the | separator instead of just creating a directory with the Dataset name and putting the Image.yml files in there but I see that if your main workflow is 1 setting per Dataset then this makes sense and works fine (also tested with --dataset and that worked too).

Checks above are failing due to flake8:

flake8.main.application   MainProcess    368 INFO     Found a total of 32 violations and reported 20
./src/omero_cli_render.py:382:80: E501 line too long (88 > 79 characters)
./src/omero_cli_render.py:383:80: E501 line too long (86 > 79 characters)
./src/omero_cli_render.py:435:80: E501 line too long (90 > 79 characters)
./src/omero_cli_render.py:436:80: E501 line too long (140 > 79 characters)
./src/omero_cli_render.py:438:80: E501 line too long (88 > 79 characters)
./src/omero_cli_render.py:439:80: E501 line too long (125 > 79 characters)
./src/omero_cli_render.py:440:80: E501 line too long (114 > 79 characters)
./src/omero_cli_render.py:443:5: E303 too many blank lines (2)
./src/omero_cli_render.py:553:5: E303 too many blank lines (2)
./src/omero_cli_render.py:571:5: E303 too many blank lines (2)
./src/omero_cli_render.py:584:80: E501 line too long (86 > 79 characters)
./src/omero_cli_render.py:603:80: E501 line too long (85 > 79 characters)
./src/omero_cli_render.py:605:80: E501 line too long (96 > 79 characters)
./src/omero_cli_render.py:609:80: E501 line too long (80 > 79 characters)
./src/omero_cli_render.py:616:5: E303 too many blank lines (2)
./src/omero_cli_render.py:639:5: E303 too many blank lines (2)
./src/omero_cli_render.py:660:80: E501 line too long (86 > 79 characters)
./src/omero_cli_render.py:662:80: E501 line too long (86 > 79 characters)
./src/omero_cli_render.py:670:80: E501 line too long (80 > 79 characters)
./src/omero_cli_render.py:673:5: E303 too many blank lines (2)

@dominikl
Copy link
Member Author

dominikl commented Feb 1, 2024

Thanks Will, using directory/filename for dataset/imagename instead of a separator is a good idea. I'll do that!

Copy link
Member

@will-moore will-moore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked fine for me with directories, thanks

@dominikl
Copy link
Member Author

dominikl commented Dec 3, 2024

I'll skip the Screen/Plate support for now. I'll add it in a separate PR when I need it for a specific IDR submission.

@dominikl dominikl marked this pull request as ready for review December 3, 2024 12:18
@jburel
Copy link
Member

jburel commented Dec 4, 2024

Commits were forced pushed. Review has been done. Merging

@jburel jburel merged commit ce6e13c into ome:master Dec 4, 2024
1 check passed
Examples:
Export one yaml file for each Dataset in a Project (first image)
(into ./DATASET_NAME/IMAGE_NAME.yml):
omero export Project:1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be: omero render export no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, yes of course. I'll open follow-up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants