Stardist QuPath - Cell Segmentation Transfer on Aligned Image Set

Stardist is amazing in QuPath so far and thanks for everybody implementing it into QuPath.

I have a quick question regarding adding measurements onto the cells stained with STARDIST;

I have sets of 10 tiff images from the same slides stained with different markers (MICSSS method). Every 10 image belonging to same section are aligned perfectly and put into a project in QuPath.
Problem; I segmented one of them with STARDIST nuclear+cell expansion with only shape measurements. I transfered all the segmented objects to the other tif images however when I try to add intensity features on the other images, QuPath does not give me measurements for cytoplasm, total cellular area and others which I can have with original STARDIST script. Can anyone help me with this problem?

Creative use of Add Intensity Features gets you most of the information per image (or per deconvolved vector set). It is easier now than in 1.2 since you can add measurements for the Nucleus alone, and for the whole Cell. To get the cytoplasmic measurements you need to subtract the mean intensities weighted by the areas, per marker.

Thanks for your answer! It’s a great idea to use it in that way. Whole cell measurement is called ROI in add intensity features section, right?

Is it possible to use STARDIST implementation of measurement calculation on transferred segmentations since they are very detailed and includes more than just mean value?

1 Like

That is something I am planning on looking into soon, and Pete reminded me that the code existed very recently:


But I have not actually tried to use it yet.

Thanks to @petebankhead for providing these bits of codes and thanks @Research_Associate for showing the thread to me. It worked perfectly!

// Thanks to Pete and Mike
import qupath.lib.analysis.features.ObjectMeasurements
import qupath.lib.images.servers.TransformedServerBuilder

def imageData = getCurrentImageData()
def server = new TransformedServerBuilder(imageData.getServer())
    .deconvolveStains(imageData.getColorDeconvolutionStains())
    .build()
    
def measurements = ObjectMeasurements.Measurements.values() as List
def compartments = ObjectMeasurements.Compartments.values() as List // Won't mean much if they aren't cells...
def downsample = 1.0
for (detection in getDetectionObjects()) {
  ObjectMeasurements.addIntensityMeasurements(
      server, detection, downsample, measurements, compartments
      )
}