InsightSoftwareConsortium / InsightSoftwareConsortium/itkwidgets

Feature Request: Programmatic Screenshot Export

Open
#658 2 comments 0 reactions 1 assignee Claimed by @bnmajor View on GitHub
Dominant language
Python
Stars
624
Forks
83
PR merge metrics
No merged PRs in 30d

Description

## 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](https://github.com/InsightSoftwareConsortium/GetYourBrainTogether/tree/main/HCK02_2023_Allen_Institute_Hybrid) 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:

```py
itkwidgets.view(spatial_image, filepath='path/to/screenshot.png')
```

2. Run the notebook non-interactively:

```bash
> jupyter nbconvert "notebook.ipynb"
```

3. View a screenshot of the ITKWidgets view at "path/to/screenshot.png"

## Related Issues

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

cc @bnmajor

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.