Last active
December 3, 2020 21:28
-
-
Save ntjess/763f301b28e7e700e0af585b84ab8d5a to your computer and use it in GitHub Desktop.
Image Exporter plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from s3a.parameditors import ParamEditorPlugin, ParamEditor, FR_SINGLETON | |
from skimage import io | |
class InfoExporterPlugin(ParamEditorPlugin): | |
name = 'Info Exporter' | |
@classmethod | |
def __initEditorParams__(cls): | |
super().__initEditorParams__() | |
cls.toolsEditor = ParamEditor.buildClsToolsEditor(cls, 'Tools') | |
cls.dock.addEditors([cls.toolsEditor]) | |
def __init__(self): | |
super().__init__() | |
self.toolsEditor.registerFunc(self.exportStageImages) | |
def exportStageImages(self, outFolder='.'): | |
""" | |
:param outFolder: | |
pType: filepicker | |
asFolder: True | |
""" | |
outFolder = Path(outFolder) | |
outFolder.mkdir(exist_ok=True) | |
plugin = self.s3a.focusedImg.currentPlugin | |
for info in plugin.curProcessor.processor.getStageInfos(): | |
img = info['image'] | |
io.imsave(outFolder/f'{info["name"]}.jpg', img) | |
s3a.addPlugin(InfoExporterPlugin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment