Package gov.nih.mipav.model.structures
Class TransferFunction
java.lang.Object
gov.nih.mipav.model.structures.ModelSerialCloneable
gov.nih.mipav.model.structures.TransferFunction
- All Implemented Interfaces:
Serializable,Cloneable
Title: TransferFunction
Description:
Simple class to hold an array of points that describe a transfer function.
- Version:
- 1.0
- Author:
- not attributable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe total capacity of the 2D point array.private intPoints to the next available storage location for the point.private WildMagic.LibFoundation.Mathematics.Vector2f[]The array of 2D points that define the line.private static final longUse serialVersionUID for interoperability.private float[]The array of pre-calculated slope values. -
Constructor Summary
ConstructorsConstructorDescriptionSimple class to hold an array of points that describe a transfer function.TransferFunction(TransferFunction kTransfer) Copies the object that extends this class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPoint(float x, float y) Adds a point to the function at the end.voidaddPoint(WildMagic.LibFoundation.Mathematics.Vector2f pt) Adds a point to the function at the end.private voidChecks the size of the point array to make sure it is big enough.clone()Copies the object that extends this class.voidexportArrays(float[] x, float[] y) Exports the float arrays of the points of the curve.protected voidfinalize()Cleans up memory.WildMagic.LibFoundation.Mathematics.Vector2f[]Gets the points that describe the function.WildMagic.LibFoundation.Mathematics.Vector2fgetPoint(int index) Get the point at the specified index.final floatgetRemappedValue(float inputValue, int height) Method to remapped a value using the transfer function.voidimportArrays(float[] x, float[] y, int n) Import points into the contour.voidinsertPoint(float x, float y, int index) Inserts a point to the transfer function at the specified index.voidinsertPoint(WildMagic.LibFoundation.Mathematics.Vector2f pt, int index) Inserts a point to the transfer function at the specified index.booleanisEndpoint(int index) Decides whether parameter 'index' is an endpoint of this transfer function.private voidDOCUMENT ME!WildMagic.LibFoundation.Mathematics.Vector2f[]Removes all points from the funcitons.WildMagic.LibFoundation.Mathematics.Vector2fremovePoint(int index) Removes a point in the function at the specified index.voidreplacePoint(float x, float y, int index) Replaces the point at param index with point of params x and y.voidreplacePoint(WildMagic.LibFoundation.Mathematics.Vector2f pt, int index) Replaces the point at param index with point of pt.intsize()Indicated the number of points in the function.toString()intwhichEnd(int index) returns -1 if not an endpoint returns 0 if starting point returns 1 if end pointMethods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneable
nativeClone
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
capacity
private int capacityThe total capacity of the 2D point array. Initial capacity = 10 -
endPtr
private int endPtrPoints to the next available storage location for the point. -
pts
private WildMagic.LibFoundation.Mathematics.Vector2f[] ptsThe array of 2D points that define the line. -
slopes
private float[] slopesThe array of pre-calculated slope values.
-
-
Constructor Details
-
TransferFunction
public TransferFunction()Simple class to hold an array of points that describe a transfer function. -
TransferFunction
Copies the object that extends this class.
-
-
Method Details
-
addPoint
public void addPoint(WildMagic.LibFoundation.Mathematics.Vector2f pt) Adds a point to the function at the end.- Parameters:
pt- DOCUMENT ME!
-
addPoint
public void addPoint(float x, float y) Adds a point to the function at the end.- Parameters:
x- the x coordinate of point to be addedy- the y coordinate of point to be added
-
clone
Copies the object that extends this class.- Overrides:
clonein classModelSerialCloneable- Returns:
- An exact copy of this class.
-
exportArrays
public void exportArrays(float[] x, float[] y) Exports the float arrays of the points of the curve.- Parameters:
x- array of x coordinatesy- array of y coordinates
-
getFunction
public WildMagic.LibFoundation.Mathematics.Vector2f[] getFunction()Gets the points that describe the function.- Returns:
- the 2D point array of floats
-
getPoint
public WildMagic.LibFoundation.Mathematics.Vector2f getPoint(int index) Get the point at the specified index.- Parameters:
index- the index of the point to be returned.- Returns:
- the 2D point
-
getRemappedValue
public final float getRemappedValue(float inputValue, int height) Method to remapped a value using the transfer function.- Parameters:
inputValue- the value to be remappedheight- return range max of the remapped value- Returns:
- the remapped value
-
importArrays
public void importArrays(float[] x, float[] y, int n) Import points into the contour.- Parameters:
x- array of x pointsy- array of y pointsn- number of points in the array
-
insertPoint
public void insertPoint(WildMagic.LibFoundation.Mathematics.Vector2f pt, int index) Inserts a point to the transfer function at the specified index.- Parameters:
pt- the 2D point to be added to the function.index- the index the point is to be inserted.
-
insertPoint
public void insertPoint(float x, float y, int index) Inserts a point to the transfer function at the specified index.- Parameters:
x- the x coordinate of the 2D point to be added to the function.y- the y coordinate of the 2D point to be added to the function.index- the index the point is to be inserted.
-
isEndpoint
public boolean isEndpoint(int index) Decides whether parameter 'index' is an endpoint of this transfer function.- Parameters:
index- int The index to test whether or not it is an endpoint- Returns:
- boolean
-
whichEnd
public int whichEnd(int index) returns -1 if not an endpoint returns 0 if starting point returns 1 if end point- Parameters:
index- The index to test- Returns:
- int
-
removeAll
public WildMagic.LibFoundation.Mathematics.Vector2f[] removeAll()Removes all points from the funcitons. -
removePoint
public WildMagic.LibFoundation.Mathematics.Vector2f removePoint(int index) Removes a point in the function at the specified index.- Parameters:
index- the index where the point is to be removed
-
replacePoint
public void replacePoint(WildMagic.LibFoundation.Mathematics.Vector2f pt, int index) Replaces the point at param index with point of pt.- Parameters:
pt- Vector2f the new pointindex- int the index of the point to be replaced
-
replacePoint
public void replacePoint(float x, float y, int index) Replaces the point at param index with point of params x and y.- Parameters:
x- float the x-coordinate of the new pointy- float the y-coordinate of the new pointindex- int the index of the point to be replaced
-
size
public int size()Indicated the number of points in the function.- Returns:
- the number of points in the function.
-
toString
-
finalize
protected void finalize()Cleans up memory. -
checkSize
private void checkSize()Checks the size of the point array to make sure it is big enough. If not the Points buffer is reallocated to a larger size. -
recalculateSlopes
private void recalculateSlopes()DOCUMENT ME!
-