Skip to content

Commit bc31f4b

Browse files
committed
allow manual setting of filer dimensionality
1 parent 8d046c3 commit bc31f4b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/blik/widgets/filter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
high={"widget_type": "FloatSlider", "min": 0, "max": 0.5},
1717
)
1818
def bandpass_filter(
19-
image: "napari.layers.Image", low: float = 0.1, high: float = 0.4
19+
image: "napari.layers.Image",
20+
low: float = 0.1,
21+
high: float = 0.4,
22+
is_2D_data: bool = False,
2023
) -> "napari.types.LayerDataTuple":
21-
channel_axis = 0 if image.metadata["stack"] else None
24+
channel_axis = 0 if is_2D_data else None
2225
high_pass = butterworth(
2326
np.asarray(image.data), low, high_pass=True, channel_axis=channel_axis
2427
)

src/blik/widgets/power_spectrum.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
)
1616
def power_spectrum(
1717
image: "napari.layers.Image",
18+
is_2D_data: bool = False,
1819
) -> "napari.types.LayerDataTuple":
1920
"""
2021
Power spectrum (log scale) of the image.
2122
2223
First centers in real space on the origin to remove shift effects.
2324
"""
24-
axes = (1, 2) if image.metadata["stack"] else None
25+
axes = (-2, -1) if is_2D_data else None
2526
raw = da.compute(image.data)[0]
2627
power_spectrum = np.abs(
2728
fftshift(fftn(ifftshift(raw, axes=axes), axes=axes), axes=axes)

0 commit comments

Comments
 (0)