diff --git a/picasso_workflow/analyse.py b/picasso_workflow/analyse.py index 58cb9f1..90fee59 100644 --- a/picasso_workflow/analyse.py +++ b/picasso_workflow/analyse.py @@ -83,7 +83,7 @@ class AutoPicasso(AbstractModuleCollection): # for single-dataset analysis movie = None - info = None + info = [] identifications = None locs = None drift = None @@ -709,9 +709,10 @@ def export_brightfield(self, i, parameters, results): the module index in the protocol parameters : dict necessary items: - filepath : str or list of str + filepath : str or list of str or dict the tiff file(s) to load. The converted file(s) will have the same name, but with .png extension + if dict: keys are labels optional items: min_quantile : float, default: 0 the quantile below which pixels are shown black @@ -724,25 +725,31 @@ def export_brightfield(self, i, parameters, results): as input, potentially changed values, for consistency results : dict the analysis results - filename : the png file + labeled filepath : dict + keys : labels + values : filepaths """ fps_in = parameters["filepath"] if isinstance(fps_in, str): fps_in = [fps_in] - fps_out = [] - for fp in fps_in: + if isinstance(fps_in, list): + d = {} + for i, fp in enumerate(fps_in): + d[str(i)] = fp + fps_out = {} + for label, fp in fps_in.items(): mov, _ = io.load_movie(fp) frame = mov[0] fn = os.path.split(fp)[1] fn = os.path.splitext(fn)[0] + ".png" fp = os.path.join(results["folder"], fn) - fps_out.append(fp) + fps_out[label] = fp min_quantile = parameters.get("min_quantile", 0) max_quantile = parameters.get("max_quantile", 1) process_brightfield.save_frame( fp, frame, min_quantile, max_quantile ) - results["filepaths"] = fps_out + results["labeled filepaths"] = fps_out return parameters, results @module_decorator @@ -1100,7 +1107,7 @@ def smlm_clusterer(self, i, parameters, results): parameters: dict with required keys: radius : float - the smlm radius + the smlm radius, in px min_locs : float the smlm min_locs and optional keys: diff --git a/picasso_workflow/confluence.py b/picasso_workflow/confluence.py index 2adb814..3bf1d53 100644 --- a/picasso_workflow/confluence.py +++ b/picasso_workflow/confluence.py @@ -247,7 +247,11 @@ def export_brightfield(self, i, parameters, results): self.report_page_name, self.report_page_id, text ) - for fp in results.get("filepaths"): + for label, fp in results.get("filepaths").items(): + text = f"""{label}""" + self.ci.update_page_content( + self.report_page_name, self.report_page_id, text + ) self.ci.upload_attachment(self.report_page_id, fp) self.ci.update_page_content_with_image_attachment( self.report_page_name, diff --git a/picasso_workflow/tests/test_analyse.py b/picasso_workflow/tests/test_analyse.py index 99fe7be..b0ff4fb 100644 --- a/picasso_workflow/tests/test_analyse.py +++ b/picasso_workflow/tests/test_analyse.py @@ -171,6 +171,7 @@ def localize(self, mock_get_spots, mock_fit_spot, mock_locs_from_fits): ], dtype=self.locs_dtype, ) + self.ap.info = [] parameters = {"box_size": 7, "fit_parallel": False} diff --git a/picasso_workflow/tests/test_confluence.py b/picasso_workflow/tests/test_confluence.py index 83cf901..a63f94a 100644 --- a/picasso_workflow/tests/test_confluence.py +++ b/picasso_workflow/tests/test_confluence.py @@ -239,7 +239,7 @@ def export_brightfield(self): results = { "start time": "now", "duration": 16.4, - "filepaths": ["myfp.png"], + "filepaths": {"GFP": "myfp.png"}, } self.cr.export_brightfield(0, parameters, results)