bilayer-containers / bilayers

https://bilayers.org
3 stars 1 forks source link

V0.1 enhance cellpose #19

Closed rajavishah closed 4 months ago

rajavishah commented 4 months ago

This PR helps us to run all the parameters for cellpose(v2) 2D in docker and locally too:

Steps to run:-

The changes done from last PR(https://github.com/bilayer-containers/bilayers/pull/18):

  1. We have now moved logic from dealing with cli_tags in inputs and cli_args in exec_function to only mentioning cli_tags in config.yaml file. To deal with the arguments which by default we want to pass and not expose that to user at Gradio Interface level, we can now put those in exec_function.hidden_args`.
  2. Instead of volume mount, the file now will take Files as inputs via gradio.Files and putting file_count as directory.
  3. Output display thing is resolved.

I feel, the following aspects require refactoring or improved edge case handling:

  1. @gnodar01 As of now, I am taking all the input images and making a temporary directory, storing all the files in it and then passing the name of it to --dir argument. I tried using os.pathname.dirname(value[0]) but it was weirdly taking the first file instead of taking all the files. Is there a better way to do it? Current Logic link here
  2. I feel if the user chooses pre-trained-model then he shouldn't be able to upload --add_model, right?
  3. Still, this is hardcoded FROM cellprofiler/runcellpose_no_pretrained:0.1 in dockerfile. I was wondering, how should I make it pass from CI/CD. My first instinct goes for using environment variables and storing the name of pulled docker and passing it.
  4. A rigorous testing!

The problem:

  1. --savedir : If user passes the directory folder, which would be his local path, how the docker would identify the path and help save the output to that path?
  2. --z_axis : I wasn't sure about the input type and after pushing the code got some links from Shata, to check-out.
rajavishah commented 4 months ago

The PR is updated with the following changes:

  1. dockerfile takes in the BASE_IMAGE value dynamically via noxfile
  2. noxfile in the build_algorithm session writes the docker_image_name to a txt file and following session, reads the txt file to fetch the name.
  3. --z_axis parameter is added
  4. --save_dir isn't passed since, we are receiving outputs on gradio's side. Users can directly download outputs from there.