Skip to content

Commit 767f70e

Browse files
Merge pull request #66 from fractal-analytics-platform/update_ngio_version
adopt ngio 0.4
2 parents 0e536dd + c125733 commit 767f70e

File tree

7 files changed

+57
-134
lines changed

7 files changed

+57
-134
lines changed

pixi.lock

Lines changed: 39 additions & 114 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
authors = [{ name = "lorenzo", email = "[email protected]" }]
33
dependencies = [
44
"streamlit>=1.50.0, <1.51.0",
5-
"ngio>=0.3.2, <0.4.0",
5+
"ngio==0.4.2",
66
"plotly",
77
"matplotlib",
88
"orjson",
@@ -54,7 +54,7 @@ build-backend = "hatchling.build"
5454
source = "vcs"
5555

5656

57-
[tool.pixi.project]
57+
[tool.pixi.workspace]
5858
channels = ["conda-forge"]
5959
platforms = ["osx-arm64", "linux-64", "win-64"]
6060

src/fractal_feature_explorer/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@
88
__version__ = "uninstalled"
99
__author__ = "Lorenzo Cerrone"
1010
__email__ = "[email protected]"
11-

src/fractal_feature_explorer/authentication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class FractalUserNonVerifiedException(ValueError):
1010
pass
1111

12+
1213
logger = get_logger(__name__)
1314

1415

@@ -60,7 +61,6 @@ def _verify_authentication(config: ProductionConfig):
6061
msg = f"Could not obtain Fractal user information from {current_user_url}."
6162
logger.info(msg)
6263
raise ValueError(msg)
63-
6464

6565

6666
def verify_authentication():

src/fractal_feature_explorer/pages/filters_page/_scatter_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def view_point(point: int, feature_df: pl.DataFrame) -> None:
5454
_show_point_info(point_dict)
5555
return
5656

57-
channels = container.image_meta.channel_labels
57+
channels = container.channel_labels
5858
if len(channels) > 1:
5959
channel = st.selectbox(
6060
label="Select channel",

src/fractal_feature_explorer/pages/setup_page/_tables_io.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
import polars as pl
44
import streamlit as st
5-
from ngio.common import (
5+
from ngio.images._table_ops import (
66
concatenate_image_tables_async,
77
concatenate_image_tables_as_async,
8+
list_image_tables_async,
89
)
910
from ngio.tables import FeatureTable
1011
from typing import Literal
@@ -16,7 +17,6 @@
1617
plate_name_from_url,
1718
extras_from_url,
1819
)
19-
from ngio.common import list_image_tables_async
2020

2121
from streamlit.logger import get_logger
2222

@@ -155,7 +155,7 @@ def _collect_condition_table_from_images_cached(
155155
concatenate_image_tables_async(
156156
images=images,
157157
extras=extras,
158-
table_name=table_name,
158+
name=table_name,
159159
)
160160
)
161161
condition_table = condition_table.lazy_frame.collect()
@@ -280,7 +280,7 @@ def _collect_feature_table_from_images_cached(
280280
concatenate_image_tables_as_async(
281281
images=images,
282282
extras=extras,
283-
table_name=table_name,
283+
name=table_name,
284284
table_cls=FeatureTable,
285285
mode="lazy",
286286
)

src/fractal_feature_explorer/utils/ngio_io_caches.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
open_ome_zarr_container,
1212
open_ome_zarr_plate,
1313
)
14-
from ngio.common import Dimensions, Roi, list_image_tables_async
14+
from ngio.common import Dimensions, Roi
15+
from ngio.images._table_ops import list_image_tables_async
1516
from ngio.common._zoom import numpy_zoom
1617
from ngio.ome_zarr_meta.ngio_specs import PixelSize
1718
from ngio.tables import MaskingRoiTable
@@ -44,8 +45,8 @@ def _url_belongs_to_base(url: str, base_url: str) -> bool:
4445
logger.debug(f"Not including token for {url=}, case 1.")
4546
return False
4647
elif parsed_url.path is not None and (
47-
parsed_base_url.path is not None and
48-
not parsed_url.path.startswith(parsed_base_url.path)
48+
parsed_base_url.path is not None
49+
and not parsed_url.path.startswith(parsed_base_url.path)
4950
):
5051
logger.debug(f"Not including token for {url=}, case 2.")
5152
return False
@@ -233,14 +234,12 @@ def roi_to_slice_kwargs(
233234
t_slice: int = 0,
234235
) -> dict[str, slice | int | Iterable[int]]:
235236
"""Convert a WorldCooROI to slice_kwargs."""
236-
raster_roi = roi.to_pixel_roi(
237-
pixel_size=pixel_size, dimensions=dimensions
238-
).to_slices()
237+
raster_roi = roi.to_slicing_dict(pixel_size=pixel_size)
239238

240-
if dimensions.has_axis(axis_name="z"):
239+
if dimensions.axes_handler.has_axis(axis_name="z"):
241240
raster_roi["z"] = z_slice # type: ignore
242241

243-
if dimensions.has_axis(axis_name="t"):
242+
if dimensions.axes_handler.has_axis(axis_name="t"):
244243
raster_roi["t"] = t_slice # type: ignore
245244

246245
return raster_roi # type: ignore
@@ -292,7 +291,7 @@ def _get_image_array(
292291
ref_label=ref_label,
293292
fractal_token=fractal_token,
294293
)
295-
roi = masking_roi.get(label=label)
294+
roi = masking_roi.get_label(label=label)
296295
roi = roi.zoom(zoom_factor=zoom_factor)
297296
roi_slice = roi_to_slice_kwargs(
298297
roi=roi,
@@ -335,7 +334,7 @@ def _get_label_array(
335334
ref_label=ref_label,
336335
fractal_token=fractal_token,
337336
)
338-
roi = masking_roi.get(label=label)
337+
roi = masking_roi.get_label(label=label)
339338
roi = roi.zoom(zoom_factor=zoom_factor)
340339
roi_slice = roi_to_slice_kwargs(
341340
roi=roi,
@@ -408,7 +407,7 @@ def get_single_label_image(
408407
label_array = numpy_zoom(
409408
label_array,
410409
target_shape=image_rgba.shape[:2],
411-
order=0, # Always use nearest neighbor for labels
410+
order="nearest", # Always use nearest neighbor for labels
412411
)
413412

414413
image_rgba[label_array > 0, 0] = 255

0 commit comments

Comments
 (0)