qupath/qupath-extension-instanseg

Running instanseg script for whole project

Closed this issue · 2 comments

Hi there,

I have been trying out the new instanseg plugin and it has been working well on my images.
I have been trying to work out a script to run for the whole project as I have quite a few images to do. Running the plugin from Extensions> Instanseg > Run Instanseg works great for 1 image at time. I have been trying to use this script:

qupath.ext.instanseg.core.InstanSeg.builder()
    .modelPath("C:/Users/mckay.m/Desktop/instaseg_test/fluorescence_nuclei_and_cells")
    .device("cpu")
    .inputChannels([ColorTransforms.createChannelExtractor("Target:CD45"), ColorTransforms.createChannelExtractor("Target:dsDNA"), ColorTransforms.createChannelExtractor("Target:MHC_I_(HLA_A_B_C)")])
    .outputChannels()
    .tileDims(1024)
    .interTilePadding(32)
    .nThreads(4)
    .makeMeasurements(true)
    .randomColors(false)
    .build()
    .detectObjects()

and using the Run for project and I get this an output with no detections.
No_detections_instanseg
When I just click Run in automate so for just 1 image I get the correct output:

Detections_instanseg

I have also looked under Workflow > Command History and copied the code from there with the same filepaths and I get the same issue.

I have made sure to have an annotation box around all the images in my test set.

Just wondering what to do.

Otherwise this seems like a super handy tool.

Cheers,

Mike

I have made sure to have an annotation box around all the images in my test set.

You'll also need to make sure that these are selected before running InstanSeg.

Try adding

selectAnnotations()

at the start of your script.

Thankyou very much Pete,

Working great for the whole project

Many thanks :)