Skip to content

Commit

Permalink
scale step size and print info
Browse files Browse the repository at this point in the history
Fixes #135
  • Loading branch information
kaczmarj committed Jun 29, 2023
1 parent 83688e2 commit 70c0004
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion wsinfer/patchlib/create_patches_fp.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,31 @@ def seg_and_patch(
slide_mpp = get_avg_mpp(full_path)
except CannotReadSpacing:
print("!" * 40)
print("SKIPPINg this slide because the spacing cannot be read")
print("SKIPPING this slide because the spacing cannot be read")
print("!" * 40)
continue

patch_size = orig_patch_size * patch_spacing / slide_mpp
patch_size = round(patch_size)
print(
"Scaled patch size by the patch spacing (result is patches of"
f" {patch_size * patch_spacing} microns)"
)

if step_size is not None:
step_size = step_size * patch_spacing / slide_mpp
step_size = round(step_size)
print(
"Scaled step size by the patch spacing (result is steps of"
f" {step_size * patch_spacing} microns)"
)

# Use non-overlapping patches by default.
# FIXME: step_size is in base pixels. But patch_size is in pixels at a
# particular resolution
step_size = step_size or patch_size
print(f"Using patch size = {patch_size} @ {patch_spacing} MPP")
print(f"Using step size = {step_size} @ {patch_spacing} MPP")
# ----------------------------------------------------------------------

current_patch_params.update(
Expand Down

0 comments on commit 70c0004

Please sign in to comment.