diff --git a/napari_pyclesperanto_assistant/_gui/_category_widget.py b/napari_pyclesperanto_assistant/_gui/_category_widget.py index f1f99e1..0e317d3 100644 --- a/napari_pyclesperanto_assistant/_gui/_category_widget.py +++ b/napari_pyclesperanto_assistant/_gui/_category_widget.py @@ -52,10 +52,10 @@ def call_op(op_name: str, inputs: Sequence[Layer], timepoint : int = None, *args # transfer data to gpu if timepoint is None: i0 = inputs[0].data - gpu_ins = [cle.push(i.data if i is not None else i0) for i in inputs] + gpu_ins = [i.data if i is not None else i0 for i in inputs] else: i0 = inputs[0].data[timepoint] if len(inputs[0].data.shape) == 4 else inputs[0].data - gpu_ins = [cle.push((i.data[timepoint] if len(i.data.shape) == 4 else i.data) if i is not None else i0) for i in inputs] + gpu_ins = [(i.data[timepoint] if len(i.data.shape) == 4 else i.data if i is not None else i0) for i in inputs] # convert 3d-1-slice-data into 2d data # to support 2d timelapse data @@ -72,7 +72,7 @@ def call_op(op_name: str, inputs: Sequence[Layer], timepoint : int = None, *args gpu_out = cle_function(*args) # return output - return gpu_out + return gpu_out, args def _show_result( @@ -222,7 +222,7 @@ def update(event): # todo: deal with 5D and nD data op_name = kwargs.pop("op_name") - result = call_op(op_name, inputs, t_position, *kwargs.values()) + result, used_args = call_op(op_name, inputs, t_position, *kwargs.values()) # add a help-button description = cle.operation(op_name).__doc__.replace("\n ", "\n") + "\n\nRight-click to learn more..." @@ -255,6 +255,15 @@ def update(event): scale=inputs[0].scale, ) + # notify workflow manage that something was created / updated + try: + from napari_time_slicer import WorkflowManager + manager = WorkflowManager.install(viewer) + manager.update(result_layer, cle.operation(op_name), *used_args) + print("notified", result_layer.name, cle.operation(op_name)) + except ImportError: + pass # recording workflows in the WorkflowManager is a nice-to-have at the moment. + def _on_layer_removed(event): layer = event.value if layer in inputs or layer is result_layer: