-
Notifications
You must be signed in to change notification settings - Fork 39
Add copy&paste of BDV state as JSON strings #205
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
base: master
Are you sure you want to change the base?
Conversation
This pull request has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/fiji-friends-weekly-dev-update-thread/103718/80 |
Hi @tpietzsch, sorry, I get two errors when using this pull request in bigstitcher, and it does not seem to work (I assumed copy&paste is somehow obvious, I couldn't find really any hints of it in the GUI) 1) it's of course not there, not sure if it has any consequences:
2) this one goes into an infinite loop (when pressing Apple+c):
|
@StephanPreibisch The first exception is expected and not a problem. The second one, I have not seen, but @bogovicj has the same.
If you don't have it, could you try to |
Hi @tpietzsch, I also tried and I am getting some other error:
I checked and it is here:
within For the SAC where it crashed it shows: ![]() Maybe you could change the code such that it does not try to get the color if it does not support colors? Note that this SAC is one that MoBIE builds for a label image, where I don't use the normal |
Typed<T> instances of any T with a @JsonIo-annotated adapter are serialized as json objects with a "type" attribute with the value of the JsonIo.type() annotation, and an "obj" attribute, which is serialized using the annotated adapter. For deserialization, the correct adapter is looked up via the "type" attribute.
Does this support N5 viewer ? I tested with this data:
|
Not yet. Here is an explanation that I send to @bogovicj a while ago on zulip. I thought I also put that somewhere public, but I couldn't find it anymore...: (...) how the specification of sources in the JSON works, and how that could be integrated into n5-viewer. Here is the part of the JSON that describes the first BDV Source:
De-serialized, this corresponds to nested bigdataviewer-core/src/main/java/bdv/tools/links/resource/TransformedSourceResource.java Lines 27 to 78 in 533a6b1
That wraps a SpimDataSetupSourceResource.Spec , and that wraps a SpimDataMinimalFileResource.Spec .
to create the described resource. They can ask the ResourceManager to provide resources corresponding to nested specs.(The create method should also register the created resource with the ResourceManager ).
To make the Links mechanism aware of how to serialize bigdataviewer-core/src/main/java/bdv/tools/links/resource/TransformedSourceResource.java Lines 117 to 141 in 533a6b1
On top of that, there is also |
What is still missing from that explanation is some concrete advice of how to modify n5-viewer so that the resources are picked up: Probably you will need a type of resource for referencing a N5Reader (just containing URI probably): bigdataviewer-core/src/main/java/bdv/tools/links/resource/SpimDataMinimalFileResource.java Line 24 in f93c3f6
And you will need something to tie bigdataviewer-core/src/main/java/bdv/tools/links/resource/SpimDataSetupSourceResource.java Line 25 in f93c3f6
Then when you open something in n5-viewer (for example, here: https://github.com/saalfeldlab/n5-viewer/blob/0a2aace2654aa05a972f1ba3c389744472184348/src/main/java/org/janelia/saalfeldlab/n5/bdv/N5Viewer.java#L307-L366) you need to register it with the bigdataviewer-core/src/main/java/bdv/BigDataViewer.java Lines 641 to 642 in 12da664
and bigdataviewer-core/src/main/java/bdv/BigDataViewer.java Lines 359 to 367 in 12da664
for example. |
The JSON "link" includes viewer transform, color and intensity, visibility, and display mode settings.
Additionally, the link also includes ResourceSpecs for re-creating Sources (or matching existing sources) if they are registered with the new
ResourceManager
. (This is already implemented forSpimData
sources in this PR).When copying and pasting links, it is not clear what the user wants:
The approach to this is to copy as much information as possible, and allow the user to configure what to use when pasting.

This can be configured in the Preferences dialog and is saved to a settings YAML file:
In case the user often wants to change the pasting behaviour, this configuration page can also be added to the side panel.

Default shortcuts for copying and pasting are command/ctrl-C and command/ctrl-V, obviously...
