Script Update measurements

Hi all,

sorry if repeating.
I run in QuPath the Subcellular detection.
Worked well except some small areas where I had to remove manually some spots.
I ve seen there is a script to update the measurements… Just I can t make it work (don t understand very well how scripts work sorry)

// Make sure to update the hierarchy

Do I have to specify something within the ()?
Can you guide me through even if things are common knowledge for you?

I don’t believe there is a quick one line way to change those measurements. Detection measurements are fixed, so deleting subcellular detections will, as you noticed, have no effect on the Num spots estimated. The best way I have found to deal with sub-sets of subcellular detections is to recalculate the value, or probably more appropriately, create a new value. There are a collection of scripts here to deal with creating your own measurements. The most applicable might be the last one, which you could edit to add areas rather than area*intensity, or something like this:

    totalArea = 0
    subcells = it.getChildObjects()
    subcells.each{ s-> totalArea+= s.getMeasurementList().getMeasurementValue("Num spots")}
    it.getMeasurementList().putMeasurement("NewSpots Channel X", totalArea)

Note, “spots” are kind of weird at times and can be different than area if you have a “Max spot size” larger than your expected spot size. If you sum up the “Area” measurements you will not always get the same value as summing up the Num spots.

As a note, this is only written for one channel! If you have multiple channels with subcellular detections, you will need to split them apart by class.