Skip to content

Commit

Permalink
feat!: use sliding window view.
Browse files Browse the repository at this point in the history
  • Loading branch information
paquiteau committed Jan 1, 2024
1 parent 366ad7b commit 167b29d
Show file tree
Hide file tree
Showing 6 changed files with 356 additions and 149 deletions.
1 change: 0 additions & 1 deletion src/patch_denoise/_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Docstring can then use templated argument such as ``$patch_config`` that will be
substitute by their definition (see docdict items).
source:
"""

import inspect
Expand Down
20 changes: 20 additions & 0 deletions src/patch_denoise/bindings/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ def parse_args():
),
default="optimal-fro_11_5_weighted",
)
parser.add_argument(
"--time-slice",
help=(
"Slice across time. \n"
"If <N>x the patch will be N times longer in space than in time \n"
"If int, this is the size of the time dimension patch. \n"
"If not specified, the whole time serie is used. \n"
"Note: setting a low aspect ratio will increase the number of patch to be"
"processed, and will increase memory usage and computation times."
),
default=None,
type=str,
)
parser.add_argument(
"--mask",
default=None,
Expand Down Expand Up @@ -145,6 +158,13 @@ def main():
)

d_par = DenoiseParameters.from_str(args.conf)
if isinstance(args.time_slice, str):
if args.time_slice.endswith("x"):
t = float(args.time_slice[:-1])
t = int(d_par ** (input_data.ndim - 1) / t)
else:
t = int(args.time_slice)
d_par.patch_shape = (d_par.patch_shape,) * (input_data.ndim - 1) + (t,)
print(d_par)
denoise_func = DENOISER_MAP[d_par.method]
extra_kwargs = dict()
Expand Down
4 changes: 2 additions & 2 deletions src/patch_denoise/bindings/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class DenoiseParameters:
"""Denoise Parameters data structure."""

method: str = None
patch_shape: int = 11
patch_overlap: int = 0
patch_shape: int | tuple[int, ...] = 11
patch_overlap: int | tuple[int, ...] = 0
recombination: str = "weighted" # "center" is also available
mask_threshold: int = 10

Expand Down
Loading

0 comments on commit 167b29d

Please sign in to comment.