public class ArrayUtil
extends java.lang.Object
| Constructor and Description |
|---|
ArrayUtil(java.util.ArrayList<java.lang.Double> list) |
ArrayUtil(double[] data)
constructeur
|
ArrayUtil(int size)
constructeur
|
ArrayUtil(int[] data) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addValue(int position,
double value)
Addition a value at a index
|
void |
addValueArray(ArrayUtil tabToAdd) |
void |
concat(ArrayUtil tabToAdd)
concat an array to the end
|
double |
convolve(double[] kernel,
double D)
Convolution with a kernel
|
int |
countValue(double val) |
int |
countValueAbove(double val) |
ArrayUtil |
distinctValues()
Array with only distinct values (sorted)
|
void |
divideAll(double value) |
ImagePlus |
drawBar(int scale)
drawing of the array as an image
|
void |
fillRange(int start,
int end,
int step) |
void |
fillValue(double val) |
static double[] |
fitGaussian(double[] values,
double initSD,
int maxR)
Fit a gaussian to the values (radial distribution)
|
void |
fromArrayListDouble(java.util.ArrayList<java.lang.Double> arr) |
void |
fromArrayListInt(java.util.ArrayList<java.lang.Integer> arr) |
double[] |
getArray()
Gets the array attribute of the ArrayUtil object
|
int[] |
getArrayInt() |
java.util.ArrayList<java.lang.Double> |
getArrayList() |
ArrayUtil |
getCopy()
Gets the copy of the ArrayUtil object
|
ArrayUtil |
getDifferenceNext() |
ArrayUtil |
getDifferenceNextAbs() |
int |
getFirstLocalExtrema(double thresholdMax,
double thresholdMin) |
int |
getFirstLocalMaxima(int start,
double threshold) |
int |
getFirstLocalMinima(double threshold) |
ArrayUtil[] |
getHistogram(int nBins) |
ArrayUtil |
getIntegerHistogram() |
double |
getKurtosis()
Kurtosis, order 4
|
int |
getLimitInf(int th)
First encoutered value not zero, starting from th
|
int |
getLimitSup()
Last index whose value is not zero
|
double |
getMaxAbsDifference(ArrayUtil hmean) |
double |
getMaximum()
The maximum value
|
double[] |
getMaximumAbove(double th)
The maximum value
|
double |
getMaximumBelow(double th) |
int |
getMaximumIndex()
The maximum value
|
double[] |
getMaximumStarting(int th) |
double |
getMean()
Average value
|
double |
getMinimum()
The minimum value
|
double |
getMinimumAbove(double th)
Gets the minimum value above a threshold
|
int |
getMinimumIndex() |
double[] |
getMinMax() |
int |
getMode() |
int |
getModeNonZero() |
Plot |
getPlot() |
Plot |
getPlot(java.lang.String title,
java.lang.String xLabel,
java.lang.String yLabel) |
int |
getSize()
Deprecated.
see size()
get the number of elements
|
double |
getSkewness()
skewness, order 3
|
double |
getStdDev()
standard deviation
|
ArrayUtil |
getSubTabUtil(int startIndex,
int newSize)
extract a sub-array from this array
|
double |
getSum()
sum of all elements
|
double |
getValue(int pos)
get value at an index
|
int |
getValueInt(int pos) |
double |
getVariance()
Variance value (not biased)
|
double |
getVariance2()
Variance value (not biased) fast version
|
boolean |
hasOneValue(java.util.ArrayList vals)
One of the values are in the array ?
|
boolean |
hasOneValueInt(java.util.ArrayList vals)
One of the values are in the array ? For int values (does not work if
ArrayList is int and values is double)
|
boolean |
hasOnlyValue(int val)
test if array has only one particular value
|
boolean |
hasOnlyValuesInt(java.util.ArrayList vals)
test if array has only particular values
|
boolean |
hasValue(int val)
The value is in the array ?
|
int |
indexOf(double value) |
int |
indexOfSumPercent(double percent)
Index to get x % of the values
|
void |
insertValues(int pos,
ArrayUtil tmp) |
boolean |
isEmpty() |
boolean |
isEqual(ArrayUtil other)
test if two arrays are identical
|
boolean |
isEqual(ArrayUtil other,
int begin,
int end)
test if two arrays are identical between two indexes
|
boolean |
isMaximum(double val) |
int |
IsoData()
isodata algorithm (for histogram)
|
boolean |
isSorted() |
static int[] |
kMeans_Histogram1D(int[] histogram,
int nbClasses,
int thmin)
COPIED FROM ICY (A.
|
ArrayUtil |
localMean(int rad)
local mean filtering
|
double |
median()
Find median.
|
double |
medianSort()
The median (sorted array)
|
boolean |
putValue(int pos,
double value)
put a value to a index
|
void |
removeValueAt(int index)
remove a value at a position
|
int |
removeValues(double val) |
void |
reverse() |
void |
saveArray(java.lang.String dir,
java.lang.String file,
java.lang.String header) |
void |
setSize(int size)
new size of the array (can incresase size of array)
|
void |
setValues(ArrayUtil tmp)
put values inside an array
|
void |
shuffle()
random mix of the values
|
int |
size() |
void |
sort() |
int[] |
sortIndexShellMeitzner()
Get the indexes of sorted array (Shell-Meitzner algorithm) do not sort
the array
|
void |
sortJava() |
void |
sortMultithread() |
void |
sortShellMeitzner()
Sort the array (Shell-Meitzner algorithm) increasing
|
java.lang.String |
toString()
information to be displayed
|
public ArrayUtil(int size)
size - number of elementspublic ArrayUtil(double[] data)
data - double arraypublic ArrayUtil(int[] data)
public ArrayUtil(java.util.ArrayList<java.lang.Double> list)
public static double[] fitGaussian(double[] values,
double initSD,
int maxR)
values - to fitinitSD - maxR - maximum intervalpublic static int[] kMeans_Histogram1D(int[] histogram,
int nbClasses,
int thmin)
histogram - the histogram to classifynbClasses - the number of classes to extractpublic void fromArrayListInt(java.util.ArrayList<java.lang.Integer> arr)
public void fromArrayListDouble(java.util.ArrayList<java.lang.Double> arr)
public boolean putValue(int pos,
double value)
pos - position in the arrayvalue - value to putpublic double getValue(int pos)
pos - position in the arraypublic int getValueInt(int pos)
public int getSize()
public void setSize(int size)
size - The new size valuepublic int size()
public double[] getArray()
public int[] getArrayInt()
public java.util.ArrayList<java.lang.Double> getArrayList()
public void fillValue(double val)
val - public void fillRange(int start,
int end,
int step)
public double getMaximum()
public double[] getMaximumAbove(double th)
public double[] getMaximumStarting(int th)
public int getMaximumIndex()
public int getFirstLocalMaxima(int start,
double threshold)
public int getFirstLocalMinima(double threshold)
public int getFirstLocalExtrema(double thresholdMax,
double thresholdMin)
public boolean isMaximum(double val)
val - public double getMaximumBelow(double th)
th - public int getLimitSup()
public int getLimitInf(int th)
th - minimum indexpublic double getMinimum()
public int getMinimumIndex()
public double[] getMinMax()
public double getMinimumAbove(double th)
th - the thresholdpublic double getMean()
public double getSum()
public double getStdDev()
public double getSkewness()
public double getKurtosis()
public double getVariance()
public double getVariance2()
public double getMaxAbsDifference(ArrayUtil hmean)
hmean - public int countValue(double val)
public int countValueAbove(double val)
public ArrayUtil distinctValues()
public ArrayUtil localMean(int rad)
rad - radius for filteringpublic boolean addValue(int position,
double value)
position - the position indexvalue - the value to addpublic void divideAll(double value)
value - public boolean isSorted()
public void sortJava()
public void sort()
public void sortMultithread()
public void sortShellMeitzner()
public int[] sortIndexShellMeitzner()
public double medianSort()
public double median()
public double convolve(double[] kernel,
double D)
kernel - the kernelD - the divisorpublic int indexOf(double value)
value - public int indexOfSumPercent(double percent)
percent - percentage(1.0=100; 0.5=50% ...)public boolean hasValue(int val)
val - the valuepublic boolean hasOneValue(java.util.ArrayList vals)
vals - the valuespublic boolean hasOneValueInt(java.util.ArrayList vals)
vals - the valuespublic boolean hasOnlyValue(int val)
val - the valuepublic boolean hasOnlyValuesInt(java.util.ArrayList vals)
vals - the valuepublic int IsoData()
public ImagePlus drawBar(int scale)
scale - scale valuepublic void shuffle()
public void setValues(ArrayUtil tmp)
tmp - the array of values to putpublic void insertValues(int pos,
ArrayUtil tmp)
public boolean isEqual(ArrayUtil other)
other - the other arraypublic boolean isEmpty()
public boolean isEqual(ArrayUtil other, int begin, int end)
other - the other arraybegin - start indexend - end indexpublic ArrayUtil getCopy()
public java.lang.String toString()
toString in class java.lang.Objectpublic void removeValueAt(int index)
index - the position indexpublic int removeValues(double val)
public void addValueArray(ArrayUtil tabToAdd)
tabToAdd - public Plot getPlot()
public Plot getPlot(java.lang.String title,
java.lang.String xLabel,
java.lang.String yLabel)
public void concat(ArrayUtil tabToAdd)
tabToAdd - the array to concatpublic void reverse()
public ArrayUtil getSubTabUtil(int startIndex, int newSize)
startIndex - start indexnewSize - new sizepublic ArrayUtil getDifferenceNext()
public ArrayUtil getDifferenceNextAbs()
public ArrayUtil[] getHistogram(int nBins)
public ArrayUtil getIntegerHistogram()
public int getMode()
public int getModeNonZero()
public void saveArray(java.lang.String dir,
java.lang.String file,
java.lang.String header)