NAME: spec2cie PURPOSE: (one line only) Convert from reflectance spectrum to CIE Chromaticity coordinates DESCRIPTION: Conversion from reflectance spectrum to CIE Chromaticity (D65). The color conversion is based on a Fortran subroutine from A. T. Young, ; SDSU See: http://mintaka.sdsu.edu/GF/explain/optics/color/color.html This routine is designed to let you feed it spectral information that may or may not be encoded against other dimensions (most commonly position) and convert the spectral dimension to its CIE equivalent. CATEGORY: Image display CALLING SEQUENCE: spec2cie,wave,spec,x,y,bigy INPUTS: wave - scalar or vector, wavelengths, in nanometers for spectrum The spectral range of interest is 380-770 nm (visual range) This does not need to be regularly spaced but should be monotonical increasing. spec - Spectrum or spectral image data, this information is expected to be in the range of 0-1 where 1 is perfectly reflecting and 0 is perfectly absorbing. rank(spec) cannot be < rank(wave). Last array index for spec matches the index for wave. OPTIONAL INPUT PARAMETERS: KEYWORD INPUT PARAMETERS: SUBSAMPLE - Allows for finer resolution input spectra to be accurately transformed. The default value is 1 and should work on anything with spectral structure coarser than 10 nm. To properly capture the nuances of your input spectra, divide 10 by the sampling interval of your spectra. Round this number up to the next integer and this is the value you'd give as EXPAND. SHOWSUMMARY - Flag, if set will print and plot information for the scalar case. Ignored for vector or array data. OUTPUTS: x,y - CIE chromaticity, rank is one less than spec. bigy - intensity Note: white is x=0.3127, y=0.3290, bigy=Y=1.0 (z=0.3583 because x+y+z=1) KEYWORD OUTPUT PARAMETERS: COMMON BLOCKS: SIDE EFFECTS: RESTRICTIONS: Sorry, this is not an elegant or general coding solution. This could be more general but I dont' have the time to figure out the IDL syntax to maximize vectorability. This won't be too fast if wave is short and spec is really big. PROCEDURE: The tricky part in using this routine effectively is to understand how the wavelength information is imbedded in the input variables. Consider the simplest possible case, two wavelenths of information and just one points to calculate this for: wave=[450,600] ; two wavelengths, don't have to match end points spec=[0.5,0.6] ; slight red slope will return scalar values for x,y,bigy Another case, same wavelength vector, but now two "scans" spec -> 100x2 array second dimension matches wave vector result x,y,bigy are each 100 elements long Last case, saveme wavelength vector, but now two images spec -> 100x100x2 array third dimension matches wave vector result x,y,bigy are each 100x100 arrays MODIFICATION HISTORY: Written by Marc W. Buie, Southwest Research Institute, 2009/01/05