InsightSoftwareConsortium / itkwidgets

An elegant Python interface for visualization on the web platform to interactively generate insights into multidimensional images, point sets, and geometry.
https://itkwidgets.readthedocs.io/
Apache License 2.0
576 stars 83 forks source link

Feature Request: Programmatic Screenshot Export #658

Open tbirdso opened 1 year ago

tbirdso commented 1 year ago

Summary

It would be nice to be able to programmatically write out screenshots from itkwidgets views.

Motivation

As part of the Get Your Brain Together Hackathon we are working with reproducible pipelines in Jupyter Notebooks on the CodeOcean platform. ITKWidgets is useful for visualizing intermediate results in interactive notebook sessions. However, it doesn't seem like there is currently a path to get spatial insight into data when the notebook is run non-interactively from start to finish. It would be helpful if we could get a screenshot to visibly understand spatial data from a non-interactive session.

Feature Request

Would be neat to be able to get a screenshot of spatial data rendered in ITKWidgets output as a result from a non-interactive notebook run. For instance:

  1. Create a Jupyter Notebook dealing with spatial image data and include an ITKWidgets view that will write out a screenshot, for instance:
itkwidgets.view(spatial_image, filepath='path/to/screenshot.png')
  1. Run the notebook non-interactively:
> jupyter nbconvert "notebook.ipynb"
  1. View a screenshot of the ITKWidgets view at "path/to/screenshot.png"

Related Issues

https://github.com/InsightSoftwareConsortium/itkwidgets/issues/466

cc @bnmajor

thewtex commented 1 year ago

Related to #587

MissingJoe commented 11 months ago

The problems for programmatic screenshot export seems can't be solved from #587