Package qupath.opencv.ml
Class PatchClassifierParams.Builder
java.lang.Object
qupath.opencv.ml.PatchClassifierParams.Builder
- Enclosing class:
PatchClassifierParams
Builder class to create
PatchClassifierParams
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the patch classifier parameters.halo
(int padding) Define a halo that is symmetric in x and y.Define a halo using a padding object.inputChannels
(int... channels) Define the input channels using (zero-based) channel numbers.inputChannels
(String... channels) Define the input channels using channel names.inputChannels
(Collection<? extends ColorTransforms.ColorTransform> channels) Define the input channels from a collection of color transforms.Define the input resolution using a pixel calibration object.inputResolution
(PixelCalibration cal, double downsample) Define the input resolution using a pixel calibration and a scaling factor.outputChannelType
(ImageServerMetadata.ChannelType channelType) Define the channel type for the output.outputClasses
(Map<Integer, PathClass> outputClasses) Define the classifications for the output as a map.outputClasses
(PathClass... outputClasses) Define the classifications for the output as an array.outputClassNames
(String... outputClasses) Define the classifications for the output as an array of classification names.outputClassNames
(Map<Integer, String> outputClasses) Define the classifications for the output as a map with string values.patchSize
(int patchSize) Define the requested square patch size.patchSize
(int patchWidth, int patchHeight) Define the requested patch size.postprocessing
(Collection<? extends ImageOp> postprocessingOps) Define the postprocessing steps from a collection.postprocessing
(ImageOp... postprocessingOps) Define the postprocessing steps from an array.prediction
(DnnModel model, Padding padding, String... outputNames) Define the DNN to be used for prediction, to be applied after preprocessing and before postprocessing.prediction
(ImageOp predictionOp) Define the prediction image op, to be applied after preprocessing and before postprocessing.preprocessing
(Collection<? extends ImageOp> preprocessingOps) Define the preprocessing steps from a collection.preprocessing
(ImageOp... preprocessingOps) Define the preprocessing steps from an array.
-
Method Details
-
inputChannels
Define the input channels using channel names.- Parameters:
channels
- the names of the channels to be used as input- Returns:
- a reference to this builder
- See Also:
-
inputChannels
Define the input channels using (zero-based) channel numbers.- Parameters:
channels
- the indices of the channels to be used as input- Returns:
- a reference to this builder
- See Also:
-
inputChannels
public PatchClassifierParams.Builder inputChannels(Collection<? extends ColorTransforms.ColorTransform> channels) Define the input channels from a collection of color transforms. An ordered collection (e.g. list) should be used, since the iteration order is important.- Parameters:
channels
- the channels to be used as input- Returns:
- a reference to this builder
-
inputResolution
Define the input resolution using a pixel calibration and a scaling factor.- Parameters:
cal
- input calibration; if null, a default calibration will be useddownsample
- scaling factor (1.0 to use the calibration directly)- Returns:
- a reference to this builder
-
inputResolution
Define the input resolution using a pixel calibration object.- Parameters:
cal
- the pixel calibration- Returns:
- a reference to this builder
-
halo
Define a halo that is symmetric in x and y.- Parameters:
padding
- padding value, to be added both before and after rows and columns.- Returns:
- a reference to this builder
- See Also:
-
halo
Define a halo using a padding object.- Parameters:
halo
- padding value, to be added both before and after rows and columns- Returns:
- a reference to this builder
- See Also:
-
patchSize
Define the requested square patch size.- Parameters:
patchSize
- width and height of the patch- Returns:
- a reference to this builder
-
patchSize
Define the requested patch size.- Parameters:
patchWidth
- requested patch widthpatchHeight
- requested patch height- Returns:
- a reference to this builder
-
preprocessing
Define the preprocessing steps from an array. Note that any existing preprocessing steps in the builder will be replaced by those provided here.- Parameters:
preprocessingOps
- the preprocessing operations- Returns:
- a reference to this builder
-
preprocessing
Define the preprocessing steps from a collection. Note that any existing preprocessing steps in the builder will be replaced by those provided here.- Parameters:
preprocessingOps
- the preprocessing operations- Returns:
- a reference to this builder
-
prediction
Define the prediction image op, to be applied after preprocessing and before postprocessing.- Parameters:
predictionOp
- the prediction operations- Returns:
- a reference to this builder
- See Also:
-
prediction
public PatchClassifierParams.Builder prediction(DnnModel model, Padding padding, String... outputNames) Define the DNN to be used for prediction, to be applied after preprocessing and before postprocessing.- Parameters:
model
- the modelpadding
- the paddingoutputNames
- the output names- Returns:
- a reference to this builder
- See Also:
-
postprocessing
Define the postprocessing steps from an array. Note that any existing postprocessing steps in the builder will be replaced by those provided here.- Parameters:
postprocessingOps
- the postprocessing operations- Returns:
- a reference to this builder
-
postprocessing
public PatchClassifierParams.Builder postprocessing(Collection<? extends ImageOp> postprocessingOps) Define the postprocessing steps from a collection. Note that any existing postprocessing steps in the builder will be replaced by those provided here.- Parameters:
postprocessingOps
- the postprocessing operations- Returns:
- a reference to this builder
-
outputChannelType
Define the channel type for the output.- Parameters:
channelType
- the channel type (feature, probability, etc)- Returns:
- a reference to this builder
-
outputClasses
Define the classifications for the output as a map.- Parameters:
outputClasses
- the classifications to be given to output objects- Returns:
- a reference to this builder
- See Also:
-
outputClasses
Define the classifications for the output as an array.- Parameters:
outputClasses
- the classifications to be given to output objects- Returns:
- a reference to this builder
- See Also:
-
outputClassNames
Define the classifications for the output as an array of classification names.- Parameters:
outputClasses
- The output classes- Returns:
- a reference to this builder
- See Also:
-
outputClassNames
Define the classifications for the output as a map with string values.- Parameters:
outputClasses
- a map from integer output to output class names- Returns:
- a reference to this builder
- See Also:
-
build
Build the patch classifier parameters.- Returns:
- a built classifier params object.
-