Skip to content

avoid useless loadings of ImageServers#1957

Closed
carlocastoldi wants to merge 1 commit intoqupath:mainfrom
carlocastoldi:main
Closed

avoid useless loadings of ImageServers#1957
carlocastoldi wants to merge 1 commit intoqupath:mainfrom
carlocastoldi:main

Conversation

@carlocastoldi
Copy link
Contributor

QuPath 0.6.0 always loaded some ImageServer just to then close them right after.
This occurred when closing the object classifier's window and when executing a CLI script.

Actually, I expect these precautionary getServer()close() to have slipped through in other parts. These two cases jumped to me because CLI scripting and object classifiers are tools that I regularly use.

Related to #1489 and #1579

It always occured when closing the object classifier's window and when executing a CLI script
petebankhead added a commit to petebankhead/qupath that referenced this pull request Jul 30, 2025
Based on qupath#1957 - attempts to fix more instances, and use `ImageData.close()`.
@petebankhead
Copy link
Member

Thanks @carlocastoldi could you please review #1959 and see if it fixes the issue for you? I rarely use these tools & don't have a quick way to test them.

I think the other PR handles more cases, and relying on ImageData implementing AutoCloseable makes it possible to simplify things slightly (and closing the ImageData should already do much the same thing).

If the other PR looks good to you, I'd merge it and close this one.

@carlocastoldi
Copy link
Contributor Author

Hi @petebankhead, thanks for taking the time to improve the proposed change.
I have tested your PR and it seem to work as intended. Surely treating ImageData instances as closeable sets the example on how to deal with servers.
In order to test the script i used this command on a project with ~50 .czi large images over the network:

/home/castoldi/Projects/qupath/gradlew run -p /home/castoldi/Projects/qupath --args="script -p \"$(pwd)/project-linux.qpproj\" -c  \"println getCurrentImageName()\""

I expect the script to run through all images smoothly & fast. If run on IntelliJ, I also put a breakpoint to ImageData.getServer().

I think we can merge #1959 and close this!

P.S. will QuPath 0.6 have point releases or has the development shifted to a pace that is more incremental?

@petebankhead
Copy link
Member

Thanks @carlocastoldi !

No plans for a v0.6.1 release at this time, hoping instead to make v0.7.0 much sooner. But this may change if there are enough bug fixes to justify a new release before v0.7.0 is ready.

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.

2 participants