ij3d.utils
Class TabUtil

java.lang.Object
  extended by ij3d.utils.TabUtil

public class TabUtil
extends java.lang.Object

classe permettant :
le stockage d'un tableau de float les calculs statistiques sur ce tableau le tri du tableau

Author:
Cedric MESSAOUDI & Thomas BOUDIER

Constructor Summary
TabUtil(float[] data)
          constructeur
TabUtil(int size)
          constructeur
 
Method Summary
 boolean addValue(int position, float value)
          Adds a value at a index
 void concat(TabUtil tabToAdd)
          concat an array to the end
 boolean contient(int val)
          Le tableau contient-il cette valeur
 boolean contientQue(int val)
          test if array has only a particular value
 float convolve(float[] kernel, float D)
          Convolution with a kernel
 TabUtil distinctValues()
           
 void draw(int scale)
          drawing of the array as an image
static double[] fitGaussian(double[] values, int maxR)
           
 float[] getArray()
          Gets the array attribute of the TabUtil object
 TabUtil getCopy()
          Gets the copy attribute of the TabUtil object
 int getLimitInf(int th)
          Gets the index of the first non zero value
 int getLimitSup()
          Dernier indice de valeur non nulle
 float getMaximum()
          recupere la valeur maximum du tableau
 float getMean()
          calcule la moyenne du tableau
 float getMinimum()
          recupere la valeur minimum
 float getMinimumAbove(float th)
          Gets the minimum value above a threshold
 float getSigma()
          calcul l'ecart-type du tableau
 int getSize()
          recupere la taille du tableau
 TabUtil getSubTabUtil(int startindex, int newsize)
          extract a sub-array from this array
 float getSum()
          calcule la somme du tableau
 float getValue(int position)
          recupere la valeur d'une position donnee
 float getVariance()
           
 int indexOfSumPercent(double percent)
          calcul l'index du tableau correspondant au pourcentage donne
il calcule le total des valeurs
ensuite il additionne au fur et a mesure et compare à percent*total
si la somme est superieure il retourne l'index ou il est.
 boolean isEqual(TabUtil other)
          test if two arrays are identical
 boolean isEqual(TabUtil other, int begin, int end)
          test if two arrays are identical between two indexes
 TabUtil lissage(int vois)
          lisse le tableau selon un voisinage (le tableau lui-meme n'est pas modifie)
 float median()
          Find median.
 float median2()
          recupere la valeur mediane du tableau
 void melange()
          random mix of the values
 int moyenneIntermediaire()
          isodata algorithm (for histogram)
 boolean putValue(int position, float value)
          met une valeur a la position donnee
 void putValues(TabUtil tmp)
          put values inside an array
 void removeValueAt(int index)
          remove a value at a position
 void setSize(int size)
          impose une nouvelle taille au tableau
 void sort()
          trie le tableau selon l'algorithme Shell-Meitzner
 int[] sortIndex()
          trie le tableau selon l'algorithme Shell-Meitzner
 java.lang.String toString()
          information to be displayed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TabUtil

public TabUtil(int size)
constructeur

Parameters:
size - taille du tableau

TabUtil

public TabUtil(float[] data)
constructeur

Parameters:
data - tableau de float
Method Detail

putValue

public boolean putValue(int position,
                        float value)
met une valeur a la position donnee

Parameters:
position - position dans le tableau
value - valeur a mettre
Returns:
faux s'il y a une erreur(position n'existant pas)

getValue

public float getValue(int position)
recupere la valeur d'une position donnee

Parameters:
position - position dont on veut recuperer la valeur
Returns:
la valeur de la position

getSize

public int getSize()
recupere la taille du tableau

Returns:
la taille du tableau

getArray

public float[] getArray()
Gets the array attribute of the TabUtil object

Returns:
The array value

setSize

public void setSize(int size)
impose une nouvelle taille au tableau

Parameters:
size - The new size value

getMaximum

public float getMaximum()
recupere la valeur maximum du tableau

Returns:
la valeur maximum contenue dans le tableau

getLimitSup

public int getLimitSup()
Dernier indice de valeur non nulle

Returns:
The limitSup value

getLimitInf

public int getLimitInf(int th)
Gets the index of the first non zero value

Parameters:
th - minimum index
Returns:
The limitInf value

getMinimum

public float getMinimum()
recupere la valeur minimum

Returns:
la valeur minimum contenue dans le tableau

getMinimumAbove

public float getMinimumAbove(float th)
Gets the minimum value above a threshold

Parameters:
th - the threshold
Returns:
The minimumAbove value

getMean

public float getMean()
calcule la moyenne du tableau

Returns:
la moyenne des valeurs du tableau

getSum

public float getSum()
calcule la somme du tableau

Returns:
la somme des valeurs du tableau

getSigma

public float getSigma()
calcul l'ecart-type du tableau

Returns:
l'ecart-type des valeurs du tableau

getVariance

public float getVariance()
Returns:

distinctValues

public TabUtil distinctValues()
Returns:

lissage

public TabUtil lissage(int vois)
lisse le tableau selon un voisinage (le tableau lui-meme n'est pas modifie)

Parameters:
vois - voisinage de lissage
Returns:
un tableau avec les valeurs lissee

addValue

public boolean addValue(int position,
                        float value)
Adds a value at a index

Parameters:
position - the position index
value - the value to add
Returns:
true if position < size

sort

public void sort()
trie le tableau selon l'algorithme Shell-Meitzner


sortIndex

public int[] sortIndex()
trie le tableau selon l'algorithme Shell-Meitzner

Returns:
the sorted index

median2

public float median2()
recupere la valeur mediane du tableau

Returns:
valeur mediane du tableau

median

public float median()
Find median. Modified algorithm according to http://www.geocities.com/zabrodskyvlada/3alg.html Contributed by HeinzKlar. (copied form ij.plugin.filter.rankfilters

Returns:
Median value

convolve

public float convolve(float[] kernel,
                      float D)
Convolution with a kernel

Parameters:
kernel - the kernel
D - the divisor
Returns:
the convolvec value

indexOfSumPercent

public int indexOfSumPercent(double percent)
calcul l'index du tableau correspondant au pourcentage donne
il calcule le total des valeurs
ensuite il additionne au fur et a mesure et compare à percent*total
si la somme est superieure il retourne l'index ou il est.

Parameters:
percent - pourcentage voulu (100%=1.0 ; 50%=0.5....)
Returns:
l'index du tableau correspondant au pourcentage

contient

public boolean contient(int val)
Le tableau contient-il cette valeur

Parameters:
val - valeur
Returns:
contient ou non cette valeur

contientQue

public boolean contientQue(int val)
test if array has only a particular value

Parameters:
val - the value
Returns:
true if only this value inside the array

moyenneIntermediaire

public int moyenneIntermediaire()
isodata algorithm (for histogram)

Returns:
the computed isodata value

draw

public void draw(int scale)
drawing of the array as an image

Parameters:
scale - scale value

melange

public void melange()
random mix of the values


putValues

public void putValues(TabUtil tmp)
put values inside an array

Parameters:
tmp - the array of values to put

isEqual

public boolean isEqual(TabUtil other)
test if two arrays are identical

Parameters:
other - the other array
Returns:
true if arrays are equal

isEqual

public boolean isEqual(TabUtil other,
                       int begin,
                       int end)
test if two arrays are identical between two indexes

Parameters:
other - the other array
begin - start index
end - end index
Returns:
The equal value

getCopy

public TabUtil getCopy()
Gets the copy attribute of the TabUtil object

Returns:
The copy value

toString

public java.lang.String toString()
information to be displayed

Overrides:
toString in class java.lang.Object
Returns:
text

removeValueAt

public void removeValueAt(int index)
remove a value at a position

Parameters:
index - the position index

concat

public void concat(TabUtil tabToAdd)
concat an array to the end

Parameters:
tabToAdd - the array to concat

getSubTabUtil

public TabUtil getSubTabUtil(int startindex,
                             int newsize)
extract a sub-array from this array

Parameters:
startindex - start index
newsize - new size
Returns:
The subTabUtil value

fitGaussian

public static double[] fitGaussian(double[] values,
                                   int maxR)
Parameters:
values -
maxR -
Returns: