andreped / NoCodeSeg

🔬 Code-free deep segmentation for computational pathology
MIT License
52 stars 16 forks source link

Import tiles script QuPath #2

Closed pr4deepr closed 2 years ago

pr4deepr commented 2 years ago

Hi @andreped When I try the import pyramidal tiff script to improve annotations generated by FastPathology, the annotations are smaller by 4 times compared to the WSI. I can't enter a value to control for downsample in the new script anymore. It looks like the script has been updated compared to the on in the video I've reused the old version of the script to import annotations for now .

Cheers Pradeep

andreped commented 2 years ago

Oh, nice observation!

We found that the initial implementation did not work well for extremely large WSIs. But I see that the downsample hyperparameter is no longer there in the new implementation.

I see that you mentioned that you have reused the old version, then I believe you are referring to this implementation: https://github.com/andreped/NoCodeSeg/blob/689f41b0db66925bb4aa17b1d7ac5abd844bbf13/source/importPyramidalTIFF.groovy

That should work for most WSIs. I will look into adding the ds hyperparameter in the near future. Quite busy today.

andreped commented 2 years ago

@pr4deepr Might be that the hyperparameter level is what you want. See here: https://github.com/andreped/NoCodeSeg/blob/main/source/importPyramidalTIFF.groovy#L19

See its usage here.

Could you try increasing it to 1/2/4, and see what it produces? If not, I can look into adding this option. Might be that it just smooths the segmentation if level is increased.

pr4deepr commented 2 years ago

Hi @andreped

When I try anything other than 0, I get this error


ERROR: ArrayIndexOutOfBoundsException at line 55: Index 4 out of bounds for length 1

ERROR: qupath.lib.images.servers.ImageServerMetadata.getDownsampleForLevel(ImageServerMetadata.java:571)
    qupath.lib.images.servers.AbstractImageServer.getDownsampleForResolution(AbstractImageServer.java:141)
    qupath.lib.images.servers.ImageServer$getDownsampleForResolution.call(Unknown Source)
    org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
    Script11.run(Script11.groovy:56)
    org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
    org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)
    qupath.lib.gui.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:982)
    qupath.lib.gui.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:914)
    qupath.lib.gui.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:829)
    qupath.lib.gui.scripting.DefaultScriptEditor$2.run(DefaultScriptEditor.java:1345)
    java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    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)

Cheers Pradeep

andreped commented 2 years ago

That makes sense. This happens because by choosing ‘level’ you are choosing which image plane to extract the segmentation from. As your image is quite small, only one image plane is created from FastPathology.

Nonetheless, choosing ‘level’ is not what we want to do. There is not a nontrivial way to set downsampling, but I will look into how to do it sometime this week.

But I believe the old script worked well for your application? You can use that for now.

On Tue, 14 Dec 2021 at 02:19, Pradeep Rajasekhar @.***> wrote:

Hi @andreped https://github.com/andreped

When I try anything other than 0, I get this error

ERROR: ArrayIndexOutOfBoundsException at line 55: Index 4 out of bounds for length 1

ERROR: qupath.lib.images.servers.ImageServerMetadata.getDownsampleForLevel(ImageServerMetadata.java:571) qupath.lib.images.servers.AbstractImageServer.getDownsampleForResolution(AbstractImageServer.java:141) qupath.lib.images.servers.ImageServer$getDownsampleForResolution.call(Unknown Source) org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139) Script11.run(Script11.groovy:56) org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) qupath.lib.gui.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:982) qupath.lib.gui.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:914) qupath.lib.gui.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:829) qupath.lib.gui.scripting.DefaultScriptEditor$2.run(DefaultScriptEditor.java:1345) java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) 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)

Cheers Pradeep

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/andreped/NoCodeSeg/issues/2#issuecomment-993065652, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG56G2O3MZVX3C6MIEX74T3UQ2LSHANCNFSM5J5WVXBQ .

pr4deepr commented 2 years ago

Yea, it did work. I'll stick to that one. Thanks for your help!

andreped commented 2 years ago

No problem. Always happy to help :] Looking forward to seeing some of the results!

andreped commented 2 years ago

@pr4deepr It is now possible to set the downsample factor when importing the predictions (.tiff) into QuPath.

For modifications, see here.

Please, download the latest import script and let me know how it goes :] (script is here)