mastodon-sc / mastodon

Mastodon – a large-scale tracking and track-editing framework for large, multi-view images.
BSD 2-Clause "Simplified" License
66 stars 20 forks source link

Add svg and png export to trackscheme panels #306

Open stefanhahmann opened 1 month ago

stefanhahmann commented 1 month ago

I recently added the functionality to export the content of the lineage classification dendrogram to SVG/PNG files, cf.: https://github.com/mastodon-sc/mastodon-deep-lineage/releases/tag/mastodon-deep-lineage-0.2.0

After this was released, I was asked by a user, if this could be added as a functionality to the track scheme windows as well.

This PR adds exactly this functionality to all TrackScheme Panels and the BDV Panel. It also adds a generic ExportUtils class that can be re-used in all plugin projects to achieve similar behavior in different components.

tinevez commented 1 month ago

This is great! And it looks much simpler that the batik export in TrackMate's TrackScheme.

If possible I would like to keep the right-click button for interactions with the data on the panel, as in the other views. Could you put the command in the JMenu?

stefanhahmann commented 1 month ago

This is great! And it looks much simpler that the batik export in TrackMate's TrackScheme.

Please do not overestimate the capabilities of this. This function only paints the contents of the current view to the SVG/PNG file, i.e. it will not be complete, if the trackscheme as seen on the screen is not completely inside the window.

Thus, it would be more honest, if the entry would say "Export current TrackScheme view to SVG/PNG".

Would you still like to have it?

It may nevertheless be useful for some use cases.

If possible I would like to keep the right-click button for interactions with the data on the panel, as in the other views. Could you put the command in the JMenu?

I was also thinking about this. I decided for the right click, since this would offer the highest re-usability with the lineage classification dialog, where I also have it on the right click. However, putting it in the menu should not be too much effort. Would you see it in the File, Windowor View menu?

tinevez commented 1 month ago

Please do not overestimate the capabilities of this. This function only paints the contents of the current view to the SVG/PNG file, i.e. it will not be complete, if the trackscheme as seen on the screen is not completely inside the window.> Thus, it would be more honest, if the entry would say "Export current TrackScheme view to SVG/PNG". Would you still like to have it?

Yes. What about Export current view to SVG/PNG ?

I was also thinking about this. I decided for the right click, since this would offer the highest re-usability with the lineage classification dialog, where I also have it on the right click. However, putting it in the menu should not be too much effort. Would you see it in the File, Windowor View menu?

I would say File, after a separator.

stefanhahmann commented 1 month ago

Yes. What about Export current view to SVG/PNG ?

Agreed.

I would say File, after a separator.

It's now in the File menu of the TrackSchemePanels and the BDV View.

tinevez commented 1 month ago

Maybe there is a way to add it to all views automatically. Can I have a go at it?

stefanhahmann commented 1 month ago

Maybe there is a way to add it to all views automatically. Can I have a go at it?

Yes, sure.

I was not sure, if it makes sense to have it in all views (e.g. table view?) and if it works well in all views (e.g. grapher -> svg might be problematic). Otherwise, I would have tried as well.

tinevez commented 5 days ago

I made some minor changes to the PR:

stefanhahmann commented 3 days ago

I made some minor changes to the PR:

* the constraint on the component that is painted is relaxed, so that we don't export the scroll bars.

* the actions are added to the grapher views. It really looks good!
  And you are right: it does not make sense to add this to more views.
  Are you ok as it is? Can I merge?

I am currently out of office until mid July. If you can wait until then, I would be happy to give it a closer look, test and give feedback if necessary. If it is more urgent for you, I would also be fine, if you merge it.