public final class Utils extends Object
Modifier and Type | Method and Description |
---|---|
static ij.measure.ResultsTable |
confusionMatrix(ij.ImagePlus prediction,
ij.ImagePlus groundtruth,
ArrayList<String> classes,
int[] classIndexToLabel)
Calculate confusion matrix bewtween two label images.
|
static ij.measure.ResultsTable |
confusionMatrix(ij.process.ImageProcessor prediction,
ij.process.ImageProcessor groundtruth,
ArrayList<String> classes,
int[] classIndexToLabel)
Calculate confusion matrix bewtween two label images.
|
static ij.measure.ResultsTable |
confusionMatrix(ij.ImageStack prediction,
ij.ImageStack groundtruth,
ArrayList<String> classes,
int[] classIndexToLabel)
Calculate confusion matrix bewtween two label images.
|
static FindConnectedRegions.Results |
connectedComponents(ij.ImagePlus im,
int adjacency)
Connected components based on Find Connected Regions (from Mark Longair)
|
static FindConnectedRegions.Results |
connectedComponents(ij.ImagePlus im,
int adjacency,
int minSize)
Connected components based on Find Connected Regions (from Mark Longair)
|
static Plot |
createPrecisionRecallPlot(ArrayList<ClassificationStatistics> stats)
Create plot with the precision-recall curve
|
static void |
dilate(ij.process.FloatProcessor fp)
Applies the morphological dilate operator.
|
static void |
erode(ij.process.FloatProcessor fp)
Applies the morphological erode operator.
|
static void |
fill(ij.process.ImageProcessor ip,
int foreground,
int background)
Binary fill
|
static void |
filterSmallObjectsAndHoles(ij.process.FloatProcessor probabilityMap,
double thresholdValue,
int minSize)
Filter small objects and holes at a specific threshold value
|
static ArrayList<Point3f>[] |
getClassCoordinates(ij.ImagePlus labelImage,
ij.ImagePlus mask)
Get the binary class coordinates from a label image (2D image or stack)
|
static ij.process.LUT |
getGoldenAngleLUT()
Create golden angle LUT (starting in red)
|
static double |
getKappa(ClassificationStatistics stats)
Get Kappa statistic
|
static double |
getPrecRecArea(ArrayList<ClassificationStatistics> stats)
Get area under the Precision/Recall curve
|
static double |
getROCArea(ArrayList<ClassificationStatistics> stats)
Calculates the area under the ROC curve as the Wilcoxon-Mann-Whitney statistic.
|
static boolean |
insertImage(ij.ImagePlus src,
ij.ImagePlus dst,
int[] origin)
Insert an image into another one (2D or 3D).
|
static ij.ImagePlus[] |
maxPool(ij.ImagePlus input,
ij.ImagePlus label,
int sizeX,
int sizeY)
Experimental max pooling method.
|
static ij.ImagePlus[] |
maxPoolNoReduction(ij.ImagePlus input,
ij.ImagePlus label,
int sizeX,
int sizeY)
Experimental max pooling method without size reduction.
|
static ij.ImageStack |
normalize(ij.ImageStack inputStack)
Normalize an image stack so it has 0 mean and unit variance
|
static void |
normalize01(ij.process.FloatProcessor fp)
Normalize float image so the pixel are between 0 and 1
|
static void |
plotPrecisionRecall(ArrayList<ClassificationStatistics> stats)
Plot the precision-recall curve
|
static void |
plotROC(ArrayList<ClassificationStatistics> stats)
Plot the Receiver operating characteristic curve
|
static void |
postProcess(ij.process.FloatProcessor probabilityMap,
int smoothIterations,
double threshold,
int minSize,
boolean binarize)
Post-process probability image to get more reasonable objects
at a certain threshold
|
static void |
smooth(ij.process.FloatProcessor fp,
float f1,
float f2,
float f3)
Blurs probability image with a given symmetrically weighted kernel.
|
static ij.process.ByteProcessor |
threshold(ij.process.ImageProcessor ip,
double thresholdValue)
Apply binary threshold to input image
|
public static FindConnectedRegions.Results connectedComponents(ij.ImagePlus im, int adjacency)
im
- input imageadjacency
- number of neighbors to check (4, 8...)public static FindConnectedRegions.Results connectedComponents(ij.ImagePlus im, int adjacency, int minSize)
im
- input imageadjacency
- number of neighbors to check (4, 8...)minSize
- minimum size (in pixels) of the componentspublic static void plotPrecisionRecall(ArrayList<ClassificationStatistics> stats)
stats
- classification statisticspublic static void plotROC(ArrayList<ClassificationStatistics> stats)
stats
- classification statisticspublic static double getPrecRecArea(ArrayList<ClassificationStatistics> stats)
stats
- classification statistics with the ROC curve informationpublic static double getROCArea(ArrayList<ClassificationStatistics> stats)
stats
- classification statistics .public static double getKappa(ClassificationStatistics stats)
stats
- classification statisticspublic static Plot createPrecisionRecallPlot(ArrayList<ClassificationStatistics> stats)
stats
- classification statisticspublic static ij.ImageStack normalize(ij.ImageStack inputStack)
inputStack
- input stackpublic static void smooth(ij.process.FloatProcessor fp, float f1, float f2, float f3)
fp
- probability image to be smoothedf1
- Weight factor for the first pixel.f2
- Weight factor for the mid-pixel.f3
- Weight factor for the last pixel.public static void erode(ij.process.FloatProcessor fp)
fp
- probability image to be eroded.public static void dilate(ij.process.FloatProcessor fp)
fp
- probability image to be dilatedpublic static ij.process.ByteProcessor threshold(ij.process.ImageProcessor ip, double thresholdValue)
ip
- input imagethresholdValue
- threshold value (all pixel above that value will be set to 255, the rest to 0)public static void postProcess(ij.process.FloatProcessor probabilityMap, int smoothIterations, double threshold, int minSize, boolean binarize)
probabilityMap
- probability imagesmoothIterations
- number of smoothing iterationsthreshold
- threshold to useminSize
- minimum object size (in pixels)binarize
- flag to binarize resultspublic static void normalize01(ij.process.FloatProcessor fp)
fp
- input imagepublic static void filterSmallObjectsAndHoles(ij.process.FloatProcessor probabilityMap, double thresholdValue, int minSize)
probabilityMap
- probability imagethresholdValue
- threshold to useminSize
- minimum size of the objects (in pixels)public static void fill(ij.process.ImageProcessor ip, int foreground, int background)
ip
- input imageforeground
- foreground valuebackground
- background valuepublic static ArrayList<Point3f>[] getClassCoordinates(ij.ImagePlus labelImage, ij.ImagePlus mask)
labelImage
- labels (they can be in any format, black = 0)mask
- binary mask to select the pixels to be extractedpublic static ij.ImagePlus[] maxPool(ij.ImagePlus input, ij.ImagePlus label, int sizeX, int sizeY)
input
- input imagelabel
- label imagesizeX
- width of max pooling filtersizeY
- height of max pooling filterpublic static ij.ImagePlus[] maxPoolNoReduction(ij.ImagePlus input, ij.ImagePlus label, int sizeX, int sizeY)
input
- input imagelabel
- label imagesizeX
- width of max pooling filtersizeY
- height of max pooling filterpublic static ij.process.LUT getGoldenAngleLUT()
public static boolean insertImage(ij.ImagePlus src, ij.ImagePlus dst, int[] origin)
src
- source imagedst
- destination imageorigin
- coordinates of the insertion origin in the destination image (zero-based numbering)public static ij.measure.ResultsTable confusionMatrix(ij.process.ImageProcessor prediction, ij.process.ImageProcessor groundtruth, ArrayList<String> classes, int[] classIndexToLabel)
prediction
- predicted labelsgroundtruth
- groundtruth labelsclasses
- list of class namesclassIndexToLabel
- correspondence between class index and label valuespublic static ij.measure.ResultsTable confusionMatrix(ij.ImageStack prediction, ij.ImageStack groundtruth, ArrayList<String> classes, int[] classIndexToLabel)
prediction
- predicted labelsgroundtruth
- groundtruth labelsclasses
- list of class namesclassIndexToLabel
- correspondence between class index and label valuespublic static ij.measure.ResultsTable confusionMatrix(ij.ImagePlus prediction, ij.ImagePlus groundtruth, ArrayList<String> classes, int[] classIndexToLabel)
prediction
- predicted labelsgroundtruth
- groundtruth labelsclasses
- list of class namesclassIndexToLabel
- correspondence between class index and label valuesCopyright © 2015–2021 Fiji. All rights reserved.