def test_complex_workflow(make_napari_viewer): viewer = make_napari_viewer() initial = _init_test() assistant_gui = napari_pyclesperanto_assistant.napari_plugin(viewer) root = Path(napari_pyclesperanto_assistant.__file__).parent filename = str(root / 'data' / 'Lund_000500_resampled-cropped.tif') layer = viewer.open(filename) assistant_gui._activate(StatefulFunctionFactory(magic_denoise)) assistant_gui._activate(StatefulFunctionFactory(magic_background_removal)) assistant_gui._activate(StatefulFunctionFactory(magic_filter)) assistant_gui._activate(StatefulFunctionFactory(magic_binarize)) assistant_gui._activate(StatefulFunctionFactory(magic_label)) assistant_gui._activate(StatefulFunctionFactory(magic_label_processing)) assistant_gui._activate(StatefulFunctionFactory(magic_map)) assistant_gui._activate(StatefulFunctionFactory(magic_combine)) assistant_gui._activate(StatefulFunctionFactory(magic_transform)) assistant_gui._activate(StatefulFunctionFactory(magic_projection)) #assistant_gui._export_jython_code_to_clipboard() assistant_gui._export_notebook(filename="test.ipynb") _finalize_test(initial, viewer)
def main(): import napari from skimage.io import imread import pyclesperanto_prototype as cle from napari_pyclesperanto_assistant._gui._Assistant import Assistant import sys if len(sys.argv) > 1: filename = str(sys.argv[1]) image = imread(filename) else: # make some artificial cell image filename = "undefined.tif" labels = cle.artificial_tissue_2d(width=512, height=512, delta_x=48, delta_y=32, random_sigma_x=6, random_sigma_y=6) membranes = cle.detect_label_edges(labels) eroded = cle.maximum_sphere(membranes, radius_x=3, radius_y=3) blurred = cle.gaussian_blur(eroded, sigma_x=3, sigma_y=3) image = cle.pull_zyx(blurred) #image = imread('https://samples.fiji.sc/blobs.png') #image = imread('C:/structure/data/lund_000500_resampled.tif') #filename = 'data/Lund_000500_resampled-cropped.tif' #filename = str(Path(__file__).parent) + '/data/CalibZAPWfixed_000154_max-16.tif' print("Available GPUs: " + str(cle.available_device_names())) cle.select_device("rtx") print("Used GPU: " + str(cle.get_device())) with napari.gui_qt(): # create a viewer and add some image viewer = napari.Viewer() layer = viewer.add_image(image, metadata={'filename': filename}) from napari_pyclesperanto_assistant import napari_plugin napari_plugin(viewer)
import napari import napari_pyclesperanto_assistant from pathlib import Path <<<<<<< HEAD root = Path(napari_pyclesperanto_assistant.__file__).parent img_path = str(root / 'data' / 'Lund_000500_resampled-cropped.tif') ======= root = Path(napari_pyclesperanto_assistant.__file__).parent filename = str(root / 'data' / 'Lund_000500_resampled-cropped.tif') # filename = str(root / 'data' / 'CalibZAPWfixed_000154_max-16.tif') >>>>>>> 1b6b7d026ee5cd1714ce3e62d8722aff7bff89ba # create Qt GUI context with napari.gui_qt(): # start napari viewer = napari.Viewer() <<<<<<< HEAD viewer.open(img_path) ======= layer = viewer.open(filename) layer[0].metadata['filename'] = filename >>>>>>> 1b6b7d026ee5cd1714ce3e62d8722aff7bff89ba # attach the assistant assistant_gui = napari_pyclesperanto_assistant.napari_plugin(viewer)