-
Notifications
You must be signed in to change notification settings - Fork 25
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
Edits to ColorTables of ImagePlus created from a Dataset never make it back to that Dataset #311
Comments
The reason is that trying to keep ImagePlus and ImageDisplay objects in sync completely is a wild goose chase. Some data structures like the color tables are not wrapped but rather copied, and knowing under which circumstances exactly to trigger automatic sync is fraught: if you do it too often there is a potentially severe performance hit, and if you do it not often enough then things get out of sync. So in recent years we have not tried to improve this. My preference would be to actually back off the syncing approach altogether in favor of code wanting to utilize both kinds of data structures doing it themselves. |
Looking a bit at the API, I'm not sure I understand why they couldn't be wrapped - is there a reason that you know?
Well, then at the very least we need to expose the logic that is used to perform the conversion, namely On a broader scale though, I'm not sure what you mean by "code wanting to utilize both data structures". This repository, pyimagej/napari-imagej, and the example script listed above are all versions of such. If you really think the synchronization code does not belong here, maybe |
@gselzer I definitely think all conversion code between ImageJ and ImageJ2 data structures belongs here in imagej-legacy, not in Python code. And code between ImageJ and ImgLib2 data structures belongs in imglib2-ij, which imagej-legacy builds upon. What I'm saying we should be moving away from is the
I'm fine with improving the sync logic to take LUTs into account as well. Just be aware that the logic is fundamentally flawed as written. The |
Sounds great!
This is also true, however it's a broader issue that, as you suggest, will be a large endeavor - we may want to think about it eventually, but it isn't a problem to be solved here.
👍 |
@ctrueden provided me with a script that can be run in Fiji-future with a SNAPSHOT
scijava/scripting-python
jar, which does the following:Dataset
.ImagePlus
using PyImageJ (which uses theDatasetToImagePlusConverter
).ImagePlus
, such that one channel isMagenta
.ImagePlus
.From there, I want to interact with the active
ImageDisplay
, so I callLegacyImageDisplayService.getActiveImageDisplay
. This taps into theLegacyImageMap
, finds the associatedImageDisplay
within its internal map, and returns it after synchronizing the associated attachments (i.e. ROIs and Tables, but not LUT)s. Therefore, the returned dataset does not have the editedMagenta
that I see in the active image display.LegacyImageMap
makes aHarmonizer
object on events - is there a reason why it cannot have one of these all the time, such thatsyncrhonizeAttachmentsToDataset
could utilize it?The text was updated successfully, but these errors were encountered: