Skip to content

Commit d72a608

Browse files
authored
CP-IJ: add workaround for Java names (#219)
Required for newer PyImageJ releases (1.4.1) until we have a release with imagej/pyimagej@a1861b6 merged. Closes #218
1 parent 7682fb0 commit d72a608

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

active_plugins/cpij/server.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ def _convert_java_to_python_type(ij, return_value):
196196
# TODO actualize changes in a virtual ImagePlus. Remove this when pyimagej does this innately
197197
if issubclass(return_class, jpype.JClass("ij.ImagePlus")):
198198
ij.py.synchronize_ij1_to_ij2(return_value)
199-
return ij.py.from_java(return_value)
199+
py_img = ij.py.from_java(return_value)
200+
201+
# HACK
202+
# Workaround for DataArrays potentially coming back with Java names. Fixed upstream in:
203+
# https://github.com/imagej/pyimagej/commit/a1861b6c1658d6751fa314650b13411f956549ab
204+
py_img.name = ij.py.from_java(py_img.name)
205+
return py_img
200206

201207
# Not a supported type
202208
return None

0 commit comments

Comments
 (0)