Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion deeptrack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# Create a unit registry with custom pixel-related units.
units_registry = UnitRegistry(pint_definitions.split("\n"))

units = units_registry # Alias for backward compatibility

from deeptrack.backend import *

Expand Down
26 changes: 18 additions & 8 deletions deeptrack/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -8231,10 +8231,16 @@ def get(
If the input `factor` is not a valid integer or tuple of integers.

"""

# TBE: this seems to create an issue with image normalization when
# only one number is give. IT automatically replicate this value in the
# 3D but pooling is actually only done in 2D. I suggest if only `factor`
# is given to transform it into (facto, factor, 1) by default.
# This should also ensure backcompatibility.

# Ensure factor is a tuple of three integers.
if np.size(factor) == 1:
factor = (factor,) * 3
# factor = (factor,) * 3
factor = (factor, factor, 1)
elif len(factor) != 3:
raise ValueError(
"Factor must be an integer or a tuple of three integers."
Expand All @@ -8245,12 +8251,16 @@ def get(
with units.context(ctx):
image = self.feature(image)

# Downscale the result to the original resolution.
import skimage.measure

image = skimage.measure.block_reduce(
image, (factor[0], factor[1]) + (1,) * (image.ndim - 2), np.mean
)
# NOTE: The downscaling step is disabled and taken care in
# deeptrack.optics since it now depends on scatter.main_property

# # Downscale the result to the original resolution.
# import skimage.measure

# image = skimage.measure.block_reduce(
# image, (factor[0], factor[1]) + (1,) * (image.ndim - 2), np.mean
# )

return image

Expand Down Expand Up @@ -9707,4 +9717,4 @@ def get(
if len(res) == 1:
res = res[0]

return res
return res
Loading