Skip to content

Commit 8d4bb58

Browse files
committed
fmt
1 parent 338675c commit 8d4bb58

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

spimquant/workflow/scripts/multiotsu.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
print(f" 📊 bins: {n_bins} (bin width: {bin_width})")
4545

4646
# we use the default level=0, since we are reading in the n4 output, which is already downsampled if level was >0
47-
znimg = ZarrNii.from_ome_zarr(
48-
snakemake.input.corrected, **zarrnii_kwargs
49-
)
47+
znimg = ZarrNii.from_ome_zarr(snakemake.input.corrected, **zarrnii_kwargs)
5048

5149
# calculate histogram using percentile-based range and bin-width-derived bin count
5250
(hist_counts, bin_edges) = znimg.compute_histogram(

spimquant/workflow/scripts/qc_otsu_threshold_sweep.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ def _file_to_base64_png(path):
4545
def _norm(arr, lo, hi):
4646
"""Linearly normalise *arr* to [0, 1] using the given bounds."""
4747
if hi > lo:
48-
return np.clip(
49-
(arr.astype(np.float32) - lo) / (hi - lo), 0.0, 1.0
50-
)
48+
return np.clip((arr.astype(np.float32) - lo) / (hi - lo), 0.0, 1.0)
5149
return np.zeros_like(arr, dtype=np.float32)
5250

5351

@@ -134,15 +132,11 @@ def main():
134132
threshold_entries = []
135133
for thresh in thresholds:
136134
fig, axes = plt.subplots(1, n_crops, figsize=(n_crops * 3, 3))
137-
fig.suptitle(
138-
f"Threshold = {thresh:.1f}", fontsize=10, fontweight="bold"
139-
)
135+
fig.suptitle(f"Threshold = {thresh:.1f}", fontsize=10, fontweight="bold")
140136
if n_crops == 1:
141137
axes = [axes]
142138

143-
for ax, (z, y0, y1, x0, x1), crop_norm in zip(
144-
axes, crop_boxes, img_crops_norm
145-
):
139+
for ax, (z, y0, y1, x0, x1), crop_norm in zip(axes, crop_boxes, img_crops_norm):
146140
mask_crop = (data[z, y0:y1, x0:x1] > thresh).astype(np.float32)
147141
ax.imshow(crop_norm, cmap="gray")
148142
mask_ma = np.ma.masked_where(mask_crop < 0.5, mask_crop)

0 commit comments

Comments
 (0)