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

Fix bug on download images based on omero-insight#264 #78

Merged
merged 11 commits into from
Jul 19, 2023

Conversation

Rdornier
Copy link
Contributor

@Rdornier Rdornier commented Jul 7, 2023

Hello,

Based on the issue #77, I open the PR to fix the bug on downloading images from the API. I only adapt the modifications added from here ome/omero-insight#264 to make thing working on that project.

I'll probably need this fix pretty soon; that's why I opened the PR.

Rémy.

@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/download-vsi-files-from-omero-fails/83314/3

@Rdornier
Copy link
Contributor Author

Rdornier commented Jul 7, 2023

I'm also wondering how this fix will be integrated when released in Fiji ecosystem
For now, when I activate the OMERO 5.5-5.6 update on Fiji, it is the version 5.6.9 that comes, not the latest one (5.8.0)

@dominikl
Copy link
Member

dominikl commented Jul 10, 2023

Thanks Rémy! You might have to sign an “OMERO Contributor License Agreement”, so that we can include your code, I'll try to find the pdf for that. Edit: Here's the pdf OME Contributor License Agreement

@dominikl
Copy link
Member

Could you remove all the gradle files from the PR, as far as I can see only the TransferFacilityHelper.java is needed?

@@ -90,7 +92,7 @@ public class TransferFacilityHelper {
List<File> downloadImage(SecurityContext context, String targetPath,
long imageId) throws DSAccessException, DSOutOfServiceException {
List<File> files = new ArrayList<File>();

System.out.println("Test new fonction");
Copy link
Member

Choose a reason for hiding this comment

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

Remove that line.

Suggested change
System.out.println("Test new fonction");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, done !

@@ -125,84 +127,82 @@ List<File> downloadImage(SecurityContext context, String targetPath,
throw new DSAccessException("Cannot retrieve original file", e);
}

Map<Boolean, Object> result = new HashMap<Boolean, Object>();
Copy link
Member

Choose a reason for hiding this comment

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

Do you need that Map? In the end only the downloaded list is returned. This map and the notDownloaded list isn't actuall used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I initially thought returning downloaded and notDownloaded (i.e. the result Map) but this would change the method definition (returns now a Map and not a list anymore) and may not be compatible with previous versions.

The reason I kept them is beacuse I'm wondering if there is any possibility to return also the information contained in notDownloaded. Do you think it is possible ?

Copy link
Member

Choose a reason for hiding this comment

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

I see. An option would be to add a second method for now which returns the map and mark the old one as deprecated. That would only be needed in the main TransferFacility class, not really in the helper. Looking at the code, I actually can't see a reason any more why I split the code into a helper class in the first place, could as well go into the TransferFacility class itself. Your thoughts @jburel ? (Btw, this part of the Java gateway is not used by Insight, but should be!)

Copy link
Member

Choose a reason for hiding this comment

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

But that could be done in a follow up PR anyway. Lets get this one in first :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An option would be to add a second method for now which returns the map

Yes, exactly. It would then be possible to know which files had not been downloaded.

But that could be done in a follow up PR anyway. Lets get this one in first :-)

Also true

values.add(fs.getOriginalFile());
for (Object tmp : filesets) {
Fileset fs = (Fileset) tmp;
// File filesetDir = new File(targetPath+File.separator+"Fileset_"+fs.getId().getValue());
Copy link
Member

@dominikl dominikl Jul 10, 2023

Choose a reason for hiding this comment

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

I'd remove all the commented out lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@dominikl
Copy link
Member

Sorry, I missed your question about Fiji update integration. I think the Fiji update site is out of date for quite a while wrt the Insight plugin. Once release, you'd have to get it from https://www.openmicroscopy.org/omero/downloads/ and copy it the Fiji folder manually.

@Rdornier
Copy link
Contributor Author

Ok for Fiji integration.
I sent you a PM via image.sc forum with the signed agreement

Copy link
Member

@dominikl dominikl left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@jburel jburel merged commit 8ac9f03 into ome:master Jul 19, 2023
@Rdornier Rdornier deleted the download-bug branch August 30, 2023 09:37
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