public class Util extends Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static double |
computeAverage(double[] values) |
static float |
computeAverage(float[] values) |
static double |
computeAverageDouble(List<Double> values) |
static float |
computeAverageFloat(List<Float> values) |
static float |
computeDistance(int[] position1,
int[] position2) |
static float |
computeLength(int[] position) |
static double |
computeMax(double[] values) |
static float |
computeMaximum(List<Float> values) |
static double |
computeMedian(double[] values) |
static float |
computeMedian(float[] values) |
static long |
computeMedian(long[] values) |
static double |
computeMin(double[] values) |
static float |
computeMinimum(List<Float> values) |
static double |
computePercentile(double[] values,
double percentile)
Computes the percentile of a collection of doubles (percentile 0.5 roughly corresponds to median)
|
static float |
computePercentile(float[] values,
float percentile)
Computes the percentile of a collection of float (percentile 0.5 roughly corresponds to median)
|
static <T extends ExponentialMathType<T>> |
createGaussianKernel1D(T sigma,
boolean normalize)
This method creates a gaussian kernel
|
static double[] |
createGaussianKernel1DDouble(double sigma,
boolean normalize)
This method creates a gaussian kernel
|
static double[] |
createGaussianKernel1DDouble(double sigma,
boolean normalize,
int precision)
This method creates a gaussian kernel
|
static double[] |
getArrayFromValue(double value,
int numDimensions) |
static float[] |
getArrayFromValue(float value,
int numDimensions) |
static int[] |
getArrayFromValue(int value,
int numDimensions) |
static boolean[][] |
getRecursiveCoordinates(int numDimensions) |
static int |
getSuggestedKernelDiameter(double sigma) |
static double |
gLog(double z,
double c) |
static float |
gLog(float z,
float c) |
static double |
gLogInv(double w,
double c) |
static double |
gLogInv(float w,
float c) |
static boolean |
isApproxEqual(double a,
double b,
double threshold) |
static boolean |
isApproxEqual(float a,
float b,
float threshold) |
static double |
log2(double value) |
static <T extends Type<T> & Comparable<T>> |
max(T value1,
T value2) |
static <T extends Type<T> & Comparable<T>> |
min(T value1,
T value2) |
static int |
pow(int a,
int b) |
static String |
printCoordinates(boolean[] value) |
static String |
printCoordinates(float[] value) |
static String |
printCoordinates(int[] value) |
static void |
quicksort(double[] data) |
static void |
quicksort(double[] data,
int[] sortAlso,
int left,
int right) |
static void |
quicksort(double[] data,
int left,
int right) |
static void |
quicksort(float[] data) |
static void |
quicksort(float[] data,
int left,
int right) |
static void |
quicksort(long[] data,
int left,
int right) |
static long |
round(double value) |
static int |
round(float value) |
static void |
setCoordinateRecursive(int dimension,
int numDimensions,
int[] location,
boolean[][] result)
recursively get coordinates covering all binary combinations for the given dimensionality
example for 3d:
x y z index
0 0 0 [0]
1 0 0 [1]
0 1 0 [2]
1 1 0 [3]
0 0 1 [4]
1 0 1 [5]
0 1 1 [6]
1 1 1 [7]
All typical call will look like that:
boolean[][] positions = new boolean[ MathLib.pow( 2, numDimensions ) ][ numDimensions ];
MathLib.setCoordinateRecursive( numDimensions - 1, numDimensions, new int[ numDimensions ], positions );
|
public static double log2(double value)
public static double[] getArrayFromValue(double value, int numDimensions)
public static float[] getArrayFromValue(float value, int numDimensions)
public static int[] getArrayFromValue(int value, int numDimensions)
public static final float computeDistance(int[] position1, int[] position2)
public static final float computeLength(int[] position)
public static long computeMedian(long[] values)
public static double computeMedian(double[] values)
public static double computePercentile(double[] values, double percentile)
values
- - the valuespercentile
- - the percentile [0...1]public static float computePercentile(float[] values, float percentile)
values
- - the valuespercentile
- - the percentile [0...1]public static float computeAverage(float[] values)
public static double computeAverage(double[] values)
public static double computeMin(double[] values)
public static double computeMax(double[] values)
public static float computeMedian(float[] values)
public static void quicksort(long[] data, int left, int right)
public static void quicksort(double[] data)
public static void quicksort(double[] data, int left, int right)
public static void quicksort(float[] data)
public static void quicksort(float[] data, int left, int right)
public static void quicksort(double[] data, int[] sortAlso, int left, int right)
public static double gLog(double z, double c)
public static float gLog(float z, float c)
public static double gLogInv(double w, double c)
public static double gLogInv(float w, float c)
public static boolean isApproxEqual(float a, float b, float threshold)
public static boolean isApproxEqual(double a, double b, double threshold)
public static int round(float value)
public static long round(double value)
public static double[] createGaussianKernel1DDouble(double sigma, boolean normalize, int precision)
sigma
- Standard Derivation of the gaussian functionnormalize
- Normalize integral of gaussian function to 1 or not...public static double[] createGaussianKernel1DDouble(double sigma, boolean normalize)
sigma
- Standard Derivation of the gaussian functionnormalize
- Normalize integral of gaussian function to 1 or not...public static <T extends ExponentialMathType<T>> T[] createGaussianKernel1D(T sigma, boolean normalize)
sigma
- Standard Derivation of the gaussian function in the desired Type
normalize
- Normalize integral of gaussian function to 1 or not...public static int getSuggestedKernelDiameter(double sigma)
public static String printCoordinates(float[] value)
public static String printCoordinates(int[] value)
public static String printCoordinates(boolean[] value)
public static int pow(int a, int b)
public static <T extends Type<T> & Comparable<T>> T max(T value1, T value2)
public static <T extends Type<T> & Comparable<T>> T min(T value1, T value2)
public static boolean[][] getRecursiveCoordinates(int numDimensions)
public static void setCoordinateRecursive(int dimension, int numDimensions, int[] location, boolean[][] result)
dimension
- - recusively changed current dimension, init with numDimensions - 1numDimensions
- - the number of dimensionslocation
- - recursively changed current state, init with new int[ numDimensions ]result
- - where the result will be stored when finished, needes a boolean[ MathLib.pow( 2, numDimensions ) ][ numDimensions ]Copyright © 2015–2021 Fiji. All rights reserved.