Skip to content

Commit

Permalink
Ensure converted DataArrays have pythonic names
Browse files Browse the repository at this point in the history
Without this, they will have jpype Strings, which do not always behave
in a pythonic way (e.g. are not pickleable).
  • Loading branch information
hinerm committed Sep 21, 2023
1 parent 676be55 commit a1861b6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/imagej/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def java_to_xarray(ij: "jc.ImageJ", jobj) -> xr.DataArray:
xr_dims = dims._convert_dims(xr_dims, direction="python")
xr_coords = dims._get_axes_coords(xr_axes, xr_dims, narr.shape)
name = jobj.getName() if isinstance(jobj, jc.Named) else None
name = ij.py.from_java(name)
return xr.DataArray(narr, dims=xr_dims, coords=xr_coords, attrs=xr_attrs, name=name)


Expand Down

0 comments on commit a1861b6

Please sign in to comment.