-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Add ConvertPyImageJ example #23
Conversation
@ctrueden @joshmoore please take a look. What do you think is the right approach for the |
Hey, @thewtex. Nice notebook! For my part, I'm not sure there's a completely right approach yet, but here are some thoughts:
|
Thanks for the tips @joshmoore !
Neat! I do not know a lot about scifio.metadata.image (@ctrueden is an expert there). I created #28 to track. For now, I will clear the additional metadata so we can successfully create a basic NGFF. I am pondering if we can use the metadata extension as a stop-gap for
Nice! |
1c9181e
to
c0608dd
Compare
Seems to have problems fetching ImageJ?
|
Please check this section of the Troubleshooting guide. First thing to try is: import imagej.doctor
imagej.doctor.debug_to_stderr(debug_maven=True) before Another thing you could try (not explained in the Troubleshooting guide yet) is to clear caches. There are two of them: the Maven cache in Now that I have written all that: I guess you probably got this error on a cloud machine somewhere, eh @thewtex? So it was probably starting with a fresh environment and unlikely that local caches were stale, since presumably there weren't any. In that case, I'm not sure what's going on here... but the |
"outputs": [], | ||
"source": [ | ||
"import sys, os\n", | ||
"!conda install --yes --prefix {sys.prefix} -c conda-forge openjdk=8\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you need to use conda at all, since you use setup-java
to install openjdk and maven anyway, which are the non-Python dependencies of pyimagej. You could probably just skip this step, and set JAVA_HOME correctly to wherever setup-java puts it, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you need it for Binder, though? It's fine then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good idea @ctrueden ! I tried conda, then moved to what you have set up in CI for pyimagej -- I will try first removing conda then increment on the other debugging steps you suggested.
"Failed to guess the Java version.\n", | ||
"Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp\n", | ||
"WARNING: An illegal reflective access operation has occurred\n", | ||
"WARNING: Illegal reflective access by net.imagej.patcher.LegacyInjector (file:/home/matt/.jgo/net.imagej/imagej/5f34b9963e566d47fe91383d53a5332bfc13df00c5d2f4bd13e2ea10b8f5fb2e/ij1-patcher-1.2.2.jar) to method java.lang.ClassLoader.findLoadedClass(java.lang.String)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you are using Java 11. Can you tell setup-java to use Java 8 instead? It's not a huge deal, Java 11 should work, but you'll avoid these reflection errors. And Java 17 will unfortunately have problems with the bytecode patching that ImageJ2 does around the original ImageJ.
"Attributes:\n", | ||
" rois: None\n", | ||
" tables: None\n", | ||
" scifio.metadata.image: io.scif.FieldPrinter@1ca3d25b\\n\\t--class io.scif...\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ach, yeah, we can do better here. I filed imagej/pyimagej#200.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
], | ||
"source": [ | ||
"# Clean attrs that are Java objects and cannot be serialized to Zarr\n", | ||
"image_da.attrs.clear()\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My goal with imagej/pyimagej#200 would be to eliminate the need to do this. If a Java-side attribute can't be converted to something Pythonic, I think it's OK to drop it. We could at least make it configurable somehow.
@ctrueden using the setup-java action and pre-installing ImageJ outside the notebook seems to work. Thanks for the tips! |
No description provided.