# HG changeset patch # User imgteam # Date 1688601678 0 # Node ID 700ae37e5c698491e5a049609eb603afc76f910b # Parent 1b0fc671187f20482fc7557e7d919bf227783142 planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27 diff -r 1b0fc671187f -r 700ae37e5c69 run-superdsm.py --- a/run-superdsm.py Sun Jun 25 21:48:40 2023 +0000 +++ b/run-superdsm.py Thu Jul 06 00:01:18 2023 +0000 @@ -19,6 +19,37 @@ import superdsm.render +hyperparameters = [ + ('AF_scale', float), + ('c2f_region_analysis/min_atom_radius', float), + ('c2f_region_analysis_min_norm_energy_improvement', float), + ('c2f_region_analysis_max_atom_norm_energy', float), + ('c2f_region_analysis_max_cluster_marker_irregularity', float), + ('dsm_alpha', float), + ('dsm_AF_alpha', float), + ('global_energy_minimization_betai', float), + ('global_energy_minimization_AF_beta', float), + ('postprocess_mask_max_distance', int), + ('postprocess_mask_stdamp', float), + ('postprocess_max_norm_energy', float), + ('postprocess_min_contrast', float), + ('postprocess_min_object_radius', float), +] + + +def get_param_name(key): + return key.replace('/', '_') + + +def create_config(args): + cfg = superdsm.config.Config() + for key, _ in hyperparameters: + value = getattr(args, get_param_name(key)) + if value is not None: + cfg[key] = value + return cfg + + if __name__ == "__main__": parser = argparse.ArgumentParser(description='Segmentation of cell nuclei in 2-D fluorescence microscopy images') parser.add_argument('image', help='Path to the input image') @@ -27,6 +58,8 @@ parser.add_argument('overlay', help='Path to the file containing the overlay of the segmentation results') parser.add_argument('seg_border', type=int) parser.add_argument('slots', type=int) + for key, ptype in hyperparameters: + parser.add_argument('--' + get_param_name(key), type=ptype, default=None) args = parser.parse_args() if args.slots >= 2: @@ -49,7 +82,7 @@ shutil.copy(str(args.image), img_filepath) pipeline = superdsm.pipeline.create_default_pipeline() - cfg = superdsm.config.Config() + cfg = create_config(args) img = superdsm.io.imread(img_filepath) data, cfg, _ = superdsm.automation.process_image(pipeline, cfg, img) diff -r 1b0fc671187f -r 700ae37e5c69 superdsm.xml --- a/superdsm.xml Sun Jun 25 21:48:40 2023 +0000 +++ b/superdsm.xml Thu Jul 06 00:01:18 2023 +0000 @@ -1,7 +1,7 @@ - + globally optimal segmentation method based on superadditivity and deformable shape models for cell nuclei in fluorescence microscopy images - superdsm + superdsm ray-core scikit-image @@ -14,19 +14,71 @@ 'overlay.png' $seg_border \${GALAXY_SLOTS:-4} - > stdout.txt + #if str($config.AF_scale) != '': + --AF_scale '${config.AF_scale}' + #end if + #if str($config.c2f_region_analysis_min_atom_radius) != '': + --c2f_region_analysis_min_atom_radius '${config.c2f_region_analysis_min_atom_radius}' + #end if + #if str($config.c2f_region_analysis_min_norm_energy_improvement) != '': + --c2f_region_analysis_min_norm_energy_improvement '${config.c2f_region_analysis_min_norm_energy_improvement}' + #end if + #if str($config.c2f_region_analysis_max_atom_norm_energy) != '': + --c2f_region_analysis_max_atom_norm_energy '${config.c2f_region_analysis_max_atom_norm_energy}' + #end if + #if str($config.c2f_region_analysis_max_cluster_marker_irregularity) != '': + --c2f_region_analysis_max_cluster_marker_irregularity '${config.c2f_region_analysis_max_cluster_marker_irregularity}' + #end if + #if str($config.dsm_alpha) != '': + --dsm_alpha '${config.dsm_alpha}' + #end if + #if str($config.dsm_AF_alpha) != '': + --dsm_AF_alpha '${config.dsm_AF_alpha}' + #end if + #if str($config.global_energy_minimization_beta) != '': + --global_energy_minimization_beta '${config.global_energy_minimization_beta}' + #end if + #if str($config.global_energy_minimization_AF_beta) != '': + --global_energy_minimization_AF_beta '${config.global_energy_minimization_AF_beta}' + #end if + #if str($config.postprocess_mask_max_distance) != '': + --postprocess_mask_max_distance '${config.postprocess_mask_max_distance}' + #end if + #if str($config.postprocess_mask_stdamp) != '': + --postprocess_mask_stdamp '${config.postprocess_mask_stdamp}' + #end if + #if str($config.postprocess_max_norm_energy) != '': + --postprocess_max_norm_energy '${config.postprocess_max_norm_energy}' + #end if + #if str($config.postprocess_min_contrast) != '': + --postprocess_min_contrast '${config.postprocess_min_contrast}' + #end if + #if str($config.postprocess_min_object_radius) != '': + --postprocess_min_object_radius '${config.postprocess_min_object_radius}' + #end if ]]> - -