Package qupath.lib.gui.tools
Class MeasurementExporter
java.lang.Object
qupath.lib.gui.tools.MeasurementExporter
Helper class for exporting the measurements of one or more entries in a project.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Constant representing that the number of decimal places to use when exporting measurements can be chosen automatically. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSpecify that detection measurements (only) should be export.Specify that annotation measurements (only) should be export.cells()
Specify that cell measurements (only) should be export.decimalPlaces
(int decimalPlaces) Specify how many decimal places to use for numeric output.excludeColumns
(String... excludeColumns) Specify the columns that will be excluded during the export.void
exportMeasurements
(File file) Exports the measurements of one or more entries in the project.void
exportMeasurements
(OutputStream stream) Exports the measurements of one or more entries in the project.exportType
(Class<? extends PathObject> type) Specify what type of object should be exported.filter
(Predicate<PathObject> filter) Filter thePathObject
s before export (objects returningtrue
for the predicate will be included).Returns the list of columns to exclude from export.Returns the list of images (ProjectImageEntry
).Returns the list of columns to include in the export.Returns the separator used in between measurements.Class
<? extends PathObject> getType()
Returns the type of path objects used in the export.image()
Specify that whole-image measurements (only) should be export.imageList
(List<ProjectImageEntry<BufferedImage>> imageList) Specify the list of images (ProjectImageEntry
) to export.includeOnlyColumns
(String... includeOnlyColumns) Specify the columns that will be included in the export.progressMonitor
(DoubleConsumer monitor) Set a progress monitor to be notified during export.Specify the separator used between measurement values.tiles()
Specify that tile measurements (only) should be export.tmaCores()
Specify that TMA core measurements (only) should be export.
-
Field Details
-
DECIMAL_PLACES_DEFAULT
public static final int DECIMAL_PLACES_DEFAULTConstant representing that the number of decimal places to use when exporting measurements can be chosen automatically.- See Also:
-
-
Constructor Details
-
MeasurementExporter
public MeasurementExporter()
-
-
Method Details
-
decimalPlaces
Specify how many decimal places to use for numeric output. Default value isDECIMAL_PLACES_DEFAULT
, which will adapt the number of decimal places based on the magnitude of the number being export.- Parameters:
decimalPlaces
- the number of decimal places to use- Returns:
- this export
-
exportType
Specify what type of object should be exported. Default: image (root object).- Parameters:
type
- the type of object to export- Returns:
- this exporter
- See Also:
-
annotations
Specify that annotation measurements (only) should be export. This will override any other object type that might previously have been set.- Returns:
- this exporter
- Since:
- v0.6.0
-
allDetections
Specify that detection measurements (only) should be export. This will override any other object type that might previously have been set.- Returns:
- this exporter
- Since:
- v0.6.0
-
image
Specify that whole-image measurements (only) should be export. This will override any other object type that might previously have been set.- Returns:
- this exporter
- Since:
- v0.6.0
-
cells
Specify that cell measurements (only) should be export. This will override any other object type that might previously have been set.- Returns:
- this exporter
- Since:
- v0.6.0
-
tiles
Specify that tile measurements (only) should be export. This will override any other object type that might previously have been set.- Returns:
- this exporter
- Since:
- v0.6.0
-
tmaCores
Specify that TMA core measurements (only) should be export. This will override any other object type that might previously have been set.- Returns:
- this exporter
- Since:
- v0.6.0
-
includeOnlyColumns
Specify the columns that will be included in the export. The column names are case-sensitive.- Parameters:
includeOnlyColumns
- the columns to include; this takes precedence overexcludeColumns(String...)
.- Returns:
- this exporter
- See Also:
-
excludeColumns
Specify the columns that will be excluded during the export. The column names are case-sensitive.- Parameters:
excludeColumns
- the columns to exclude- Returns:
- this exporter
- See Also:
-
separator
Specify the separator used between measurement values. To avoid unexpected behavior, it is recommended to use either tab (\t
), comma (,
) or semicolon (;
).- Parameters:
sep
- the column separator to use- Returns:
- this exporter
-
imageList
Specify the list of images (ProjectImageEntry
) to export.- Parameters:
imageList
- the images to export- Returns:
- this exporter
-
progressMonitor
Set a progress monitor to be notified during export. This is a consumer that takes a value between 0.0 (at the start) and 1.0 (export complete).- Parameters:
monitor
- the optional progress monitor- Returns:
- this exporter
-
filter
Filter thePathObject
s before export (objects returningtrue
for the predicate will be included). This can be used as a secondary filter after the object type, e.g. to select annotations with a specific names, or detections with specific classifications.- Parameters:
filter
- a filter to use to select objects for export- Returns:
- this exporter
- Since:
- v0.3.2
-
getImageList
Returns the list of images (ProjectImageEntry
).- Returns:
- imageList
-
getExcludeColumns
Returns the list of columns to exclude from export.- Returns:
- list of column names
-
getIncludeColumns
Returns the list of columns to include in the export.- Returns:
- list of column names
-
getSeparator
Returns the separator used in between measurements.- Returns:
- separator
-
getType
Returns the type of path objects used in the export.- Returns:
- path object
-
exportMeasurements
Exports the measurements of one or more entries in the project. This function first opens all the images in the project to store all the column names and values of the measurements. Then, it loops through the maps containing the values to write them to the given output file.- Parameters:
file
- the file where the data should be written- Throws:
IOException
- if the export filesInterruptedException
-
exportMeasurements
Exports the measurements of one or more entries in the project. This function first opens all the images in the project to store all the column names and values of the measurements. Then, it loops through the maps containing the values to write them to the given output stream.- Parameters:
stream
- the output stream to write to- Throws:
IOException
- if the export failsInterruptedException
-