Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3470489
feat(util): add raw movie discovery helper and tests
JonasFischer1 May 19, 2026
6f5e151
transition raw movie discovery from metaworkflow to util
JonasFischer1 May 19, 2026
0059006
Adds find files in folder button to gui
JonasFischer1 May 19, 2026
888479b
removes grid and padding from images
JonasFischer1 May 19, 2026
36e2d46
adds NumPy scalar type casting
JonasFischer1 May 19, 2026
570ecee
Update confluence.py
JonasFischer1 May 19, 2026
1d42879
fix: empty agg workflow update
JonasFischer1 May 19, 2026
71730a7
feat: density based image area selection for render function
JonasFischer1 May 19, 2026
2a76d13
fix: resolve coordinator init param mismatch
JonasFischer1 May 19, 2026
fa961d8
fix: check if data is 3d in ctrmass_ang
JonasFischer1 May 19, 2026
e2fab23
added colormaps for render images
JonasFischer1 May 19, 2026
1c1d1cd
fix: passes cmap on to render
JonasFischer1 May 19, 2026
2451b7b
Flip y axis of images to be in line with picasso
JonasFischer1 May 19, 2026
d5e6a94
fix: makes sure that density based image areas stay within range
JonasFischer1 May 19, 2026
56625c9
Saves overview image without outlines
JonasFischer1 May 19, 2026
0b6c532
Different zoom in types for render images
JonasFischer1 May 19, 2026
7d81c51
fix: MatplotlibDeprecationWarning
JonasFischer1 May 20, 2026
5397e8d
fix: correct get_movie_groups location
JonasFischer1 May 20, 2026
2b9463a
Update to render image alignment and size
JonasFischer1 May 20, 2026
0b92f65
fix: update colormap and percentage based image scaling in render fun…
JonasFischer1 Jun 16, 2026
164159f
fix: remove redundant matplotlib imports in AutoPicasso class
JonasFischer1 Jun 16, 2026
8dbc695
fix: adjust full field of view pixel size and update contrast scaling…
JonasFischer1 Jun 16, 2026
bd3b5db
fix: adjust full field of view pixel size and ROI parameters in AutoP…
JonasFischer1 Jun 16, 2026
9cdb23f
fix: enhance plot_scene function with dpi parameter for better image …
JonasFischer1 Jun 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
346 changes: 315 additions & 31 deletions picasso_workflow/analyse.py

Large diffs are not rendered by default.

143 changes: 106 additions & 37 deletions picasso_workflow/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@ def module_wrapper(self, i, parameters, results, postpone_report=False):
<ac:rich-text-body>
<ul>
"""

def _format_val(v):
if type(v).__module__ == "numpy" and hasattr(v, "item"):
try:
return str(v.item())
except Exception:
pass
return str(v)

for k, v in parameters.items():
parameter_text += (
f"<li>{html.escape(str(k))}: {html.escape(str(v))}</li>"
)
parameter_text += f"<li>{html.escape(str(k))}: {html.escape(_format_val(v))}</li>"

parameter_text += """
</ul>
Expand All @@ -49,9 +56,7 @@ def module_wrapper(self, i, parameters, results, postpone_report=False):
<ul>
"""
for k, v in results.items():
result_text += (
f"<li>{html.escape(str(k))}: {html.escape(str(v))}</li>"
)
result_text += f"<li>{html.escape(str(k))}: {html.escape(_format_val(v))}</li>"

result_text += """
</ul>
Expand Down Expand Up @@ -443,12 +448,17 @@ def analysis_documentation(
text = f"""
<ac:layout><ac:layout-section ac:type="single"><ac:layout-cell>
<p><strong>Module {i:02d}: Analysis Hard- and Software</strong></p>
<ac:structured-macro ac:name="expand" ac:schema-version="1">
<ac:parameter ac:name="title">Parameters</ac:parameter>
<ac:rich-text-body>
<ul>
"""
for k, v in results.items():
text += f"<li>{k}: {v}</li>"
text += f"<li>{html.escape(str(k))}: {html.escape(str(v))}</li>"
text += """
</ul>
</ac:rich-text-body>
</ac:structured-macro>
</ac:layout-cell></ac:layout-section></ac:layout>
"""
self.ci.update_page_content(
Expand Down Expand Up @@ -641,7 +651,10 @@ def load_dataset_localizations(

@module_decorator
def identify(
self, i, parameters, results,
self,
i,
parameters,
results,
parameter_text,
result_text,
postpone_report=False,
Expand Down Expand Up @@ -1098,6 +1111,8 @@ def render(
filepath to full FOV rendering
fp_scene_ctrmass : str
filepath to center of mass zoom rendering (conditional, only if ctrmass_fov_nm provided)
fp_scene_tiles : list of lists of str
filepaths to the 5x5 tiled renderings
"""
logger.debug("Reporting render.")
text = f"""
Expand All @@ -1111,38 +1126,92 @@ def render(
{parameter_text}
{result_text}
"""
fig_fps = []
titles = []
if fp_fig := results.get("fp_scene_fullfov"):
fig_fps.append(fp_fig)
titles.append("Localizations in whole Field of View")
if fp_fig := results.get("fp_scene_ctrmass"):
fig_fps.append(fp_fig)
titles.append("Localizations in Zoom-In")

if len(fig_fps) > 1:
fn_figs = []
for fp in fig_fps:
generate_active_rois = parameters.get("generate_active_rois", True)
rois = results.get("fp_scene_rois", [])

text += "<table><tr>"

# Left column: Field of View Overviews
text += "<td style='vertical-align: middle; text-align: center; padding-right: 20px;'>"
if fp_fullfov := results.get("fp_scene_fullfov"):
try:
self.ci.upload_attachment(self.report_page_id, fp_fullfov)
except ConfluenceInterfaceError:
pass
fn_fullfov = os.path.split(fp_fullfov)[1]

fp_unmarked = results.get("fp_scene_fullfov_unmarked")
if fp_unmarked:
try:
self.ci.upload_attachment(self.report_page_id, fp)
self.ci.upload_attachment(self.report_page_id, fp_unmarked)
except ConfluenceInterfaceError:
pass
fn_figs.append(os.path.split(fp)[1])
fn_unmarked = os.path.split(fp_unmarked)[1]

text += "<table><tr>"
for tit in titles:
text += f"<td><b>{tit}</b></td>"
text += "</tr>"
text += "<tr>"
for fn in fn_figs:
text += f"""
<td>
<ac:image ac:height="350">
<ri:attachment ri:filename="{fn}" />
</ac:image>
</td>"""
text += "</tr>"
<p><b>Overview Images</b></p>
<p>
<ac:image ac:height="450">
<ri:attachment ri:filename="{fn_unmarked}" />
</ac:image>
&nbsp;&nbsp;
<ac:image ac:height="450">
<ri:attachment ri:filename="{fn_fullfov}" />
</ac:image>
</p>
"""
else:
text += f"""
<p><b>Overview Image</b></p>
<ac:image ac:height="450">
<ri:attachment ri:filename="{fn_fullfov}" />
</ac:image>
"""
text += "</td>"

# Right column: Either active site images OR the Zoom-in image depending on selection
text += "<td style='vertical-align: middle; text-align: center;'>"
if generate_active_rois and rois:
text += "<p><b>Zoom-In Images (Density-Driven)</b></p>"
text += "<table style='border-collapse: collapse; border: none; margin-left: auto; margin-right: auto;'>"
for idx in range(0, len(rois), 2):
text += "<tr>"
for sub_idx in range(idx, min(idx + 2, len(rois))):
fp_roi = rois[sub_idx]
try:
self.ci.upload_attachment(self.report_page_id, fp_roi)
except ConfluenceInterfaceError:
pass
fn_roi = os.path.split(fp_roi)[1]
text += f"""
<td style='border: 1px solid #ddd; padding: 6px; text-align: center;'>
<ac:image ac:height="200">
<ri:attachment ri:filename="{fn_roi}" />
</ac:image>
<br/><b>Site {sub_idx + 1}</b>
</td>"""
# If odd number of ROIs and this is the last row, add an empty cell for layout alignment
if len(rois) % 2 != 0 and idx + 1 >= len(rois):
text += "<td style='border: none;'></td>"
text += "</tr>"
text += "</table>"
else:
if fp_ctrmass := results.get("fp_scene_ctrmass"):
try:
self.ci.upload_attachment(self.report_page_id, fp_ctrmass)
except ConfluenceInterfaceError:
pass
fn_ctrmass = os.path.split(fp_ctrmass)[1]
text += f"""
<p><b>Zoom-In Image</b></p>
<ac:image ac:height="450">
<ri:attachment ri:filename="{fn_ctrmass}" />
</ac:image>
"""
text += "</td>"

text += "</tr></table>"

text += """
</ac:layout-cell></ac:layout-section></ac:layout>
Expand Down Expand Up @@ -4551,7 +4620,7 @@ def filter_locs(
{result_text}"""

if fp_fig := results.get("fp_fig_before"):
text += "<ul><table>"
text += "<table>"
text += "<tr><td><b>Before Filtering</b></td>"
text += "<td><b>After Filtering</b></td></tr>"
text += "<tr><td>"
Expand All @@ -4575,7 +4644,7 @@ def filter_locs(
<ac:image ac:width="350"><ri:attachment
ri:filename="{fp_fig}" />
</ac:image>"""
text += "</td></tr></table></ul>"
text += "</td></tr></table>"

text += """
</ac:layout-cell></ac:layout-section></ac:layout>
Expand Down Expand Up @@ -4649,7 +4718,7 @@ def filter_transient_binding(
"""

if fp_fig := results.get("fp_fig_before"):
text += "<ul><table>"
text += "<table>"
text += "<tr><td><b>Before Filtering</b></td>"
text += "<td><b>After Filtering</b></td></tr>"
text += "<tr><td>"
Expand All @@ -4673,7 +4742,7 @@ def filter_transient_binding(
<ac:image ac:width="350"><ri:attachment
ri:filename="{fp_fig}" />
</ac:image>"""
text += "</td></tr></table></ul>"
text += "</td></tr></table>"

text += """
</ac:layout-cell></ac:layout-section></ac:layout>
Expand Down
Loading