saeyslab / napari-sparrow

https://sparrow-pipeline.readthedocs.io/en/latest/
Other
22 stars 0 forks source link

Output Hydra config from napari #83

Closed berombau closed 1 month ago

berombau commented 2 years ago

It would be nice for user in napari to tweak parameters in the napari widgets and in the end have a button to export the tweaks to a Hydra config, to enable running the whole sample or multiple samples with the parameters.

Example output default.yaml, to be placed in the local folder /configs/experiment/:

# @package _global_

# These options inherit from other configs and should be always on top
defaults:
  - override /segmentation: cellpose

# TODO: These options are better suited in an extra config at `configs/local/default.yaml` 
paths:
  data_dir: FILL_IN_YOUR_DATA_FOLDER_PATH
device: "cpu"

# TODO: These options are better suited in an extra config at `configs/dataset/type_name.yaml` 
dataset:
  data_dir: ${paths.data_dir}/resolve_liver
  dtype: tiff
  image: ${dataset.data_dir}/20272_slide1_A1-1_DAPI.tiff
  coords: ${dataset.data_dir}/20272_slide1_A1-1_results.txt
  markers: ${dataset.data_dir}/markerGeneListMartinNoLow.csv

# The combination of these options should be unique to this experiment
segmentation:
  min_size: 100

Check if config is correct:

spongepy --cfg job

Experiment config will automatically be picked up. If the user is more advanced, they can restructure the config in dataset, local and multiple experiment configs.

ArneDefauw commented 1 year ago

Fixed on main by https://github.com/saeyslab/napari-sparrow/commit/a96d7550fbcaf831da70bea17e867d51054aedc0 .

For now, configuration files with all config options are written to output_dir of the plugin. These .yamls can then be used for running jobs on CLI.

Should decide if we also want to implement the following features: -find differences (omegaconf does not seem to support this, try something like deepdiff) -write out differences in yaml as dataset config