edu.mines.jtk.util
Class Clips

java.lang.Object
  extended by edu.mines.jtk.util.Clips

public class Clips
extends java.lang.Object

Clips (clipMin,clipMax) are lower and upper bounds for arrays of values. The name "clips" comes from the way these bounds are used, as when displaying data. Typically, below/above clipMin/clipMax are clipped to these bounds. Clips maintain the bounds, but do not perform the clipping.

The lower bound clipMin must be less than the upper bound clipMax; this restriction is silently enforced by all methods of this class. This means that clips returned may not exactly equal those specified.

This class is most useful when computing clips from percentiles. For example, the bounds clipMin and clipMax may correspond to percMin=1% and percMax=99%, respectively. The default percentiles percMin=0% and percMax=100% correspond to minimum and maximum values.

Clips maintain a reference to an array of values, so that clips can be updated when percentiles are changed. If not using percentiles, because clipMin and clipMax are specified explicitly, then these arrays are ignored.

Version:
2007.01.10
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
Clips(double percMin, double percMax, float[] f)
          Constructs clips for the specified percentiles and array.
Clips(double percMin, double percMax, float[][] f)
          Constructs clips for the specified percentiles and array.
Clips(double percMin, double percMax, float[][][] f)
          Constructs clips for the specified percentiles and array.
Clips(double percMin, double percMax, Float3 f3)
          Constructs clips for the specified percentiles and array.
Clips(float[] f)
          Constructs clips for the specified array.
Clips(float[][] f)
          Constructs clips for the specified array.
Clips(float[][][] f)
          Constructs clips for the specified array.
Clips(Float3 f3)
          Constructs clips for the specified array.
 
Method Summary
 float getClipMax()
          Gets the maximum clip value.
 float getClipMin()
          Gets the minimum clip value.
 float getPercentileMax()
          Gets the maximum percentile.
 float getPercentileMin()
          Gets the minimum percentile.
 void setArray(float[] f)
          Sets the array of values for these clips.
 void setArray(float[][] f)
          Sets the array of values for these clips.
 void setArray(float[][][] f)
          Sets the array of values for these clips.
 void setArray(Float3 f3)
          Sets the array of values for these clips.
 void setClips(double clipMin, double clipMax)
          Sets the clip min and max values explicitly.
 void setPercentiles(double percMin, double percMax)
          Sets the percentiles used to compute clips for this view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Clips

public Clips(float[] f)
Constructs clips for the specified array. Uses default percentiles of 0.0 and 100.0.

Parameters:
f - array of values; by reference, not by copy.

Clips

public Clips(float[][] f)
Constructs clips for the specified array. Uses default percentiles of 0.0 and 100.0.

Parameters:
f - array of values; by reference, not by copy.

Clips

public Clips(float[][][] f)
Constructs clips for the specified array. Uses default percentiles of 0.0 and 100.0.

Parameters:
f - array of values; by reference, not by copy.

Clips

public Clips(Float3 f3)
Constructs clips for the specified array. Uses default percentiles of 0.0 and 100.0.

Parameters:
f3 - abstract 3-D array of values; by reference, not by copy.

Clips

public Clips(double percMin,
             double percMax,
             float[] f)
Constructs clips for the specified percentiles and array. Computation of clips is deferred until they are got.

Parameters:
percMin - the percentile corresponding to clipMin.
percMax - the percentile corresponding to clipMax.
f - array of values; by reference, not by copy.

Clips

public Clips(double percMin,
             double percMax,
             float[][] f)
Constructs clips for the specified percentiles and array. Computation of clips is deferred until they are got.

Parameters:
percMin - the percentile corresponding to clipMin.
percMax - the percentile corresponding to clipMax.
f - array of values; by reference, not by copy.

Clips

public Clips(double percMin,
             double percMax,
             float[][][] f)
Constructs clips for the specified percentiles and array. Computation of clips is deferred until they are got.

Parameters:
percMin - the percentile corresponding to clipMin.
percMax - the percentile corresponding to clipMax.
f - array of values; by reference, not by copy.

Clips

public Clips(double percMin,
             double percMax,
             Float3 f3)
Constructs clips for the specified percentiles and array. Computation of clips is deferred until they are got.

Parameters:
percMin - the percentile corresponding to clipMin.
percMax - the percentile corresponding to clipMax.
f3 - abstract 3-D array of values; by reference, not by copy.
Method Detail

setArray

public void setArray(float[] f)
Sets the array of values for these clips. These values are used only when computing clips from percentiles.

Parameters:
f - array of values; by reference, not by copy.

setArray

public void setArray(float[][] f)
Sets the array of values for these clips. These values are used only when computing clips from percentiles.

Parameters:
f - array of values; by reference, not by copy.

setArray

public void setArray(float[][][] f)
Sets the array of values for these clips. These values are used only when computing clips from percentiles.

Parameters:
f - array of values; by reference, not by copy.

setArray

public void setArray(Float3 f3)
Sets the array of values for these clips. These values are used only when computing clips from percentiles.

Parameters:
f3 - array of values; by reference, not by copy.

setClips

public void setClips(double clipMin,
                     double clipMax)
Sets the clip min and max values explicitly. Calling this method disables the computation of clips from percentiles. Any clip values computed or specified previously will be forgotten.

Parameters:
clipMin - values < clipMin will be clipped to clipMin.
clipMax - values > clipMax will be clipped to clipMax.

getClipMin

public float getClipMin()
Gets the minimum clip value.

Returns:
the minimum clip value.

getClipMax

public float getClipMax()
Gets the maximum clip value.

Returns:
the maximum clip value.

setPercentiles

public void setPercentiles(double percMin,
                           double percMax)
Sets the percentiles used to compute clips for this view. The default percentiles are 0.0 and 100.0, which correspond to the minimum and maximum values in the array of values to be clipped.

Calling this method enables the computation of clips from percentiles. Any clip min and max specified or computed previously will be forgotten.

Clip min and max values can only be computed if an array of values has been specified. If clips were constructed without such an array, then both percentiles and an array of values should be set to enable the use of percentiles.

Parameters:
percMin - the percentile corresponding to clipMin.
percMax - the percentile corresponding to clipMax.

getPercentileMin

public float getPercentileMin()
Gets the minimum percentile.

Returns:
the minimum percentile.

getPercentileMax

public float getPercentileMax()
Gets the maximum percentile.

Returns:
the maximum percentile.