import javafx.application.Platform
import javafx.stage.Stage
import qupath.lib.gui.tma.QuPathTMAViewer
Platform.runLater {
def stage = new Stage()
QuPathTMAViewer.launch(QuPathTMAViewer.class, stage)
}
ERROR: QuPath exception
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1503)
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1489)
at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at Script72$_run_closure1.doCall(Script72.groovy:8)
at Script72$_run_closure1.doCall(Script72.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:408)
at groovy.lang.Closure.run(Closure.java:495)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Platform.runLater {
QuPathGUI qupath = QuPathGUI.getInstance()
Stage stage = new Stage()
if (qupath != null)
stage.initOwner(qupath.getStage())
TMASummaryViewer tmaViewer = new TMASummaryViewer(stage)
ImageData<BufferedImage> imageData = qupath.getImageData()
if (imageData != null && imageData.getHierarchy().getTMAGrid() != null)
tmaViewer.setTMAEntriesFromImageData(imageData)
tmaViewer.getStage().show();
}guiscript=true
new qupath.lib.gui.commands.TMAViewerCommand().run()guiscript = true
import javafx.application.Platform
import javafx.stage.Stage
import qupath.lib.gui.QuPathGUI
import qupath.lib.gui.commands.TMAViewerCommand
import qupath.lib.gui.tma.TMASummaryViewer
import qupath.lib.scripting.QP
import java.awt.image.BufferedImage
import qupath.lib.images.ImageData
//Fetches image data, sets to Brightfield (other) and estimates stains if not set already
imageData = QP.getCurrentImageData()
if(imageData.getImageType() != 'Brightfield (other)') {
setImageType('BRIGHTFIELD_OTHER')
setColorDeconvolutionStains('{"Name" : "H-DAB default", "Stain 1" : "Hematoxylin", "Values 1" : "0.5121 0.72726 0.45699 ", "Stain 2" : "DAB", "Values 2" : "0.30699 0.56046 0.76918 ", "Stain 3" : "Residual", "Values 3" : "0.11966 0.77495 0.62059 ", "Background" : " 255 255 255 "}');
}
//Dearrays TMA Cores
//Note: It is reccomended to manually set/inspect/correct the TMA cores, but if it has not been done already, it will approximate where they are
if (!isTMADearrayed()) {
runPlugin('qupath.imagej.detect.dearray.TMADearrayerPluginIJ', '{"coreDiameterMM": 0.7, "labelsHorizontal": "1-32", "labelsVertical": "A-Z", "labelOrder": "Row first", "densityThreshold": 35, "boundsScale": 105}')
}
selectTMACores()
//Nucles detections + smooths features for less noise
runPlugin('qupath.imagej.detect.nuclei.WatershedCellDetection', '{"detectionImageBrightfield": "Hematoxylin OD", "requestedPixelSizeMicrons": 0.5, "backgroundRadiusMicrons": 16.0, "medianRadiusMicrons": 1.5, "sigmaMicrons": 1.5, "minAreaMicrons": 10.0, "maxAreaMicrons": 400.0, "threshold": 0.1, "maxBackground": 2.0, "watershedPostProcess": true, "excludeDAB": false, "cellExpansionMicrons": 6.5, "includeNuclei": true, "smoothBoundaries": true, "makeMeasurements": true}');
runPlugin('qupath.lib.plugins.objects.SmoothFeaturesPlugin', '{"fwhmMicrons": 15.0, "smoothWithinClasses": false, "useLegacyNames": false}')
runPlugin('qupath.lib.plugins.objects.SmoothFeaturesPlugin', '{"fwhmMicrons": 50.0, "smoothWithinClasses": false, "useLegacyNames": false}')
//Run classifier stored in project directory
runClassifier(getProjectBaseDirectory() + '\\classifiers\\CD8+CK TIL count (epithelium only).qpclassifier')
//Counting + Sorting positive versus negative tumor
tumorClass = getPathClass("Tumor")
nTumor = 0
nPositive = 0
for (detection in getDetectionObjects()) {
pathClass = detection.getPathClass()
if (tumorClass.isAncestorOf(pathClass)) {
nTumor++
if(pathClass.toString() == "Tumor: Positive") {
nPositive++
}
}
}
//Calculate percentage of tumor positive for CD8
percentagePos = (nPositive / nTumor) * 100
//ASCII Readout of total percent positive
print('\t\t --------------------------------------- ')
print('')
print("\t\t\t AVG CD8 TIL percentage: " + percentagePos + '%\t')
print('')
print('\t\t --------------------------------------- ')
//Launches TMA Summary Viewer
//new qupath.lib.gui.commands.TMAViewerCommand().run()
Platform.runLater {
Stage stage = new Stage()
QuPathGUI qupath = QuPathGUI.getInstance()
if (qupath != null)
stage.initOwner(qupath.getStage())
TMASummaryViewer tmaViewer = new TMASummaryViewer(stage)
ImageData<BufferedImage> imageData = qupath.getImageData()
if (imageData != null && imageData.getHierarchy().getTMAGrid() != null)
tmaViewer.setTMAEntriesFromImageData(imageData)
tmaViewer.getStage().show()
}