public class LookupTable
extends java.lang.Object
Constructor and Description |
---|
LookupTable(double[][][] lut,
double[] dims,
double[] step,
int values) |
Modifier and Type | Method and Description |
---|---|
int |
dimension()
Dimensionality of the LUT.
|
double[] |
getValues(double z,
boolean interpolate,
boolean clamp)
Get the value(s) of the LUT at the point z.
|
double[] |
getValues(double y,
double z,
boolean interpolate,
boolean clamp)
Get the value(s) of the LUT at the point y,z.
|
double[] |
getValues(double x,
double y,
double z,
boolean interpolate,
boolean clamp)
Get the value(s) of the LUT at the point x,y.
|
static LookupTable |
readLUT(java.lang.String fileName)
LUT Format: xMin xMax yMin yMax zMin zMax xStep yStep zStep valuesPerPosition .
|
int |
valuesPerPosition()
The length of the array returned by
getValues . |
double |
xMax() |
double |
xMin() |
double |
xStep() |
double |
yMax() |
double |
yMin() |
double |
yStep() |
double |
zMax() |
double |
zMin() |
double |
zStep() |
public LookupTable(double[][][] lut, double[] dims, double[] step, int values)
lut
- the actual data. The lut value at a given x,y,z is lut[(int)(x - xMin) / step][(int)(y - yMin) / step][values * (int)(z - zMin) / step)] for a 3D lut, lut[0][(int)(y - yMin) / step][values * (int)(z - zMin) / step] for 2D, and lut[0][0][values * (int)(z - zMin) / step] for 1D.dims
- {xMin xMax yMin yMax zMin zMax}. Set unused dimensions to zero, eg for a 1D LUT pass {0.0, 0.0, 0.0, 0.0, zMin, zMax}.step
- {xStep yStep zStep}. Follow the same procedure as above for lower dimensions.public double[] getValues(double x, double y, double z, boolean interpolate, boolean clamp) throws OutsideLUTRangeException
x
- the x index of the LUT: zero for 2D LUTs.y
- the y index of the LUT: zero for 1D LUTs.z
- the z index of the LUT.interpolate
- if true, interpolate between positions.clamp
- if true, return max or min value instead of throwing an exception.OutsideLUTRangeException
- if x and y are outside the LUT range, and clamp is false.public double[] getValues(double z, boolean interpolate, boolean clamp) throws OutsideLUTRangeException
interpolate
- if true, interpolate between positions.clamp
- if true, return max or min value instead of throwing an exception.OutsideLUTRangeException
- if the LUT is not 1D, or y is outside of the LUT range.public double[] getValues(double y, double z, boolean interpolate, boolean clamp) throws OutsideLUTRangeException
interpolate
- if true, interpolate between positions.clamp
- if true, return max or min value instead of throwing an exception.OutsideLUTRangeException
- if the LUT is not 2D, or y or z are outside of the LUT range.public double xMin()
public double yMin()
public double xMax()
public double yMax()
public double zMin()
public double zMax()
public double xStep()
public double yStep()
public double zStep()
public int dimension()
public int valuesPerPosition()
getValues
.public static LookupTable readLUT(java.lang.String fileName)