Positive Pixel Count not working on specific TMA slides

Hi! I’m running an analysis on TMA slides, however, the batch processing script for positive pixel count doesn’t run on three slides. I had posted on the forum before regarding other images where this was occurring and it was mainly due to the amount of space required to run the analysis. As such, I have checked for that and even attempted to run the script on individual annotations. It hasn’t worked.

I looked at the log info and it says that there is an error running plugin: java.lang.NullPointerException and it’s caused by null and then followed by at qupath.imagej.objects with various lines for one of the images.

I have also tried putting them in their separate projects to see if that changes it and makes it easier to run, however, that does not seem to work.

Thank you!

Hi, you don’t mention what version of QuPath you’re using, but if it’s the current stable release (v0.1.2) then my guess is the issue is this one.

1 Like

Beat me to it by a minute!

I’m using the version 0.1.3 for these analyses since that’s what I’ve used for my other projects and I’d like to keep that consistent. I’ve also set the hematoxylin threshold to -2 since I ran into that problem previously.

Hmmm, the java.lang.NullPointerException could refer to lots of things, I’d need more of the exact error log to make a more educated guess.

I don’t know if this would help, but I have the details under the NullPointerException message:

ERROR: Error running plugin: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at qupath.lib.plugins.AbstractPluginRunner.awaitCompletion(AbstractPluginRunner.java:242)
at qupath.lib.plugins.AbstractPluginRunner.runTasks(AbstractPluginRunner.java:204)
at qupath.lib.plugins.PluginRunnerFX.runTasks(PluginRunnerFX.java:94)
at qupath.lib.plugins.AbstractPlugin.runPlugin(AbstractPlugin.java:134)
at qupath.lib.scripting.QPEx.runPlugin(QPEx.java:266)
at qupath.lib.scripting.QPEx.runPlugin(QPEx.java:286)
at qupath.lib.scripting.QPEx$runPlugin.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:214)
at Script14.run(Script14.groovy:5)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)
at qupath.lib.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:767)
at qupath.lib.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:697)
at qupath.lib.scripting.DefaultScriptEditor.executeScript(DefaultScriptEditor.java:679)
at qupath.lib.scripting.DefaultScriptEditor.access$400(DefaultScriptEditor.java:138)
at qupath.lib.scripting.DefaultScriptEditor$2.run(DefaultScriptEditor.java:1034)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by null at qupath.imagej.images.servers.BufferedImagePlusServer.readImagePlusRegion(BufferedImagePlusServer.java:211)
at qupath.imagej.objects.PathImagePlus.getImage(PathImagePlus.java:167)
at qupath.imagej.objects.PathImagePlus.getImage(PathImagePlus.java:126)
at qupath.imagej.objects.PathImagePlus.getImage(PathImagePlus.java:50)
at qupath.imagej.detect.tissue.PositivePixelCounterIJ$PositivePixelDetector.runDetection(PositivePixelCounterIJ.java:120)
at qupath.lib.plugins.DetectionPluginTools$DetectionRunnable.run(DetectionPluginTools.java:120)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
INFO: Processing complete in 0.25 seconds
INFO: Completed with error java.lang.NullPointerException
qupath.imagej.detect.tissue.PositivePixelCounterIJ {“downsampleFactor”: 1, “gaussianSigmaMicrons”: 1.0, “thresholdStain1”: -2.0, “thresholdStain2”: 0.08, “addSummaryMeasurements”: true, “clearParentMeasurements”: true, “appendDetectionParameters”: false, “legacyMeasurements0.1.2”: false}
INFO: Result: true

I don’t know how to read these messages, so I’m not sure how to interpret them. Sorry about this!

Also, if the error occurs only when running the script, and not when using the GUI command, it would help to see the script.

Here’s the script:

setColorDeconvolutionStains(’{“Name” : “H-DAB default”, “Stain 1” : “Hematoxylin”, “Values 1” : "0.65111 0.70119 0.29049 ", “Stain 2” : “DAB”, “Values 2” : "0.26917 0.56824 0.77759 ", “Background” : " 255 255 255 "}’);
runPlugin(‘qupath.imagej.detect.tissue.PositivePixelCounterIJ’, ‘{“downsampleFactor”: 1, “gaussianSigmaMicrons”: 1.0, “thresholdStain1”: -2.0, “thresholdStain2”: 0.08, “addSummaryMeasurements”: true, “clearParentMeasurements”: true, “appendDetectionParameters”: false, “legacyMeasurements0.1.2”: false}’);

Thanks for all of your help!

*Do you get the same error on those annotations when running it through the GUI? I would assume so, but I just want to lock it down.

I just tried it again to be sure, and I do get the same error!

That seems to be the key bit. QuPath isn’t able to read part of the image… but I’m afraid I don’t know why.

My guess is that it falls at the image boundary, or it’s trying to extract a region that is too small… or too large.

Oh ohhh… I think I might have just run into that line when attempting cell detection on a variety of Vectra images (showed up on maybe 10-15 out of several hundred). I’ll try and track them down a bit later to see if I can be sure. This experiment was also in 0.1.3, but I don’t think I’ve seen it happen in 0.2.0m2 yet. I did a similar couple hundred image run on the same types of images from the same source, but had no errors in the 0.2.0m2 project. I have not tried the same exact images/annotations on each, so I’ll need to find one to test but…

It may be something that isn’t an issue in the newest prerelease. Will be a few hours before I can track things down to check though.

*I had assumed it was an issue with the image, or processing of the image, since it went through several steps before reaching QuPath.

So in this case, there error was caused by trying to interrogate areas that had no pixel values due to missing tiles in the image. If annotation areas overlap into areas where there is no image data, that definitely can cause problems with the various calculations.

IE Pete was right, but the image boundary in this case happens to be right inside of a TMA core.

1 Like

Actually, no, I take that back. I just tried opening it again, and am running into the same error in other cores. In fact, I can’t actually get the pixel classifier to work at all, anywhere, though I had it working earlier on the same image.

Sigh. Jumped. Conclusions.

What about cell detection?

It’s all the same error, can’t read the image plus region.

Looking around more, it seems like some areas are not available at high resolution either. Not sure if something happened in the zipping and unzipping process, or the file is damaged.

Yes, it sounds like perhaps certain image resolutions are unavailable for some tiles. And depending on the parameters of the pixel counter it may be requesting at different resolutions.

I don’t recall if the format is specified, but some (.mrxs, .vsi?) comprise multiple files. If some of these files are present and some are missing/corrupt that might be the explanation for the apparently missing data.

The freaky part is that different times I open the file, I am able to do different things. And different parts of the image are available at higher or lower res.

Sounds mysterious. Not entirely clear to me if the problem is in QuPath or elsewhere, I would need the image file to be able to investigate any further.