Package qupath.lib.images.servers
Class LabeledImageServer.Builder
java.lang.Object
qupath.lib.images.servers.LabeledImageServer.Builder
- Enclosing class:
LabeledImageServer
Helper class for building a
LabeledImageServer
.-
Constructor Summary
ConstructorDescriptionBuilder
(ImageData<BufferedImage> imageData) Create a Builder for aLabeledImageServer
for the specifiedImageData
. -
Method Summary
Modifier and TypeMethodDescriptionAdd a single label by classname, where the label represents the integer label used for annotations with the given classname.Add a single label by classname, where the label represents the integer label used for annotations with the given classname.Add a single label byPathClass
, where the label represents the integer label used for annotations with the given classification.Add a single label byPathClass
, where the label represents the integer label used for annotations with the given classification.Add multiple labels by PathClass, where the key represents a PathClass and the value represents the integer label that should be used for annotations of the given class.addLabelsByName
(Map<String, Integer> labelMap) Add multiple labels by classname, where the key represents a classname and the value represents the integer label that should be used for annotations of the given class.addUnclassifiedLabel
(int label) Add a single label for objects that are unclassified, where the label represents the integer label used for annotations that have no classification set.addUnclassifiedLabel
(int label, Integer color) Add a single label for objects that are unclassified, where the label represents the integer label used for annotations that have no classification set.backgroundLabel
(int label) Specify the background label (0 by default).backgroundLabel
(int label, Integer color) Specify the background label (0 by default) and color.build()
Build theImageServer
with the requested parameters.downsample
(double downsample) Specify downsample factor.Use grayscale LUT, rather than deriving colors from classifications.grayscale
(boolean grayscaleLut) Optionally use grayscale LUT, rather than deriving colors from classifications.lineThickness
(float thickness) Thickness of boundary lines and line annotations, defined in terms of pixels at the resolution specified by the downsample value of the server.maxOutputChannelLimit
(int maxChannels) Specify the maximum number of output channels allowed before QuPath will throw an exception.multichannelOutput
(boolean doMultichannel) If true, the output image consists of multiple binary images concatenated as different channels, so that the channel number relates to a classification.setBoundaryLabel
(String pathClassName, int label) Set the classification and label to use for boundaries for classified areas.setBoundaryLabel
(String pathClassName, int label, Integer color) Set the classification and label to use for boundaries for classified areas.setBoundaryLabel
(PathClass pathClass, int label) Set the classification and label to use for boundaries for classified areas.setBoundaryLabel
(PathClass pathClass, int label, Integer color) Set the classification and label to use for boundaries for classified areas.shuffleInstanceLabels
(boolean doShuffle) Optionally request that instance labels are shuffled.tileSize
(int tileSize) Set tile width and height (square tiles).tileSize
(int tileWidth, int tileHeight) Set tile width and height.Use annotations for labels.Use cells rather than annotations for labels, requesting the nucleus ROI where available.useCells()
Use cells rather than annotations for labels.Use detections rather than annotations for labels.useFilter
(Predicate<PathObject> filter) Use a custom method of selecting objects for inclusion.Request that unique labels are used for all objects, rather than classifications.useInstanceLabels
(boolean instanceLabels) Optionally request that unique labels are used for all objects, rather than classifications.Deprecated.
-
Constructor Details
-
Builder
Create a Builder for aLabeledImageServer
for the specifiedImageData
.- Parameters:
imageData
-
-
-
Method Details
-
useDetections
Use detections rather than annotations for labels. The default is to use annotations.- Returns:
- See Also:
-
useCells
Use cells rather than annotations for labels. The default is to use annotations.- Returns:
- See Also:
-
useCellNuclei
Use cells rather than annotations for labels, requesting the nucleus ROI where available. The default is to use annotations.- Returns:
- See Also:
-
useAnnotations
Use annotations for labels. This is the default.- Returns:
- See Also:
-
useFilter
Use a custom method of selecting objects for inclusion. The default is to use annotations.- Parameters:
filter
- the filter that determines whether an object will be included or not- Returns:
- See Also:
-
grayscale
Use grayscale LUT, rather than deriving colors from classifications. This can streamline import in software that automatically converts paletted images to RGB.- Returns:
- Since:
- v0.4.0
- See Also:
-
grayscale
Optionally use grayscale LUT, rather than deriving colors from classifications. This can streamline import in software that automatically converts paletted images to RGB.- Parameters:
grayscaleLut
-- Returns:
- Since:
- v0.4.0
- See Also:
-
downsample
Specify downsample factor. This is very important because it defines the resolution at which shapes will be drawn and the line thickness is determined.- Parameters:
downsample
-- Returns:
-
tileSize
Set tile width and height (square tiles).- Parameters:
tileSize
-- Returns:
-
tileSize
Set tile width and height.- Parameters:
tileWidth
-tileHeight
-- Returns:
-
lineThickness
Thickness of boundary lines and line annotations, defined in terms of pixels at the resolution specified by the downsample value of the server.- Parameters:
thickness
-- Returns:
-
useUniqueLabels
Deprecated.in favor ofuseInstanceLabels()
- Returns:
-
useInstanceLabels
Request that unique labels are used for all objects, rather than classifications. If this flag is set, all other label requests are ignored.- Returns:
- See Also:
-
useInstanceLabels
Optionally request that unique labels are used for all objects, rather than classifications. If this flag is set, all other label requests are ignored.- Parameters:
instanceLabels
-- Returns:
- Since:
- v0.4.0
- See Also:
-
shuffleInstanceLabels
Optionally request that instance labels are shuffled. Default is true. Only has an effect ifuseInstanceLabels(boolean)
is called withtrue
.- Parameters:
doShuffle
-- Returns:
- Since:
- v0.4.0
- See Also:
-
multichannelOutput
If true, the output image consists of multiple binary images concatenated as different channels, so that the channel number relates to a classification. If false, the output image is a single-channel indexed image so that each pixel value relates to a classification. Indexed images are much more efficient, but are unable to support more than one classification per pixel.- Parameters:
doMultichannel
-- Returns:
-
backgroundLabel
Specify the background label (0 by default).- Parameters:
label
-- Returns:
-
backgroundLabel
Specify the background label (0 by default) and color.- Parameters:
label
-color
-- Returns:
-
addLabelsByName
Add multiple labels by classname, where the key represents a classname and the value represents the integer label that should be used for annotations of the given class.- Parameters:
labelMap
-- Returns:
-
addLabels
Add multiple labels by PathClass, where the key represents a PathClass and the value represents the integer label that should be used for annotations of the given class.- Parameters:
labelMap
-- Returns:
-
addLabel
Add a single label by classname, where the label represents the integer label used for annotations with the given classname.- Parameters:
pathClassName
-label
-- Returns:
-
addLabel
Add a single label by classname, where the label represents the integer label used for annotations with the given classname.- Parameters:
pathClassName
-label
- the indexed image pixel value or channel number for the given classificationcolor
- the color of the lookup table used with any indexed image- Returns:
-
addLabel
Add a single label byPathClass
, where the label represents the integer label used for annotations with the given classification.- Parameters:
pathClass
-label
- the indexed image pixel value or channel number for the given classification- Returns:
-
addLabel
Add a single label byPathClass
, where the label represents the integer label used for annotations with the given classification.- Parameters:
pathClass
-label
- the indexed image pixel value or channel number for the given classificationcolor
- the color of the lookup table used with any indexed image- Returns:
-
addUnclassifiedLabel
Add a single label for objects that are unclassified, where the label represents the integer label used for annotations that have no classification set.- Parameters:
label
- the indexed image pixel value or channel number without a classificationcolor
- the color of the lookup table used with any indexed image- Returns:
-
addUnclassifiedLabel
Add a single label for objects that are unclassified, where the label represents the integer label used for annotations that have no classification set.- Parameters:
label
- the indexed image pixel value or channel number without a classification- Returns:
-
setBoundaryLabel
Set the classification and label to use for boundaries for classified areas.- Parameters:
pathClass
-label
- the indexed image pixel value or channel number for the given classification- Returns:
-
setBoundaryLabel
Set the classification and label to use for boundaries for classified areas.- Parameters:
pathClass
-label
- the indexed image pixel value or channel number for the given classificationcolor
- the color of the lookup table used with any indexed image- Returns:
-
setBoundaryLabel
Set the classification and label to use for boundaries for classified areas.- Parameters:
pathClassName
-label
- the indexed image pixel value or channel number for the given classification- Returns:
-
setBoundaryLabel
Set the classification and label to use for boundaries for classified areas.- Parameters:
pathClassName
-label
- the indexed image pixel value or channel number for the given classificationcolor
- the color of the lookup table used with any indexed image- Returns:
-
maxOutputChannelLimit
Specify the maximum number of output channels allowed before QuPath will throw an exception. This is used to guard against inadvertently requesting a labelled image that would have an infeasibly large number of output channels, most commonly withuseInstanceLabels()
.- Parameters:
maxChannels
- the maximum supported channels; set (cautiously!) ≤ 0 to ignore the limit entirely.- Returns:
-
build
Build theImageServer
with the requested parameters.- Returns:
-
useInstanceLabels()