Skip to content

Commit c9d929f

Browse files
authored
convert np.str_ to python str (#25)
1 parent 050d701 commit c9d929f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/ndevio/nimage.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,11 @@ def get_napari_metadata(
285285
# Build metadata under various condition
286286
# add channel_axis if unpacking channels as layers
287287
if IS_MULTICHANNEL:
288-
channel_names = self.napari_data.coords[CHANNEL_DIM].data.tolist()
288+
# Convert to plain Python strings to avoid numpy string types (NumPy 2.0+)
289+
channel_names = [
290+
str(c)
291+
for c in self.napari_data.coords[CHANNEL_DIM].data.tolist()
292+
]
289293

290294
if self.settings.ndevio_Reader.unpack_channels_as_layers:
291295
meta["channel_axis"] = self.napari_data.dims.index(CHANNEL_DIM)

tests/test_nimage.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ def test_get_napari_image_data_mosaic_tile_not_in_memory(
207207
None,
208208
), # OME-TIFF works with bioio-ome-tiff (core)
209209
(CZI_FILE, False, "bioio-czi"), # CZI needs bioio-czi plugin
210-
# RGB_TIFF now works with bioio-tifffile (core)
211210
(RGB_TIFF, True, None),
212211
],
213212
)
@@ -260,7 +259,7 @@ def test_determine_reader_plugin_behavior(
260259
(LOGO_PNG, True, None),
261260
(CELLS3D2CH_OME_TIFF, True, None),
262261
(CZI_FILE, False, ["bioio-czi", "Zeiss CZI files"]),
263-
(RGB_TIFF, True, None), # Now works with bioio-tifffile (core)
262+
(RGB_TIFF, True, None),
264263
],
265264
)
266265
def test_nimage_init_with_various_formats(

0 commit comments

Comments
 (0)