Skip to content

Conversation

@jburel
Copy link
Member

@jburel jburel commented Feb 11, 2020

This PR adds a method to import images into OMERO

cc @dominikl
background https://github.com/ome/training-scripts/blob/master/practical/groovy/crop_rectangle_from_image.groovy

Corresponding tests added to ome/openmicroscopy#6212

@joshmoore
Copy link
Member

From my experiences with ImportLibrary, I'm going to guess that we will eventually need other signatures for upload methods. Something to be aware of if we will need to deprecate methods in the *Helper class.

There might also be an issue with the Ice communicator and thread pool in the Library which will need cleaning up.

@jburel
Copy link
Member Author

jburel commented Feb 11, 2020

It will be fine to deprecate method when we start working on new methods in the import library
The problem is that all the code is in the clients/scripts and people start to copy/paste such code

*/
public String getHost(ExperimenterData user)
throws DSOutOfServiceException {
Connector c = getConnector(new SecurityContext(user.getGroupId()),
Copy link
Member

Choose a reason for hiding this comment

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

Why is the Connector needed in that case, just to check if the user is logged in?

Copy link
Member Author

Choose a reason for hiding this comment

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

just to check if we have a connection

@dominikl
Copy link
Member

Thanks for adding this method 👍
Generally looks alright and works as expected. The only problem I noticed is that you have to force quit the java process when importing an image. For some reason the import process seems to create a thread which isn't cleaned up by the Gateway.disconnect() method. To test just run it in simple main() method:

public static void main(String[] args) throws Exception {
        LoginCredentials lc = new LoginCredentials("user", "pass", "merge-ci-devspace.openmicroscopy.org");
        Gateway gw = new Gateway(new SimpleLogger());
        ExperimenterData user = gw.connect(lc);
        System.out.println(user.getUserName());
        
        SecurityContext ctx = new SecurityContext(user.getGroupId());
        List<String> paths = Collections.singletonList("cats.jpg");
        boolean result = gw.getFacility(TransferFacility.class).uploadImagesDirect(ctx, paths, null);
        System.out.println(result);

        gw.disconnect();

        System.out.println("Disconnected");
    }

It'll print "Disconnected" but the Java process won't exit. I'll have a look why this happens.

@joshmoore
Copy link
Member

Discussed today a holding pattern on this PR to work on the issues above.

@imagesc-bot
Copy link

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

https://forum.image.sc/t/how-to-eliminate-verbose-messages-on-the-console/37956/4

Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

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

Two inline suggestions to use DynamicMetadataOptionsrather than DefaultMetadataOptions as the latter class is completely removed in the IDR fork and this is the source of the failure observed in https://idr-ci.openmicroscopy.org/jenkins/job/OMERO-build-build/250/.

More generally, this makes me wonder whether we should deprecate the DefaultMetadataOptions implementation in Bio-Formats 6.6 @dgault

@jburel
Copy link
Member Author

jburel commented Dec 5, 2022

The import tests associated this PR have failed for the past 3 runs

@jburel
Copy link
Member Author

jburel commented Dec 5, 2022

--exclude

@imagesc-bot
Copy link

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

https://forum.image.sc/t/api-for-in-place-omero-imports/108420/13

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.

5 participants