spec2cie
Author: Graeme Gill

## spectro/spec2cie

### Summary

Convert spectral .ti3 or .sp readings into CIE XYZ and D50 L*a*b* readings. Apply FWA, plot spectrums.
This is assumed to be for a reflective media by default - i.e. that the input .ti3 or .sp file values are spectral reflectances, unless the input is marked as DEVICE_CLASS EMISINPUT (See the description of the .ti3 format. This would have to be done manually, as no ArgyllCMS tools generate such data.)

### Usage

`spec2cie [options] input.[ti3|sp] output.[ti3|sp]
` `-v Verbose mode`
`-I illum Override actual instrument illuminant in .ti3 or .sp file:
A, C, D50, D50M2, D65, F5, F8, F10 or file.sp
(only used in conjunction with -f)
` `-f [illum] Use Fluorescent Whitening Agent compensation [simulated inst. illum.:
M0, M1, M2, A, C, D50 (def.), D50M2, D65, F5, F8, F10 or file.sp]
` `-i illum Choose illuminant for computation of CIE XYZ from spectral data & FWA:
A, C, D50 (def.), D50M2, D65, F5, F8, F10 or file.sp
-o observ Choose CIE Observer for spectral data:
1931_2` `(def.)``, 1964_10, S&B 1955_2, shaw, J&V 1978_2 or file.cmf
-n Don't output spectral values
` `-p Plot each values spectrum``
` `` `input.[ti3|sp] Measurement file
output.[ti3|sp] Converted measurement file`

### Comments

This program takes the (usually reflective) spectral data in a .ti3 or .sp file, converts them to XYZ and D50 L*a*b* and fills the XYZ_[XYZ] and LAB_[LAB] columns in the output .ti3 or .sp file. If the columns XYZ_[XYZ] and/or LAB_[LAB] are missing in the input file, they are added to the output file.
If FWA correction is applied, then the spectra saved will be FWA corrected, as well as the XYZ and D50 L*a*b* values.
All other columns are copied from the input to the output .ti3 or .sp file.
Setting an actual instrument/simulated instrument/CIE illuminant only has an effect for reflective/transmissive spectra. Emissive spectra don't have an illuminant, and will simply be converted to XYZ using the given observer.
The -I parameter allows specifying a an illumination spectrum for the actual instrument illuminant, overriding that computed from the type of instrument (recorded in the .ti3 file). This is rarely used. This parameter is can only be used in combination with the -f flag. If a filename is specified instead, it will be assumed to be an Argyll specific .sp custom spectrum file. Illuminant details are:
A CIE tungsten filament lamp 2848K
D50 CIE daylight 5000K
D65 CIE daylight 6500K
F5 CIE Fluorescent 6350K, CRI 72
F8 CIE Fluorescent 5000K, CRI 95
F10 CIE Fluorescent 5000K, CRI 81
The -f flag enables Fluorescent Whitening Agent (FWA) compensation. This only works if spectral data is available and, the instrument is not UV filtered. FWA compensation adjusts the spectral samples so that they appear to have been measured using an illuminant that has a different level of Ultra Violet to the one the instrument actually used in the measurement. The optional illumination parameter allows specifying a standard or custom illumination spectrum to be used as the similated instrument illuminant, overriding the default D50 or CIE computation illuminant used for FWA (see -i below). See colprof -f for a fuller explanation.
The -i parameter allows specifying a standard or custom illumination spectrum, applied to spectral .ti3 pr .sp data to compute PCS (Profile Connection Space) tristimulus values. A, D50, D65, F5, F8, F10 are a selection of standard illuminant spectrums, with D50 being the default. If a filename is specified instead, it will be assumed to be an Argyll specific .sp custom spectrum file. This only works if spectral data is available. Illuminant details are:
A CIE tungsten filament lamp 2848K
D50 CIE daylight 5000K
D65 CIE daylight 6500K
F5 CIE Fluorescent 6350K, CRI 72
F8 CIE Fluorescent 5000K, CRI 95
F10 CIE Fluorescent 5000K, CRI 81
Custom illuminants are most often used when a viewing booth or other known viewing conditions is going to be used to view results. Other illuminant reference files could be created using a suitable measuring instrument such as a spectrolino, or an eyeone using spotread, although such instruments do not themselves provide the necessary response down to Ultra Violet that is needed for accurate operation of Fluorescent Whitening Agent compensation. The best way of measuring a custom illuminant is to use illumread, since it uses a special method to estimate the illuminant UV in a way that complements FWA compensation. (See the discussion above for the -f flag).
Note that if an illuminant other than D50 is chosen, the resulting ICC profile will not be standard, and may not work perfectly with other profiles that that use the standard ICC D50 illuminant, particularly if the absolute rendering intent is used. Profiles should generally be linked with other profiles that have the same illuminant and observer.
The -o flag allows specifying a tristimulus observer, and is used to compute PCS (Profile Connection Space) tristimulus values. The following choices are available:
1931_2 selects the standard CIE 1931 2 degree observer (the default).
1964_10 selects the standard CIE 1964 10 degree observer.
1955_2 selects the Stiles and Birch 1955 2 degree observer
1978_2 selects the Judd and Voss 1978 2 degree observer
shaw selects the Shaw and Fairchild 1997 2 degree observer
or a .cmf file can be provided as an argument.
Note that if an observer other than 1931 2 degree is chosen, the resulting ICC profile will not be standard, and cannot be freely interchanged with other profiles that that us the standard 1931 2 degree observer. Profiles should only be linked with other profiles that have the same illuminant and observer.
The -n flag disables the output of the spectral values. If just the XYZ and D50 L*a*b* values are needed, this makes for a smaller, easier to read file.
The -p flag causes each spectrum to be plotted. If FWA compensation is used, then the before/after compensation spectruma will be shown.