vanvalenlab / kiosk-imageJ-plugin

An ImageJ Plugin for interacting with the DeepCell Kiosk
Other
3 stars 2 forks source link

Improved QuPath integration #39

Open ngreenwald opened 3 years ago

ngreenwald commented 3 years ago

Pete put together the following script for improved QuPath usability: https://gist.github.com/petebankhead/db8548a0112bad089492061bf8046430

Once we figure out next steps for QuPath, we can decide what we want to do with this script.

Svidro commented 2 years ago

Is there any chance something has changed on the Kiosk end that might have resulted in the errors shown in this issue: https://forum.image.sc/t/using-deepcell-with-qupath/60265/2?u=research_associate

willgraf commented 2 years ago

It sounds like the issue is a 400 error response. Browsing through the linked groovy script, I think that the jobType being sent is Multiplex but must be mesmer. Please try updating the jobType value to mesmer and please follow up if your issue persists.

Svidro commented 2 years ago

That does bypass the original error, but it still seems the script might no longer work due to other changes. mesmer seems to be requiring very strict image sizes which won't necessarily be true for large images.

INFO: Waiting for 1 task(s) to complete ERROR: KioskJobFailedException: Traceback (most recent call last): File "/usr/src/app/redis_consumer/consumers/base_consumer.py", line 201, in consume status = self._consume(redis_hash) File "/usr/src/app/redis_consumer/consumers/mesmer_consumer.py", line 125, in _consume channels=channels) File "/usr/src/app/redis_consumer/consumers/base_consumer.py", line 300, in validate_model_input raise ValueError(errtext) ValueError: Invalid image shape: [(1, 269, 298)]. The mesmer job expects images of shape[(-1, 256, 256, 2)]

ERROR: java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) java.base/java.lang.reflect.Constructor.newInstance(Unknown Source) org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:72) org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:263) org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:277) Script4.runJob(Script4.groovy:162) Script4$runJob.callStatic(Unknown Source) org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:55) org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:217) org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:240) Script4.detectCells(Script4.groovy:124) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.base/java.lang.reflect.Method.invoke(Unknown Source) org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:351) org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:61) org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171) Script4$_run_closure1.doCall(Script4.groovy:79) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.base/java.lang.reflect.Method.invoke(Unknown Source) org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263) groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035) groovy.lang.Closure.call(Closure.java:412) groovy.lang.Closure.call(Closure.java:406) java.base/java.util.concurrent.FutureTask.run(Unknown Source) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.base/java.lang.Thread.run(Unknown Source)

ngreenwald commented 2 years ago

Although the error message you posted has a specific shape on the x/y dims, I think what's actually causing the issue is the channels dimension, which in the image you provided is only a single channel. The model expects a two-channel image

Svidro commented 2 years ago

Ah, I was aiming for the simplest option. What text option do we use for nuclear segmentation only? Or is the expectation passing the DAPI channel twice?

ngreenwald commented 2 years ago

If you pass a nuclear and membrane channel, you'll get both nuclear and cell segmentation. You can then decide what you want to do with each segmentation. If you didn't acquire a membrane marker as part of your panel, then just pass a blank channel as the membrane marker.