MVRegFus icon indicating copy to clipboard operation
MVRegFus copied to clipboard

Added jupyter notebook to make parameter specification and running of the fusion easier

Open max-brambach opened this issue 4 years ago • 2 comments

Changed mvregfus_run.py such that now fusion parameters and paths are specified in a separate jupyter notebook, where they are exported as config file (.json). mvregfus_run.py now only contains functions that run the fusion using this config file.

Added run_fusion.ipynb which contains a description of the fusion parameters, together with some functionality to generate a config file and to run the fusion. Added some convenience functionality:

  • Parameter filepaths now also takes a string. If so, glob.glob(string + '/*.czi') is used to find files in the specified folder (string).
  • Added parameter generate_file_order. If True, a file_order.txt file is generated in the out_dir. It contains the contents of the filepaths variable. This is useful, since MVRegfus currently renames the output files to mv_000_.... from which it is not possible to reconstruct which file was processed.
  • Parameter registration_pairs can be set to None.
  • If registration_pairs == None, the new parameters n_volumes and n_views are used to generate the registration pairs.

max-brambach avatar Nov 17 '20 16:11 max-brambach

Ciao Marvin, I've recently made a little jupyter notebook to run my fusions a bit more conveniently via remote. Thought, I should share that with you:) Basically, I've rewritten the mvregfus_run.py file to only contain functions that relate to running the fusion. The parameter handling I've outsourced to the notebook run_fusion.ipynb, that is used to: 1. Specify the parameters, 2. Create a config file, 3. Start the fusion. The neat thing (at least in my opinion:) ) is that one can use this notebook to start multiple fusions without the need to create copies of the mvregfus_run.py file. Since the config file is saved together with the output files, the parameters stay reproducible.

max-brambach avatar Nov 17 '20 16:11 max-brambach

That's super cool! Thanks a lot for sharing.

You're completely right that it makes sense to separate execution and configuration. And it's been on my todo list forever 😂.

Exactly as you propose, I think it makes sense to define a parameter dictionary which can then be saved as a json config file that can be (re-)used in future runs. And I like the idea of having a jupyter notebook that guides the setting of the parameters, that's really nice!

Regarding the implementation, probably the run_fusion function should live in a new module such as mvregfus/execution.py and it would make sense that all currently available parameters can be set in the config dict and have associated default parameters (otherwise execution and configuration would still not be properly isolated from each other).

m-albert avatar Nov 18 '20 10:11 m-albert