Skip to content

Commit

Permalink
Merge pull request #40 from thawn/show-images-properly
Browse files Browse the repository at this point in the history
use `stackview.insight` to display results in notebooks
  • Loading branch information
haesleinhuepf authored Aug 14, 2024
2 parents ffa3bdd + 44d459b commit 2d5120a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ numpy
napari
dask
autopep8
stackview
-e .
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ install_requires =
napari
dask
autopep8
stackview

[options.packages.find]
where = src
2 changes: 1 addition & 1 deletion src/napari_workflows/_tests/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def refine(image:napari.types.LabelsData) -> napari.types.LabelsData:
# test code generation
code = manager.to_python_code()
print(code)
assert len(code.split("\n")) == 16
assert len(code.split("\n")) == 17

# test event handling
image_layer.data = image
Expand Down
6 changes: 3 additions & 3 deletions src/napari_workflows/_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def _generate_python_code(workflow: Workflow, viewer: "napari.Viewer", notebook:
str
python code
"""
imports = ["from skimage.io import imread"]
imports = ["from skimage.io import imread", "import stackview"]
code = []

import dask
Expand Down Expand Up @@ -589,7 +589,7 @@ def build_output(list_of_items):
if use_napari:
_viewer_add_image_and_notebook_screenshot(code, viewer, notebook, result_name, key)
elif notebook:
code.append(result_name + "\n")
code.append(f"stackview.insight({result_name})\n")

except KeyError:
try:
Expand All @@ -605,7 +605,7 @@ def build_output(list_of_items):
if use_napari:
_viewer_add_image_and_notebook_screenshot(code, viewer, notebook, result_name, key)
elif notebook:
code.append(result_name + "\n")
code.append(f"stackview.insight({result_name})\n")

else:
if notebook:
Expand Down

0 comments on commit 2d5120a

Please sign in to comment.