haesleinhuepf / napari-workflows

BSD 3-Clause "New" or "Revised" License
12 stars 10 forks source link

Use of workflows in functions (discussion) #15

Open pr4deepr opened 2 years ago

pr4deepr commented 2 years ago

Hi guys

@haesleinhuepf , @Cryaaa , @jo-mueller

This is more of a discussion than an issue.

I want to write a function that saves files across channels and timepoints but it should be able to generalise to any image processing workflow. I thought of using napari-workflows and have tried it successfully. However, I wanted your feedback on if this is a good way to proceed or not?

Cheers Pradeep

jo-mueller commented 2 years ago

This reminds me a bit about something that was discussed in the hackathon google docs under 3.7: Routine generator.

I think packing workflows into functions could be a way to achieve what was discussed there, i.e. packing multiple workflow into re-usable routines.

pr4deepr commented 2 years ago

Agree. It can make the functions agnostic to the workflow.

jo-mueller commented 2 years ago

I think, if you annotated your function, you could integrate it into a new workflow as an independent step!

pr4deepr commented 2 years ago

Sorry, what do you by annotation? Type annotations??

pr4deepr commented 2 years ago

How about this function here: https://github.com/pr4deepr/llsz_napari/blob/6a0bc2473d1124cc3d6d9e3732cb8d78d2ca747c/src/llsz/io.py#L111

jo-mueller commented 2 years ago

Sorry, what do you by annotation? Type annotations??

Sorry for the late reply, indeed! While it's not really the focus right now, I think that adding functions with type annotations to workflows should generally work.

I'm not sure how saving and reloading would be affected, though.