Package gov.nih.mipav.model.structures
Class ModelLUT
java.lang.Object
gov.nih.mipav.model.structures.ModelSerialCloneable
gov.nih.mipav.model.structures.ModelStorageBase
gov.nih.mipav.model.structures.ModelLUT
- All Implemented Interfaces:
Serializable,Cloneable
Model of a Lookup Table (LUT). At present, one can construct 10 different LUTs: GRAY, SPECTRUM, HOTMETAL, COOLHOT,
SKIN, STRIPED, RED, GREEN, BLUE, GRAY_BR, and BONE. This class allows the programmer to specify the number of colors
for the LUT. The LUT extents should be 4 x 256 or problems may arise with the differing colormaps (This class can be
extended to handle arbitrary size LUTs but 256 is almost universal). There are 256 locations with alpha, red, green,
and blue values as floats in order to store both RGB or HSI or etc. The LUTs are calculated from the corresponding
transfer functions for each of a, r, g, and b.
- Version:
- 1.0
- Author:
- Matthew J. McAuliffe, Ph.D.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class gov.nih.mipav.model.structures.ModelStorageBase
ModelStorageBase.DataType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TransferFunctionFucntion that attenuates image values.static final intCustomized LUTsstatic final intSets up the transfer function colors to be monochrome-blue.private TransferFunctionFunction that maps the blue function of the LUT.static final intSets up the transfer function to be yellow-ish orange which is supposed to make bones look good.static final intstatic final intSets up the transfer function colors to be cool-hot.static final StringOpens and returns a buffered reader for a given custom LUT name.static final intstatic final intstatic final intSets up the transfer function colors to be gray.static final intSets up the transfer function colors to be gray, with blue in the first location, red in the last location.static final intstatic final intSets up the transfer function colors to be monochrome-green.private TransferFunctionFunction that maps the green function of the LUT.static final intstatic final intstatic final intstatic final intSets up the transfer function colors to be hotmetal.static final intstatic final intprivate int[]Special int array where the LUT is packed with alpha in the most significant byte of the int, followed red, green, and blue.static final intprivate intNumber of colors in the LUT.static final intstatic final intstatic final intstatic final intstatic final intstatic final intSets up the transfer function colors to be monochrome-red.private TransferFunctionFunction that maps the red function of the LUT.private int[]DOCUMENT ME!private static final longUse serialVersionUID for interoperability.static final intSets up the transfer function colors to be skin-colors.static final intstatic final intSets up the transfer function colors to be colours of .static final intstatic final intSets up the transfer function colors to be striped.private TransferFunctionFunction that maps image values into the LUT.private intDOCUMENT ME!static final intstatic final intstatic final intstatic final intprivate float[]The X coordinates of the transfer functions.Fields inherited from class gov.nih.mipav.model.structures.ModelStorageBase
ARGB, ARGB_FLOAT, ARGB_FLOAT_STRING, ARGB_STRING, ARGB_UINTEGER, ARGB_UINTEGER_STRING, ARGB_USHORT, ARGB_USHORT_STRING, BOOLEAN, BOOLEAN_STRING, bufferTypeStr, BYTE, BYTE_STRING, COMPLEX, COMPLEX_STRING, DCOMPLEX, DCOMPLEX_STRING, DOUBLE, DOUBLE_STRING, fileInfo, FLOAT, FLOAT_STRING, INTEGER, INTEGER_STRING, lastMax, lastMin, LINEAR, logMagDisp, LONG, LONG_STRING, NEAREST, RW_LOCKED, SHORT, SHORT_STRING, TAYLOR, UBYTE, UBYTE_STRING, UINTEGER, UINTEGER_STRING, UNLOCKED, USHORT, USHORT_STRING, W_LOCKED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ModelLUTbuildTDistLUT(int dof, double sig, ModelImage image) Build LUT consisting of a student t-distribution at the specified level os significance for the given degrees of freedom.private voidcalcBand(TransferFunction function, float[] band) Calculates the color band (i.e. red, green, blue) for the LUT using the the corresponding transfer functionfinal int[]This is a method to export a special int array where the alpha is stored in the most significant byte, then red, green and blue.final intexportIndexedLUT(int[] arrayLUT) This is a method to export a special int array where the alpha is stored in the most significant byte, then red, green and blue.static voidexportIndexedLUTMin(ModelLUT kLut, byte[] remappedLUTMin) static voidexportIndexedLUTMin(ModelLUT kLut, byte[] remappedLUTMin, int index) static voidexportIndexedLUTMin(ModelRGB kRGBT, byte[] remappedLUTMin) final float[][]exportRGB_LUT(boolean applyAlpha) This is a method to export a 2D float array of the LUT.voidfinalize()Calls disposeLocal of this class to ensure this class nulls the references to global class variables so that memory will be recovered.Accessor that returns the alpha transfer function.Accessor that returns the blue transfer function.getColor(int index) Gets a specific index of the LUT.Accessor that returns the green transfer function.int[]intAccessor to get LUT type.Accessor that returns the red transfer function.Accessor that returns the transfer function.voidInverts the LUT using the values stored in the band arrays and not the transfer functions.voidCreates the R, G, and B transfer functions to produce a blue scale LUT.voidCreates the R, G, and B transfer functions to produce a bone scale LUT.voidCreates the R, G, and B transfer functions to produce a "Cool hot" scale LUT.voidMakes a LUT specifically for viewing CT thigh imagesvoidmakeCustomizedLUT(String name) makeVR with customized LUTvoidCreates the R, G, and B transfer functions to produce a gray scale LUT.voidCreates the R, G, and B transfer functions to produce a gray scale LUT.voidCreates the R, G, and B transfer functions to produce a green scale LUT.voidCreates the R, G, and B transfer functions to produce a spectrum scale LUT.voidmakeIndexedLUT(int[] opacityArray) Special LUT to be used to display java image.voidmakeLUT(int _nColors) This method uses the A, R, G, B transfer functions to build the desired LUT.voidCreates the R, G, and B transfer functions to produce a red scale LUT.voidCreates the R, G, and B transfer functions to produce a skin scale LUT.voidCreates the R, G, and B transfer functions to produce a spectrum scale LUT.voidmakeStripedLUT -voidThe purpose of this method is to adjust the zero index of the LUT from (1, 1, 1) to (0, 0, 0) The reason is so image A and image B are not blended throughout by default.static final BufferedReaderopenLUTFile(String lutName) voidResets the alpha function to be linear.voidresetTransferLine(float min, float max) Resets the transfer function to be linear.voidresetTransferLine(float min, float imgMin, float max, float imgMax) Resets the transfer function to be linear.voidsetColor(int index, int alpha, int red, int green, int blue) Sets a specific index of the LUT with the given color and updates the compressed LUT.voidSets a specific index of the LUT with the given color.voidsetTransferFunction(TransferFunction txFunction) Sets the LUTs transfer function.toString()displays the LUT colours and alpha values in hex.toString(boolean displayInHex, boolean displayAlphaValues) Presents the Lookuptable by.voidThe purpose of this method is to adjust the zero index of the LUT from (0, 0, 0) to (1, 1, 1) The reason is so image A and image B are blended throughout by default.Methods inherited from class gov.nih.mipav.model.structures.ModelStorageBase
addSurfaceMask, allocateData, calcAvgIntenStdDev, calcMinMax, calcMinMax, calcMinMaxMag, calcMinMaxNonZero, clone, computeDataSize, construct, convertToFloat, disposeLocal, export, export, exportComplexData, exportComplexSliceXY, exportData, exportData, exportData, exportData, exportData, exportData, exportData, exportData, exportData, exportData, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDComplexData, exportDiagonal, exportDiagonal, exportDiagonal, exportDMagData, exportMagData, exportMagData, exportRGBData, exportRGBData, exportRGBData, exportRGBData, exportRGBData, exportRGBDataNoLock, exportRGBDataNoLock, exportSliceXY, exportSliceXY, exportSliceXY, exportSliceXY, exportSliceXY, exportSliceXY, findMax, get, get, get, get, get, getAvgInten, getAvgIntenB, getAvgIntenG, getAvgIntenR, getAxisOrientation, getBiLinear, getBoolean, getBoolean, getBoolean, getBoolean, getBoolean, getBufferTypeStr, getByte, getByte, getByte, getByte, getByte, getByteBiLinear, getByteTriLinear, getC, getConvolve, getDataSize, getDataType, getDouble, getDouble, getDouble, getDouble, getDouble, getDoubleBiLinear, getDoubleTriLinear, getExtents, getExtents, getExtents, getExtentsSize, getFileInfo, getFileInfo, getFilterType, getFloat, getFloat, getFloat, getFloat, getFloat, getFloatBiLinear, getFloatC, getFloatC, getFloatC, getFloatTriLinear, getFloatTriLinearBounds, getFloatTriLinearBounds, getFloatTriLinearBoundsTime, getFreq1, getFreq2, getFreqU, getFreqV, getHaveWindowed, getHeight, getImage25D, getImageOrientation, getInt, getInt, getInt, getInt, getInt, getIntBiLinear, getIntTriLinear, getLockStatus, getLogMagDisplay, getLong, getLong, getLong, getLong, getLong, getLongBiLinear, getLongTriLinear, getMax, getMaxA, getMaxB, getMaxG, getMaxR, getMin, getMinA, getMinB, getMinG, getMinR, getNDims, getNoLogMax, getNoLogMin, getNoLogMinNonZero, getNonZeroMax, getNonZeroMaxB, getNonZeroMaxG, getNonZeroMaxR, getNonZeroMin, getNonZeroMinB, getNonZeroMinG, getNonZeroMinR, getNumPixels, getOrigin, getOrigin, getOriginalCropCheckbox, getOriginalDoCrop, getOriginalEnd, getOriginalEpsilon, getOriginalExtents, getOriginalFilterConstruction, getOriginalFilterOrder, getOriginalKernelDimension, getOriginalRs, getOriginalStart, getRadiologicalView, getResolutions, getResolutions, getResolutions, getShort, getShort, getShort, getShort, getShort, getShortBiLinear, getShortTriLinear, getSigmaU, getSigmaV, getSize, getSliceSize, getSmallestMagnitudeNegative, getSmallestMagnitudeNegativeB, getSmallestMagnitudeNegativeG, getSmallestMagnitudeNegativeR, getSmallestMagnitudePositive, getSmallestMagnitudePositiveB, getSmallestMagnitudePositiveG, getSmallestMagnitudePositiveR, getStdDeviation, getStdDeviationB, getStdDeviationG, getStdDeviationR, getSumPixelInten, getSumPixelIntenB, getSumPixelIntenG, getSumPixelIntenR, getSurfaceMask, getSurfaceMaskColor, getTheta, getTriLinear, getType, getTypeMax, getTypeMin, getTypeString, getUByte, getUByte, getUByte, getUByte, getUByte, getUByteBiLinear, getUByteTriLinear, getUInt, getUInt, getUInt, getUInt, getUInt, getUIntBiLinear, getUIntTriLinear, getUnequalDim, getUnitsOfMeasure, getUnitsOfMeasure, getUnitsOfMeasure, getUShort, getUShort, getUShort, getUShort, getUShort, getUShortBiLinear, getUShortTriLinear, getVolumeIterationFactors, getVolumeSize, getWidth, importComplexData, importData, importData, importData, importData, importData, importData, importData, importData, importData, importData, importDComplexData, importRGBData, importRGBData, importRGBData, importUData, importUData, importUData, reallocate, reallocate, reallocate, recomputeDataSize, releaseLock, removeSurfaceMask, removeSurfaceMasks, restoreSurfaceMasks, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setAll, setAll, setAll, setAll, setAll, setAllUByte, setAllUShort, setC, setC, setC, setC, setC, setComplex, setConvolve, setExtents, setFileInfo, setFileInfo, setFilterType, setFreq1, setFreq2, setFreqU, setFreqV, setHaveWindowed, setImage25D, setLock, setLock, setLogMagDisplay, setMax, setMaxB, setMaxG, setMaxR, setMin, setMinB, setMinG, setMinR, setOriginalCropCheckbox, setOriginalDoCrop, setOriginalEnd, setOriginalEpsilon, setOriginalExtents, setOriginalFilterConstruction, setOriginalFilterOrder, setOriginalKernelDimension, setOriginalRs, setOriginalStart, setRadiologicalView, setResolutions, setResolutions, setShort, setShort, setSigmaU, setSigmaV, setTheta, setType, setType, setUByte, setUByte, setUByte, setUByte, setUByte, setUInt, setUInt, setUInt, setUInt, setUInt, setUnequalDim, setUShort, setUShort, setUShort, setUShort, setUShortMethods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneable
nativeClone
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
GRAY
public static final int GRAYSets up the transfer function colors to be gray.- See Also:
-
SPECTRUM
public static final int SPECTRUMSets up the transfer function colors to be colours of .- See Also:
-
HOTMETAL
public static final int HOTMETALSets up the transfer function colors to be hotmetal.- See Also:
-
COOLHOT
public static final int COOLHOTSets up the transfer function colors to be cool-hot.- See Also:
-
SKIN
public static final int SKINSets up the transfer function colors to be skin-colors.- See Also:
-
STRIPED
public static final int STRIPEDSets up the transfer function colors to be striped.- See Also:
-
RED
public static final int REDSets up the transfer function colors to be monochrome-red.- See Also:
-
GREEN
public static final int GREENSets up the transfer function colors to be monochrome-green.- See Also:
-
BLUE
public static final int BLUESets up the transfer function colors to be monochrome-blue.- See Also:
-
GRAY_BR
public static final int GRAY_BRSets up the transfer function colors to be gray, with blue in the first location, red in the last location.- See Also:
-
BONE
public static final int BONESets up the transfer function to be yellow-ish orange which is supposed to make bones look good.- See Also:
-
BlackBody
public static final int BlackBodyCustomized LUTs- See Also:
-
Cardiac
public static final int Cardiac- See Also:
-
Flow
public static final int Flow- See Also:
-
GEcolor
public static final int GEcolor- See Also:
-
GrayRainbow
public static final int GrayRainbow- See Also:
-
HotGreen
public static final int HotGreen- See Also:
-
HotIron
public static final int HotIron- See Also:
-
HotMetal
public static final int HotMetal- See Also:
-
Hue1
public static final int Hue1- See Also:
-
Hue2
public static final int Hue2- See Also:
-
ired
public static final int ired- See Also:
-
NIH
public static final int NIH- See Also:
-
Rainbow
public static final int Rainbow- See Also:
-
Rainbow2
public static final int Rainbow2- See Also:
-
Rainbow3
public static final int Rainbow3- See Also:
-
Ratio
public static final int Ratio- See Also:
-
Spectrum
public static final int Spectrum- See Also:
-
Stern
public static final int Stern- See Also:
-
UCLA
public static final int UCLA- See Also:
-
VR_Bones
public static final int VR_Bones- See Also:
-
VR_Muscles_Bones
public static final int VR_Muscles_Bones- See Also:
-
VR_Red_Vessels
public static final int VR_Red_Vessels- See Also:
-
alphaLine
Fucntion that attenuates image values. -
blueLine
Function that maps the blue function of the LUT. -
greenLine
Function that maps the green function of the LUT. -
indexedLUT
private int[] indexedLUTSpecial int array where the LUT is packed with alpha in the most significant byte of the int, followed red, green, and blue. -
nColors
private int nColorsNumber of colors in the LUT. -
redLine
Function that maps the red function of the LUT. -
remappedLUT
private int[] remappedLUTDOCUMENT ME! -
transferLine
Function that maps image values into the LUT. The x coord. ranges [image.min, image.max]; -
type
private int typeDOCUMENT ME! -
x
private float[] xThe X coordinates of the transfer functions. -
customLUTsLocation
Opens and returns a buffered reader for a given custom LUT name.- See Also:
-
-
Constructor Details
-
ModelLUT
public ModelLUT()Default Constructor. -
ModelLUT
public ModelLUT(int _type, int _nColors, int[] dimExtents) Constructor.- Parameters:
_type- indicates type of lut (ie. GRAY, SPECTRUM ...)_nColors- number of colors defined in LUTdimExtents- array indicating LUT extent in each dimension (e.g. 4x256)
-
-
Method Details
-
finalize
public void finalize()Description copied from class:ModelStorageBaseCalls disposeLocal of this class to ensure this class nulls the references to global class variables so that memory will be recovered.- Overrides:
finalizein classModelStorageBase
-
buildTDistLUT
Build LUT consisting of a student t-distribution at the specified level os significance for the given degrees of freedom.- Parameters:
dof- degrees of freedomsig- level of significanceimage-- Returns:
-
exportIndexedLUT
public final int[] exportIndexedLUT()This is a method to export a special int array where the alpha is stored in the most significant byte, then red, green and blue. Note that the transfer function has been applied to it.- Returns:
- remappedLUT location where indexLUT will be exported to
-
exportIndexedLUTMin
- Parameters:
kLUT- model lutkTransferLine- transfer functioniHeight- lut heightiTable-
-
exportIndexedLUTMin
-
exportIndexedLUTMin
-
exportIndexedLUT
public final int exportIndexedLUT(int[] arrayLUT) This is a method to export a special int array where the alpha is stored in the most significant byte, then red, green and blue. Without the transfer function applied to the LUT- Parameters:
arrayLUT- location where indexLUT will be exported.- Returns:
- int 0 indictes error, and 1 indicates successful completion
-
exportRGB_LUT
public final float[][] exportRGB_LUT(boolean applyAlpha) This is a method to export a 2D float array of the LUT. This method is used by the ViewJComponent show methods to blend between two images.- Parameters:
applyAlpha- flag indicating if the LUT's alpha values should be applied- Returns:
- float returns the RGB LUT a 2D array
-
getAlphaFunction
Accessor that returns the alpha transfer function.- Returns:
- the transfer function that describes how to map the alpha values
-
getBlueFunction
Accessor that returns the blue transfer function.- Returns:
- the transfer function that describes how to map the blue values
-
getColor
Gets a specific index of the LUT.- Parameters:
index- index of the LUT, normally 0-255- Returns:
- LUTcolor color at index
-
getGreenFunction
Accessor that returns the green transfer function.- Returns:
- the transfer function that describes how to map the green values
-
getLUTType
public int getLUTType()Accessor to get LUT type.- Returns:
- LUT type
-
getRedFunction
Accessor that returns the red transfer function.- Returns:
- the transfer function that describes how to map the red values
-
getTransferFunction
Accessor that returns the transfer function.- Returns:
- the transfer function that describes how to remap the image intensities into display values from the LUT.
-
invertLUT
public void invertLUT()Inverts the LUT using the values stored in the band arrays and not the transfer functions. -
makeBlueTransferFunctions
public void makeBlueTransferFunctions()Creates the R, G, and B transfer functions to produce a blue scale LUT. -
makeBoneTransferFunctions
public void makeBoneTransferFunctions()Creates the R, G, and B transfer functions to produce a bone scale LUT. -
makeCoolHotTransferFunctions
public void makeCoolHotTransferFunctions()Creates the R, G, and B transfer functions to produce a "Cool hot" scale LUT. (blue -> pink -> red -> orange -> yellow -> white) -
makeCTThighTransferFunctions
public void makeCTThighTransferFunctions()Makes a LUT specifically for viewing CT thigh images -
makeGrayBRTransferFunctions
public void makeGrayBRTransferFunctions()Creates the R, G, and B transfer functions to produce a gray scale LUT. -
makeGrayTransferFunctions
public void makeGrayTransferFunctions()Creates the R, G, and B transfer functions to produce a gray scale LUT. -
makeGreenTransferFunctions
public void makeGreenTransferFunctions()Creates the R, G, and B transfer functions to produce a green scale LUT. -
makeHotMetalTransferFunctions
public void makeHotMetalTransferFunctions()Creates the R, G, and B transfer functions to produce a spectrum scale LUT. (black -> red -> orange -> yellow -> white) -
makeIndexedLUT
public void makeIndexedLUT(int[] opacityArray) Special LUT to be used to display java image. Assumes RGB values that range between (0 and 255) are stored in the LUT;- Parameters:
opacityArray- DOCUMENT ME!
-
makeLUT
public void makeLUT(int _nColors) This method uses the A, R, G, B transfer functions to build the desired LUT.- Parameters:
_nColors- indicates the number of colors to used in the LUT.
-
makeRedTransferFunctions
public void makeRedTransferFunctions()Creates the R, G, and B transfer functions to produce a red scale LUT. -
makeSkinTransferFunctions
public void makeSkinTransferFunctions()Creates the R, G, and B transfer functions to produce a skin scale LUT. (blue -> pink -> red -> orange -> yellow -> white) -
makeSpectrumTransferFunctions
public void makeSpectrumTransferFunctions()Creates the R, G, and B transfer functions to produce a spectrum scale LUT. (blue -> light blue -> green -> yellow -> orange -> red) -
makeStripedLUT
public void makeStripedLUT()makeStripedLUT - -
makeCustomizedLUT
makeVR with customized LUT -
oneToZeroLUTAdjust
public void oneToZeroLUTAdjust()The purpose of this method is to adjust the zero index of the LUT from (1, 1, 1) to (0, 0, 0) The reason is so image A and image B are not blended throughout by default. -
resetAlphaLine
public void resetAlphaLine()Resets the alpha function to be linear. -
resetTransferLine
public void resetTransferLine(float min, float max) Resets the transfer function to be linear.- Parameters:
min- DOCUMENT ME!max- DOCUMENT ME!
-
resetTransferLine
public void resetTransferLine(float min, float imgMin, float max, float imgMax) Resets the transfer function to be linear.- Parameters:
min- float the minimum for the data range of this image typeimgMin- float the actual minimum data value for the imagemax- float the maximum for the data range of this image typeimgMax- float the actual maximum data value for the image
-
setColor
Sets a specific index of the LUT with the given color.- Parameters:
index- index of the LUT, normally 0-255LUTcolor- color to be placed at the LUT
-
setColor
public void setColor(int index, int alpha, int red, int green, int blue) Sets a specific index of the LUT with the given color and updates the compressed LUT.- Parameters:
index- int index of the LUTalpha- int 0-255 alphared- int 0-255 redgreen- int 0-255 greenblue- int 0-255 blue
-
setTransferFunction
Sets the LUTs transfer function.- Parameters:
txFunction- DOCUMENT ME!
-
toString
displays the LUT colours and alpha values in hex. -
toString
Presents the Lookuptable by.- Parameters:
displayInHex- DOCUMENT ME!displayAlphaValues- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
zeroToOneLUTAdjust
public void zeroToOneLUTAdjust()The purpose of this method is to adjust the zero index of the LUT from (0, 0, 0) to (1, 1, 1) The reason is so image A and image B are blended throughout by default. -
calcBand
Calculates the color band (i.e. red, green, blue) for the LUT using the the corresponding transfer function- Parameters:
function- the band's transfer functionband- storage location after conversion from transfer function to the band
-
getIndexedLUT
public int[] getIndexedLUT() -
openLUTFile
- Throws:
IOException
-