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

Disable ImageJ2 syncing by default #82

Merged
merged 8 commits into from
Aug 16, 2014
Merged

Disable ImageJ2 syncing by default #82

merged 8 commits into from
Aug 16, 2014

Conversation

ctrueden
Copy link
Member

This branch adds a toggle for this syncing, which is now disabled by default, to avoid performance problems for regular users of ImageJ 1.x functionality, while still allowing interested people to turn on the syncing to try out new ImageJ2 features as they mature.

The syncing of ImageJ1 data structures to ImageJ2 causes a substantial performance penalty, due to limitations and bugs in the ImageJ2 data structure classes. In particular, as soon as an IJ2 ImageDisplay is created, it attempts to render a ScreenImage at full resolution even though the display is never shown onscreen. While we certainly can (and need to) fix that issue, in the meantime, let's disable ImageJ2 syncing.

This branch fixes Fiji bug 899.

Otherwise, Swing renders the tooltip all on one long line.
This option is off by default, to avoid disrupting IJ1-based workflows.
When the option is enabled, newly created ImagePlus objects will be
synced to ImageJ2 ImageDisplays. Ideally, this would be a lazy/cheap
operation, but at the moment it is too expensive.

Fixes Fiji bug 899:
http://fiji.sc/bugzilla/show_bug.cgi?id=899

Or at least: it avoids the problem for users by default, which is good
enough for now.
When ImagePlus#close is called, it calls LegacyHooks#unregisterImage,
which in turn calls LegacyImageMap#unregisterLegacyImage, which calls
LegacyImageMap#removeMapping, which calls LegacyUtils#deleteImagePlus,
which was calling close again, resulting in a stack overflow.

It may cause other problems not to call close anymore from
LegacyUtils#deleteImagePlus, but at least they won't be as bad as a
stack overflow.
@ctrueden
Copy link
Member Author

@dscho, @hinerm: I think it is paramount that we disable the IJ1 ↔️ IJ2 syncing, particularly in the IJ1 ➡️ IJ2 direction, for the time being. It turns out that there is a serious performance problem, described in Fiji bug 899: when an ImageDisplay is first created it immediately creates a rendered image (i.e., ScreenImage) at full resolution, even though the ImageDisplay is not shown on screen. We really need full lazy initialization, and/or the Dataset/View/Display class hierarchy redesign, before we can turn on background syncing by default.

Unfortunately, use cases like #81 (already buggy) become even less tenable while the syncing is disabled. But the IJ2 API needs another design iteration before it will be usable anyway.

Anyway, let me know if you see any problems with the patch set; I only tested it lightly. Commit 2729b90 in particular worries me a little.

@dscho
Copy link
Contributor

dscho commented Aug 16, 2014

I agree that this is a good change. We need to focus more on our immediate projects and refrain from trying to support everybody else's projects better. That means synchronization in particular because we do not need it. It would have been nice, but there are bigger fish we need to fry, like, right now.

Also, I am not too worried about 2729b90: it is relevant only in the context of a full synchronization between IJ1 and IJ2 data structures, which we agreed recently is no longer what we aim for.

dscho added a commit that referenced this pull request Aug 16, 2014
Disable ImageJ2 syncing by default
@dscho dscho merged commit f8ecd34 into master Aug 16, 2014
@dscho dscho deleted the ij2-sync branch August 16, 2014 09:22
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.

None yet

2 participants