Giter Club home page Giter Club logo

qupath-extension-stardist's Introduction

Image.sc forum Total downloads Latest release downloads Paper Twitter

QuPath

QuPath is open source software for bioimage analysis.

Features include:

  • Lots of tools to annotate and view images, including whole slide & microscopy images
  • Workflows for brightfield & fluorescence image analysis
  • New algorithms for common tasks, including cell segmentation, tissue microarray dearraying
  • Interactive machine learning for object & pixel classification
  • Customization, batch-processing & data interrogation by scripting
  • Easy integration with other tools, including ImageJ

To download QuPath, go to the Latest Releases page.

For documentation, see https://qupath.readthedocs.io

For help & support, try image.sc or the links here

To build QuPath from source see here.

If you find QuPath useful in work that you publish, please cite the publication!

QuPath is an academic project intended for research use only. The software has been made freely available under the terms of the GPLv3 in the hope it is useful for this purpose, and to make analysis methods open and transparent.

Development & support

QuPath is being actively developed at the University of Edinburgh by:

Past QuPath dev team members:

  • Melvin Gelbard
  • Mahdi Lamb

For all contributors, see here.

This work is made possible in part thanks to funding from:


Background

QuPath was first designed, implemented and documented by Pete Bankhead while at Queen's University Belfast, with additional code and testing by Jose Fernandez.

Versions up to v0.1.2 are copyright 2014-2016 The Queen's University of Belfast, Northern Ireland. These were written as part of projects that received funding from:

  • Invest Northern Ireland (RDO0712612)
  • Cancer Research UK Accelerator (C11512/A20256)

Image

qupath-extension-stardist's People

Contributors

alanocallaghan avatar petebankhead avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

qupath-extension-stardist's Issues

Measurement keys changed by StarDist

I notice that when I run StarDist (for 0.4.0) on Qupath 0.4.2 with the measurement options the displayed measurement keys for the segmented cells are different to the measurement keys displayed when running the standard cell detection. For example with StarDist the key is ordered '::' whereas the standard cell detection orders the measurement key ': .

Invalid check for classification size

Currently, if the number of classes expected by QuPath is higher than the classes provided by the model, QuPath will take the missing classes in the rays channels as the number of rays is computed from the number of expected classes. The warning for invalid classification size is then never triggered.
image

Error running StarDist on smaller images

Bug report

Describe the bug
StarDist fails when run on an image with an incompatible tile size with an error such as

ERROR: RuntimeException: OpenCV(4.5.3) D:\a\javacpp-presets\javacpp-presets\opencv\cppbuild\windows-x86_64\opencv-4.5.3\modules\dnn\src\layers\concat_layer.cpp:102: error: (-201:Incorrect size of input array) Inconsistent shape for ConcatLayer in function 'cv::dnn::ConcatLayerImpl::getMemoryShapes'

When affecting smaller images, changing the tile size does not resolve the problem because the tiles are trimmed anyway based upon the image dimensions.

See https://forum.image.sc/t/error-running-stardist-on-qupath-v0-3-0-rc2-using-opencv-converted-model/56216 for details.

Expected behavior
No error. Image should automatically be padded to a compatible size immediately before prediction.

Version:

  • v0.3.0-rc2 (possibly earlier versions as well)

Tile artifacts under some circumstances

Bug report

Describe the bug
Tile artifacts appear under some circumstances. See

To Reproduce
Not sure yet...

Expected behavior
No obvious tile artifacts.

Version

  • v0.3.0-rc2

Additional context
Almost certainly due to the lack of padding since b09a16e
However, reinstating padding may not be entirely straightforward because of how tile requests are handled.

QuPath with CUDA doesn’t release GPU memory after StarDist segmentation Usage & Issues qupath

QuPath is not closing the loaded StarDist model when running on a GPU (QuPath built with CUDA). Each time a StarDist script is run, the model will be repeatedly loaded but never closed, leading to an out-of-memory exception when requesting memory greater than the available memory remaining in the VRAM.

Steps to reproduce outlined in: https://forum.image.sc/t/qupath-with-cuda-doesnt-release-gpu-memory-after-stardist-segmentation/57462

cannot run stardist from CLI through script+project

Hello!

When I try to use CLI to run an image processing task involving stardist I get the following error. It seems the workflow correctly loads stardist for the first call (as I am guessing from the "Added extension" line). Yet, on subsequent calls, I think something in the way batching works for scripts makes it lose track of where the Stardist installation lives.

"QuPath-0.3.2 (console).lnk" script -p="C:\Users\mashraf\Documents\QP_MAKEPROJ3\QuPathProject\project.qpproj" -s "C:\Users\mashraf\qp_batch_bash\da_stardist_v3_reg.groovy"

OpenJDK 64-Bit Server VM warning: Option --illegal-access is deprecated and will be removed in a future release.
15:38:46.089 [main] [INFO ] qupath.lib.common.ThreadTools - Setting parallelism to 15
15:38:46.256 [main] [INFO ] qupath.ScriptCommand - Setting tile cache size to 32600.00 MB (25.0% max memory)
15:38:46.366 [main] [INFO ] qupath.lib.gui.ExtensionClassLoader - Refreshing extensions in C:\Users\mashraf\Documents\qp_ext_test\extensions
15:38:46.367 [main] [INFO ] qupath.lib.gui.ExtensionClassLoader - Added extension: C:\Users\mashraf\Documents\qp_ext_test\extensions\qupath-extension-stardist-0.3.2.jar
15:38:46.381 [main] [INFO ] qupath.lib.scripting.QP - Initializing type adapters
15:38:47.761 [main] [INFO ] qupath.ScriptCommand - Running script for 2022_02_22__14_20__1786-Extended Depth of Focus-07-Scene-1-ScanRegion0_crop.czi - Scene #1
15:38:47.804 [main] [INFO ] q.l.i.s.o.OpenslideServerBuilder - OpenSlide version 3.4.1
15:38:47.926 [main] [INFO ] q.l.i.s.b.BioFormatsServerOptions - Setting max Bio-Formats readers to 16
C:\Users\mashraf\OneDrive - bluerocktx\Documents\qp_ext_test
15:38:56.479 [ForkJoinPool.commonPool-worker-25] [WARN ] qupath.opencv.ops.ImageOps - Normalization percentiles give the same value (0.0), scale will be Infinity
15:38:56.485 [ForkJoinPool.commonPool-worker-7] [WARN ] qupath.opencv.ops.ImageOps - Normalization percentiles give the same value (0.0), scale will be Infinity
15:38:56.635 [ForkJoinPool.commonPool-worker-13] [WARN ] qupath.opencv.ops.ImageOps - Normalization percentiles give the same value (0.0), scale will be Infinity
15:38:56.652 [ForkJoinPool.commonPool-worker-19] [WARN ] qupath.opencv.ops.ImageOps - Normalization percentiles give the same value (0.0), scale will be Infinity
15:38:56.861 [ForkJoinPool.commonPool-worker-23] [WARN ] qupath.opencv.ops.ImageOps - Normalization percentiles give the same value (0.0), scale will be Infinity
15:38:57.274 [ForkJoinPool.commonPool-worker-31] [WARN ] qupath.opencv.ops.ImageOps - Normalization percentiles give the same value (0.0), scale will be Infinity
15:38:59.955 [ForkJoinPool.commonPool-worker-1] [WARN ] qupath.opencv.ops.ImageOps - Normalization percentiles give the same value (0.0), scale will be Infinity
15:39:01.089 [ForkJoinPool.commonPool-worker-23] [WARN ] qupath.opencv.ops.ImageOps - Normalization percentiles give the same value (0.0), scale will be Infinity
15:39:04.608 [ForkJoinPool.commonPool-worker-9] [WARN ] qupath.opencv.ops.ImageOps - Normalization percentiles give the same value (0.0), scale will be Infinity
15:39:13.733 [main] [WARN ] qupath.lib.scripting.QP - Cannot run object classifier - no names provided!
15:39:13.745 [main] [INFO ] qupath.lib.io.PathIO - Writing object hierarchy with 1128 object(s)...
15:39:13.776 [main] [INFO ] qupath.lib.io.PathIO - Image data written in 0.04 seconds
15:39:13.819 [main] [INFO ] qupath.ScriptCommand - Running script for 2022_02_22__14_20__1786-Extended Depth of Focus-07-Scene-2-ScanRegion1_crop.czi - Scene #1
It looks like you have tried to import a class 'qupath.ext.stardist.StarDist' that doesn't exist!
MultipleCompilationErrorsException at line 11: startup failed:
Script2.groovy: 12: unable to resolve class qupath.ext.stardist.StarDist2D
@ line 12, column 1.
import qupath.ext.stardist.StarDist2D
^

1 error

org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:295)
org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:914)
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627)
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:257)
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngineImpl.java:336)
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:153)
qupath.lib.gui.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:982)
qupath.ScriptCommand.runScript(QuPath.java:432)
qupath.ScriptCommand.run(QuPath.java:319)
picocli.CommandLine.executeUserObject(CommandLine.java:1939)
picocli.CommandLine.access$1300(CommandLine.java:145)
picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
picocli.CommandLine.execute(CommandLine.java:2078)
qupath.QuPath.main(QuPath.java:187)
15:39:14.114 [main] [ERROR] qupath.ScriptCommand - Error running script for image: 2022_02_22__14_20__1786-Extended Depth of Focus-07-Scene-2-ScanRegion1_crop.czi - Scene #1
javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script2.groovy: 12: unable to resolve class qupath.ext.stardist.StarDist2D
@ line 12, column 1.
import qupath.ext.stardist.StarDist2D
^

1 error

    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158)
    at qupath.lib.gui.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:982)
    at qupath.ScriptCommand.runScript(QuPath.java:432)
    at qupath.ScriptCommand.run(QuPath.java:319)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
    at picocli.CommandLine.access$1300(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
    at picocli.CommandLine.execute(CommandLine.java:2078)
    at qupath.QuPath.main(QuPath.java:187)

Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script2.groovy: 12: unable to resolve class qupath.ext.stardist.StarDist2D
@ line 12, column 1.
import qupath.ext.stardist.StarDist2D

This error repeats a bunch of times, sometimes with the "Script2.groovy" section incrementing (although not in all cases). I should add that when I run the same script through the GUI it works just fine. Wondering if there is any way to force the batching to keep my extension path locked in? Open to any other solutions as well.

Thanks,

Mishal

StarDist error when run on annotation not a square

Hello,

StarDist is running fine when I use a square annotation, but when it is no then I get an error.

Best regards,
Stefan

Version:
v0.3.0-rc2

MyScript:
import qupath.ext.stardist.StarDist2D

// Specify the model .pb file (you will need to change this!)
def pathModel = '/Qupath/QP_ET/StarDist_pre/dsb2018_heavy_augment.pb'

def stardist = StarDist2D.builder(pathModel)
        .threshold(0.5)              // Probability (detection) threshold
        .channels('Kerne-DAPI')            // Select detection channel
        .normalizePercentiles(1, 99) // Percentile normalization
        .pixelSize(0.5)              // Resolution for detection
        .cellExpansion(10.0)          // Approximate cells based upon nucleus expansion //Ursprüngl 5.0
        .cellConstrainScale(3.0)     // Constrain cell expansion using nucleus size // Urspr. 1.5
        .measureShape()              // Add shape measurements
        .measureIntensity()          // Add cell measurements (in all compartments)
        .includeProbability(true)    // Add probability as a measurement (enables later filtering)
        .doLog() // Logs, wenn alles läuft weglassen
        .build()

// Run detection for the selected objects
def imageData = getCurrentImageData()
def pathObjects = getSelectedObjects()
if (pathObjects.isEmpty()) {
    Dialogs.showErrorMessage("StarDist", "Please select a parent object!")
    return
}
stardist.detectObjects(imageData, pathObjects)
println 'Done!'

The error is:

INFO: Detecting nuclei for 266 tiles
WARN: Normalization percentiles give the same value (0.0), scale will be Infinity
WARN: Skipped 1 nucleus detection(s) due to error in resolving overlaps (0% of all skipped)
WARN: Normalization percentiles give the same value (0.0), scale will be Infinity
WARN: Skipped 1 nucleus detection(s) due to error in resolving overlaps (0% of all skipped)
WARN: Skipped 1 nucleus detection(s) due to error in resolving overlaps (0% of all skipped)
WARN: Normalization percentiles give the same value (0.0), scale will be Infinity
WARN: Skipped 1 nucleus detection(s) due to error in resolving overlaps (0% of all skipped)
WARN: Skipped 1 nucleus detection(s) due to error in resolving overlaps (0% of all skipped)
WARN: Normalization percentiles give the same value (0.0), scale will be Infinity
ERROR: RuntimeException: OpenCV(4.5.3) D:\a\javacpp-presets\javacpp-presets\opencv\cppbuild\windows-x86_64\opencv-4.5.3\modules\dnn\src\layers\concat_layer.cpp:102: error: (-201:Incorrect size of input array) Inconsistent shape for ConcatLayer in function 'cv::dnn::ConcatLayerImpl::getMemoryShapes'


ERROR: org.bytedeco.opencv.opencv_dnn.Net.forward(Native Method)
    qupath.opencv.dnn.OpenCVDnn$OpenCVNetFunction.predict(OpenCVDnn.java:690)
    qupath.opencv.dnn.OpenCVDnn$OpenCVNetFunction.predict(OpenCVDnn.java:704)
    qupath.opencv.dnn.DnnModel.convertAndPredict(DnnModel.java:100)
    qupath.ext.stardist.StarDist2D.detectObjectsForTile(StarDist2D.java:1020)
    qupath.ext.stardist.StarDist2D.lambda$detectObjects$5(StarDist2D.java:796)
    java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
    java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
    java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(Unknown Source)
    java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(Unknown Source)
    java.base/java.util.stream.AbstractTask.compute(Unknown Source)
    java.base/java.util.concurrent.CountedCompleter.exec(Unknown Source)
    java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
    java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
    java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
    java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
    java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)

image

Detection in a complex ROI might be unreasonably slow

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.