Skip to content

Add ImageToDisc pipeline step for saving processed images to file#370

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-background-correction-storage
Draft

Add ImageToDisc pipeline step for saving processed images to file#370
Copilot wants to merge 5 commits intomainfrom
copilot/add-background-correction-storage

Conversation

Copy link

Copilot AI commented Mar 13, 2026

Adds a pipeline-compatible class to export intermediate images (raw, background, corrected, segmented) to disk for visualization and manual review.

pyopia.io.ImageToDisc

  • Configurable image_keys selecting which pipeline data to save (default: imraw, imbg, im_corrected, imbw)
  • scale_factor for downscaling before save
  • collage mode: combine all stages into a single image, or save separately
  • image_format selection (default: png)
  • Gracefully skips missing keys

Usage

[steps.saveimages]
pipeline_class = 'pyopia.io.ImageToDisc'
output_folder = 'processed_images'
image_keys = ['imraw', 'im_corrected', 'imbw']
scale_factor = 0.5
collage = true

Tests

7 new tests covering separate/collage modes, scaling, grayscale, binary masks, and missing keys.

Original prompt

This section details on the original issue you should resolve

<issue_title>Means to store the background corrected images to file</issue_title>
<issue_description>featrue to direct background corrected images from an image stack to a "bckg-processed-folder".
These images are good for client visualisation and for manual review-
</issue_description>

<agent_instructions>Provide a command line function to store to file the various processed images in the pipeline to a file (from the raw image, background image, up til segmented image). Optional command inputs to scale down the size when storing to file, and whether to store one collage of image (per input image), or separate for each pipeline step. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits March 13, 2026 17:17
Adds a new pipeline-compatible class ImageToDisc to pyopia.io that saves
processed pipeline images (raw, background, corrected, segmented, etc.)
to an output folder. Supports configurable image keys, scale factor for
downsizing, collage mode (all images in one file vs separate files),
and image format selection.

Co-authored-by: nepstad <152277+nepstad@users.noreply.github.com>
- Keep original image dtypes until conversion is needed (avoid premature
  float64 conversion)
- Move matplotlib/skimage imports from __call__ to the specific methods
  that need them
- Move test-level matplotlib import to module level

Co-authored-by: nepstad <152277+nepstad@users.noreply.github.com>
Co-authored-by: nepstad <152277+nepstad@users.noreply.github.com>
Copilot AI changed the title [WIP] Add means to store background corrected images to file Add ImageToDisc pipeline step for saving processed images to file Mar 13, 2026
Copilot AI requested a review from nepstad March 13, 2026 17:22
@nepstad
Copy link
Collaborator

nepstad commented Mar 13, 2026

@copilot Update documentation with an instructive example of how and when to use this functionality

Adds documentation in two locations:
- toml_config.ipynb: Comprehensive section with configuration options table,
  examples for separate images and collage mode, and pipeline placement guidance
- processing_raw_data.ipynb: Practical section explaining when and how to use
  ImageToDisc for quality control and visual inspection

Co-authored-by: nepstad <152277+nepstad@users.noreply.github.com>
Copy link
Author

Copilot AI commented Mar 13, 2026

@copilot Update documentation with an instructive example of how and when to use this functionality

Added documentation in commit 77618d4:

  • docs/notebooks/toml_config.ipynb: New "Saving processed images to disc" section with a configuration options table, examples for both separate-image and collage modes, and guidance on where to place the step in the pipeline.
  • docs/notebooks/processing_raw_data.ipynb: New "(Optional) Save intermediate images to disc" section in the processing guide, explaining when and how to use ImageToDisc for quality control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Means to store the background corrected images to file

2 participants