Class ColorUtilities
- java.lang.Object
-
- com.pixelmed.utils.ColorUtilities
-
public class ColorUtilities extends java.lang.Object
Various static methods helpful for color conversions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static float[]
getCIELabFromXYZ(float[] cieXYZ)
Convert CIEXYZ to CIE 1976 L*, a*, b*.static float[]
getCIELabPCSFromIntegerScaledCIELabPCS(int[] cieLabScaled)
Convert 16 bit fractional integer scaled CIELab values used in ICC profiles and DICOM to floating point.static float[]
getCIELabPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to CIELab in ICC PCS.static float[]
getCIEXYZFromLAB(float[] cieLab)
Convert CIE 1976 L*, a*, b* to CIEXYZ.static float[]
getCIEXYZPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to CIEXYZ in ICC PCS.static int[]
getIntegerScaledCIELabFromCIELab(float[] cieLab)
Convert floating point CIELab values to the 16 bit fractional integer scaled representation used in ICC profiles and DICOM.static int[]
getIntegerScaledCIELabPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to 16 bit fractional integer scaled CIELab in ICC PCS.static int[]
getSRGBFromCIELabPCS(float[] cieLab)
Convert CIELab in ICC PCS to RGB values in sRGB.static int[]
getSRGBFromCIEXYZPCS(float[] cieXYZ)
Convert CIEXYZ in ICC PCS to RGB values in sRGB.static int[]
getSRGBFromIntegerScaledCIELabPCS(int[] cieLabScaled)
Convert 16 bit fractional integer scaled CIELab in ICC PCS to RGB values in sRGB.static void
main(java.lang.String[] arg)
Convert color values
-
-
-
Method Detail
-
getIntegerScaledCIELabFromCIELab
public static int[] getIntegerScaledCIELabFromCIELab(float[] cieLab)
Convert floating point CIELab values to the 16 bit fractional integer scaled representation used in ICC profiles and DICOM.
See ICC v4.3 Tables 12 and 13, and DICOM PS 3.3 C.10.7.1.1.
- Parameters:
cieLab
- array of length 3 containing L*,a*,b* values with L* from 0.0 to 100.0, and a* and b* from -128.0 to +127.0 return array of length 3 containing 16 bit scaled L*,a*,b* values from 0 to 65535
-
getCIELabPCSFromIntegerScaledCIELabPCS
public static float[] getCIELabPCSFromIntegerScaledCIELabPCS(int[] cieLabScaled)
Convert 16 bit fractional integer scaled CIELab values used in ICC profiles and DICOM to floating point.
See ICC v4.3 Tables 12 and 13, and DICOM PS 3.3 C.10.7.1.1.
- Parameters:
cieLabScaled
- array of length 3 containing 16 bit scaled L*,a*,b* values from 0 to 65535 return array of length 3 containing L*,a*,b* values with L* from 0.0 to 100.0, and a* and b* from -128.0 to +127.0
-
getCIELabFromXYZ
public static float[] getCIELabFromXYZ(float[] cieXYZ)
Convert CIEXYZ to CIE 1976 L*, a*, b*.
- Parameters:
cieXYZ
- array of length 3 containing X,Y,Z values return array of length 3 containing L*,a*,b* values- See Also:
- Wikipedia CIELAB-CIEXYZ_conversions
-
getCIEXYZFromLAB
public static float[] getCIEXYZFromLAB(float[] cieLab)
Convert CIE 1976 L*, a*, b* to CIEXYZ.
- Parameters:
cieLab
- array of length 3 containing L*,a*,b* values return array of length 3 containing X,Y,Z values- See Also:
- Wikipedia CIELAB-CIEXYZ_conversions
-
getCIEXYZPCSFromSRGB
public static float[] getCIEXYZPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to CIEXYZ in ICC PCS.
SRGB Observer = 2°, Illuminant = D65, XYZ PCS Illuminant = D50.
- Parameters:
rgb
- array of length 3 containing R,G,B values each from 0 to 255 return array of length 3 containing X,Y,Z values- See Also:
- Wikipedia SRGB Reverse Transformation
-
getSRGBFromCIEXYZPCS
public static int[] getSRGBFromCIEXYZPCS(float[] cieXYZ)
Convert CIEXYZ in ICC PCS to RGB values in sRGB.
SRGB Observer = 2°, Illuminant = D65, XYZ PCS Illuminant = D50.
- Parameters:
cieXYZ
- array of length 3 containing X,Y,Z values return array of length 3 containing R,G,B values each from 0 to 255- See Also:
- Wikipedia SRGB Forward Transformation
-
getCIELabPCSFromSRGB
public static float[] getCIELabPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to CIELab in ICC PCS.
- Parameters:
rgb
- array of length 3 containing R,G,B values each from 0 to 255 return array of length 3 containing L*,a*,b* values
-
getIntegerScaledCIELabPCSFromSRGB
public static int[] getIntegerScaledCIELabPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to 16 bit fractional integer scaled CIELab in ICC PCS.
- Parameters:
rgb
- array of length 3 containing R,G,B values each from 0 to 255 return array of length 3 containing L*,a*,b* values each from 0 to 65535
-
getSRGBFromCIELabPCS
public static int[] getSRGBFromCIELabPCS(float[] cieLab)
Convert CIELab in ICC PCS to RGB values in sRGB.
- Parameters:
cieLab
- array of length 3 containing L*,a*,b* values return array of length 3 containing R,G,B values each from 0 to 255
-
getSRGBFromIntegerScaledCIELabPCS
public static int[] getSRGBFromIntegerScaledCIELabPCS(int[] cieLabScaled)
Convert 16 bit fractional integer scaled CIELab in ICC PCS to RGB values in sRGB.
- Parameters:
cieLabScaled
- array of length 3 containing L*,a*,b* values each from 0 to 65535 return array of length 3 containing R,G,B values each from 0 to 255
-
main
public static void main(java.lang.String[] arg)
Convert color values
- Parameters:
arg
- sRGB8toCIELab16 or CIELab16tosRGB8 (case insensitive) and three color values (each decimal or 0xhex)
-
-