Skip to content

Imagimm-CIML/Qupath_DBSCAN

Repository files navigation

DBSCAN using Qupath

DBSCAN_original

1- Create a Qupath project and put the "commons-math3-3.6.1.jar" file inside the main folder

2- Load the calibrated image DBSCAN.tif (drag and drop) and double click on it in the images list :

DBSCAN_calibrated
This image contain 8 spots thar are closer than 100um exept one which is further (around 215um).

3- Make an annotation around all the spots

annotation

4- Detect all the spots in the annotation with Analyse/cell detections (do not create cells detections for that put cell expansion=0)

cell-detection
You should obtain 9 detections : detections
It could be launched in the script by this command : runPlugin('qupath.imagej.detect.cells.WatershedCellDetection', '{"detectionImage":"Channel 1","requestedPixelSizeMicrons":1.0,"backgroundRadiusMicrons":30.0,"backgroundByReconstruction":true, "medianRadiusMicrons":0.0,"sigmaMicrons":1.5,"minAreaMicrons":10.0,"maxAreaMicrons":900.0,"threshold":25.0,"watershedPostProcess":true, "cellExpansionMicrons":0.0,"includeNuclei":true,"smoothBoundaries":true,"makeMeasurements":true}')

5- Create two classes (beads and cluster) : to do that right click and add class

add_class

6- Classify the detected spots as beads (because the groovy script is working only on class detections). To do that go in the menu Classify/Object classification/create single measurtements classifier and put the theshold to the minimum to be sure to select all the spots:

classifier
You can put a classifier name (beads) to save the classifier in the project.
Then you should obtain this:

clssify_beads

7- Launch the script DBSCAN.groovy (drag and drop) on the annotation with the parameter MinPts=3 and distance=100um

script

8- You should obtain one cluster of 8 beads (one is outside the cluster). To classify the cluster beads, go in the menu Classify/Object classification/create single measurtements and look for the measurements cluster:

classify-cluster
You can put a classifier name (cluster) to save the classifier in the project.

9- You can hide the none class (spots that do not belong to cluster) by clicking on spacebar on the None class and change the color of the cluster class by double click on it:

hiden_color

hidden-noneClass

10- To conclude, DBSCAN on Qupath is working perfectly and we find the same results as published with MinPoints =3 (and not MinPoints=4) if we consider the real number of neigbors without counting the central point itself. The border points are belonging to the cluster. You can try on this example the following parameters : MinPoints = 4 with distance=100um, you will find no cluster. With MinPoints = 4 and d=120um, you will find a cluster of 6 points (core = 2 points indicated with the red arrow and border points = 4 points):

qupath_eps=120_MinPts=4

11- To go further : to apply DBSCAN on multiple annotations, load the roi.zip (with name of annotated regions) or draw the annotations in Qupath and apply the groovy script "DBSCAN_loopRegion.groovy" that contain the loop for the regions. The classifier beads and clusters are saved in a folder named classifiers/object_classifiers (with threshold values) and can be reused with the groovy script command :

runObjectClassifier("beads");
runObjectClassifier("cluster");
classifier_json

You can dezip the classifiers.zip to obtain the classifiers and put it in your qupath project

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages