Class TileExporter
- Author:
- Pete Bankhead
-
Constructor Summary
ConstructorDescriptionTileExporter
(ImageData<BufferedImage> imageData) Create a builder to export tiles. -
Method Summary
Modifier and TypeMethodDescriptionannotatedCentroidTilesOnly
(boolean annotatedCentroidTilesOnly) Specify whether tiles without any annotations over the tile centroid should be included.annotatedTilesOnly
(boolean annotatedTilesOnly) Specify whether tiles that do not overlap with any annotations should be included.channels
(int... channels) Export only specified channels.Export only specified channels, identified by name.downsample
(double downsample) Define resolution as a downsample value.exportJson
(boolean exportJson) Optionally export a JSON file that includes label information and image/label pairs, where available.Specify that a single tile should be generated corresponding to the full image.imageExtension
(String ext) Specify a file extension for the original pixels, which determines the export file format.imageSubDir
(String subdir) Specify a subdirectory within which image tiles should be saved.includePartialTiles
(boolean includePartialTiles) Specify whether incomplete tiles at image boundaries should be included.Specify a file extension for the labelled image, which determines the export file format.labeledImageId
(String labelId) Specify an identifier appended to the filename for labeled images.labeledImageSubDir
(String subdir) Specify a subdirectory within which labeled image tiles should be saved.labeledServer
(ImageServer<BufferedImage> server) Optional server providing image labels.overlap
(int overlap) Define tile overlap (both x and y) in pixel units at the export resolution.overlap
(int overlapX, int overlapY) Define tile overlap (x and y separately) in pixel units at the export resolution.parentObjects
(Collection<? extends PathObject> parentObjects) Specify parent objects to define tiles.parentObjects
(Predicate<PathObject> filter) Specify a filter to extract parent objects to define tiles.region
(ImageRegion region) Define the region to be processed.region
(RegionRequest region) Define the region to be processed, including downsample.requestedPixelSize
(double pixelSize) Define resolution as a pixel size in calibrated units.tileSize
(int tileSize) Define the tile size in pixel units at the export resolution.tileSize
(int tileWidth, int tileHeight) Define the horizontal and vertical tile size in pixel units at the export resolution.tRange
(int minT, int maxT) Define the range of timepoints to process.useROIBounds
(boolean fullROIs) Optionally use the full ROI for parent objects, rather thantileSize(int, int)
.void
writeTiles
(String dirOutput) Export the image tiles to the specified directory.zRange
(int minZ, int maxZ) Define the range of Z-slices to process.
-
Constructor Details
-
TileExporter
Create a builder to export tiles.- Parameters:
imageData
-
-
-
Method Details
-
parentObjects
Specify a filter to extract parent objects to define tiles. Tiles are either generated based upon the ROI centroid (in which case the specified tile size is respected) or the ROI bounding box (with the specified tile size ignored).- Parameters:
filter
-- Returns:
- this exporter
- See Also:
-
parentObjects
Specify parent objects to define tiles. Tiles are either generated based upon the ROI centroid (in which case the specified tile size is respected) or the ROI bounding box (with the specified tile size ignored).- Parameters:
parentObjects
-- Returns:
- this exporter
- See Also:
-
useROIBounds
Optionally use the full ROI for parent objects, rather thantileSize(int, int)
.- Parameters:
fullROIs
- if true, use the bounding box of the ROI- Returns:
- this exporter
- See Also:
-
fullImageTile
Specify that a single tile should be generated corresponding to the full image.- Returns:
- this exporter
-
tileSize
Define the tile size in pixel units at the export resolution.- Parameters:
tileSize
-- Returns:
- this exporter
-
tileSize
Define the horizontal and vertical tile size in pixel units at the export resolution.- Parameters:
tileWidth
-tileHeight
-- Returns:
- this exporter
-
channels
Export only specified channels.Note: currently, this always involved conversion to 32-bit. This behavior may change in a future version of QuPath to preserve image type.
- Parameters:
channels
- channels to export (0-based indexing)- Returns:
- this exporter
-
channels
Export only specified channels, identified by name.Note: currently, this always involved conversion to 32-bit. This behavior may change in a future version of QuPath to preserve image type.
- Parameters:
channelNames
- channels to export- Returns:
- this exporter
-
overlap
Define tile overlap (both x and y) in pixel units at the export resolution. This is ignored if 'parentObjects' are specified.- Parameters:
overlap
-- Returns:
- this exporter
-
overlap
Define tile overlap (x and y separately) in pixel units at the export resolution. This is ignored if 'parentObjects' are specified.- Parameters:
overlapX
-overlapY
-- Returns:
- this exporter
-
downsample
Define resolution as a downsample value.- Parameters:
downsample
-- Returns:
- this exporter
- See Also:
-
requestedPixelSize
Define resolution as a pixel size in calibrated units. The actual units depend upon those stored within the server.- Parameters:
pixelSize
-- Returns:
- this exporter
-
includePartialTiles
Specify whether incomplete tiles at image boundaries should be included.If true, then when tiling the entire image some tiles may not have the specified tile width or height, or alternatively when creating tiles based upon object centroids then some zero-padding may be required to ensure the center is preserved along with the tile dimensions. Default is false.
- Parameters:
includePartialTiles
-- Returns:
- this exporter
- See Also:
-
region
Define the region to be processed, including downsample. Default is the full image.- Parameters:
region
-- Returns:
- this exporter
- See Also:
-
region
Define the region to be processed. Default is the full image.- Parameters:
region
-- Returns:
- this exporter
- See Also:
-
zRange
Define the range of Z-slices to process. Default is all Z-slices (0 to nZSlices).Note: the range is from
minZ
(included) tomaxZ
(excluded). -1 can be used formaxZ
to process all Z-slices without having to indicate the exact max number.- Parameters:
minZ
- the lower value (included)maxZ
- the higher value (excluded)- Returns:
- this exporter
-
tRange
Define the range of timepoints to process. Default is all timepoints (0 to nTimepoints).Note: the range is from
minT
(included) tomaxT
(excluded). -1 can be used formaxT
to process all timepoints without having to indicate the exact max number.- Parameters:
minT
- the lower value (included)maxT
- the higher value (excluded)- Returns:
- this exporter
-
annotatedTilesOnly
Specify whether tiles that do not overlap with any annotations should be included. This is a weaker criterion thanannotatedCentroidTilesOnly(boolean)
.Default is false.
- Parameters:
annotatedTilesOnly
-- Returns:
- this exporter
- See Also:
-
annotatedCentroidTilesOnly
Specify whether tiles without any annotations over the tile centroid should be included. This is a stronger criterion thanannotatedTilesOnly(boolean)
, i.e. it will exclude more tiles.Default is false.
- Parameters:
annotatedCentroidTilesOnly
-- Returns:
- this exporter
- See Also:
-
imageExtension
Specify a file extension for the original pixels, which determines the export file format.- Parameters:
ext
-- Returns:
- this exporter
-
labeledImageExtension
Specify a file extension for the labelled image, which determines the export file format.- Parameters:
ext
-- Returns:
- this exporter
-
labeledServer
Optional server providing image labels. These may be export as corresponding images alongside the 'original' pixels, e.g. to create training data for an AI algorithm.- Parameters:
server
- the labeled server- Returns:
- this exporter
-
imageSubDir
Specify a subdirectory within which image tiles should be saved. By default, tiles are written to the directory specified withinwriteTiles(String)
. This option makes it possible to split images and labels into separate subdirectories.- Parameters:
subdir
-- Returns:
- this exporter
-
labeledImageSubDir
Specify a subdirectory within which labeled image tiles should be saved. By default, tile labels are written to the directory specified withinwriteTiles(String)
. This option makes it possible to split images and labels into separate subdirectories.Only relevant if
labeledServer(ImageServer)
is provided.- Parameters:
subdir
-- Returns:
- this exporter
-
labeledImageId
Specify an identifier appended to the filename for labeled images. The labeled image name will be in the formatimageName + labeledImageId + labeledImageExtension
.This can be used to avoid name clashes with export image tiles. If not specified, QuPath will generate a default ID if required.
Only relevant if
labeledServer(ImageServer)
is provided.- Parameters:
labelId
-- Returns:
- this exporter
-
exportJson
Optionally export a JSON file that includes label information and image/label pairs, where available.- Parameters:
exportJson
-- Returns:
- this exporter
-
writeTiles
Export the image tiles to the specified directory.- Parameters:
dirOutput
- full path to the export directory- Throws:
IOException
- if an error occurs during export
-