Measurement exporter for TMA cores/image

Hi,
I have two separate projects that require both ‘Image’ and ‘TMA cores’ to be exported via measurment exporter. I understand the substitutions in the below script to import by import qupath.lib.objects.PathCellObject and change the def exportType = PathCellObject.class , but what would I need to change in the below to export ‘Image’ and ‘TMA cores’ via script. Many thanks

import qupath.lib.gui.tools.MeasurementExporter
import qupath.lib.objects.PathCellObject

// Get the list of all images in the current project
def project = getProject()
def imagesToExport = project.getImageList()

// Separate each measurement value in the output file with a tab ("\t")
def separator = ","

// Choose the columns that will be included in the export
// Note: if 'columnsToInclude' is empty, all columns will be included
def columnsToInclude = new String[]{"Image", "TMA core", "Parent", "Name", "Class", "Nucleus: DAB OD mean", "Cell: DAB OD mean"}

// Choose the type of objects that the export will process
// Other possibilities include:
//    1. PathAnnotationObject
//    2. PathDetectionObject
//    3. PathRootObject
// Note: import statements should then be modified accordingly
def exportType = PathCellObject.class

// Choose your *full* output path
def outputPath = "U:/Research/Projects/pathcellmeasurements.tsv"
def outputFile = new File(outputPath)

// Create the measurementExporter and start the export
def exporter  = new MeasurementExporter()
                  .imageList(imagesToExport)            // Images from which measurements will be exported
                  .separator(separator)                 // Character that separates values
                  .includeOnlyColumns(columnsToInclude) // Columns are case-sensitive
                  .exportType(exportType)               // Type of objects to export
                  .exportMeasurements(outputFile)        // Start the export process

print "Done!"

Hi @James_Monkman,

In the case of TMA cores, you can replace the import by:

import qupath.lib.objects.TMACoreObject

and the exportType line by:

def exportType = TMACoreObject.class

In the case of Image, you can replace the import by:

import qupath.lib.objects.PathRootObject

and the exportType line by:

def exportType = PathRootObject.class
2 Likes

On this note, what is the correct command to leave ‘columnsToInclude’ empty such that it exports all columns? def columnsToInclude =

1 Like

comment out that line entirely. or don’t include it.

def exporter  = new MeasurementExporter()
                  .imageList(imagesToExport)            // Images from which measurements will be exported
                  .separator(separator)                 // Character that separates values
                  //.includeOnlyColumns(columnsToInclude) // Columns are case-sensitive
                  .exportType(exportType)               // Type of objects to export
                  .exportMeasurements(outputFile) 
1 Like