-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added jupyter notebook to make parameter specification and running of the fusion easier #4
base: master
Are you sure you want to change the base?
Conversation
…re 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.
Ciao Marvin, |
mvregfus_run.py
such that now fusion parameters and paths a…
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 Regarding the implementation, probably the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some comments to the files you shared (also as a reminder to myself!).
if generate_file_order: | ||
with open(out_dir + '/file_order.txt', 'w') as f: | ||
for item in filepaths: | ||
f.write("%s\n" % item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely the output filenames should reference the input files.. The easiest way will be to simply change this in mv_graph.py
, which I'll do.
# ----- other parameters ---- | ||
# options for DCT image quality metric for fusion | ||
# setting None automatically calculates good values | ||
# size of the cubic volume blocks on which to calc quality | ||
dct_size = None | ||
# size of maximum filter kernel | ||
dct_max_kernel = None | ||
# size of gaussian kernel | ||
dct_gaussian_kernel = None | ||
|
||
# weight normalisation parameters | ||
# normalise such that approx. <dct_cumulative_weight_best_views> weight is | ||
# contained in the <dct_how_many_best_views> best views | ||
dct_how_many_best_views = 2 | ||
dct_cumulative_weight_best_views = 0.9 | ||
|
||
# options for weighted Lucy Richardson multi-view deconvolution | ||
# maximum number of iterations | ||
LR_niter = 25 # iters | ||
# convergence criterion | ||
LR_tol = 5e-5 # tol | ||
# gaussian PSF sigmas | ||
LR_sigma_z = 4 # sigma z | ||
LR_sigma_xy = 0.5 # sigma xy | ||
|
||
|
||
# how to calculate final fusion volume | ||
# 'sample': takes best quality z plane of every view to define the volume | ||
# 'union': takes the union of all view volumes | ||
final_volume_mode = 'union' | ||
# whether to perform an affine chromatic correction | ||
# and which channel to use as reference | ||
perform_chromatic_correction = False | ||
ref_channel_chrom = 0 | ||
|
||
|
||
# ----- derivatives of the set parameters ----- | ||
channelss = [channels]*len(filepaths) | ||
reg_channels = [reg_channel] *len(filepaths) | ||
ref_views = [ref_view] *len(filepaths) | ||
registration_pairss = [registration_pairs] *len(filepaths) | ||
view_dict = {i:{'view':i, 'ill':2} for i in list(range(16))} | ||
# where elastix can be found (top folder) ## urrently not used | ||
elastix_dir = '/data/shared/elastix' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these would probably need default values in the function definition (or default values in a json
file for default values).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've only selected the ones I'm using normally, but of course it makes sense to have the other parameters available as well.
n_volumes = parameters['n_volumes'] | ||
n_views = parameters['n_views'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can probably be automatically determined in mv_graph.build_multiview_graph
.
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:
filepaths
now also takes a string. If so, glob.glob(string + '/*.czi') is used to find files in the specified folder (string).file_order.txt
file is generated in theout_dir
. It contains the contents of thefilepaths
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.registration_pairs
can be set to None.registration_pairs == None
, the new parametersn_volumes
andn_views
are used to generate the registration pairs.