Programming with Spectral Descriptors

Working with spectral descriptors on a programming level is mainly based on three classes: TSpdc, TSpdcSet and TGridFilter.

TSpdc declares the general structure of spectral descriptors. All the required information which constitutes a spectral descriptor is contained in TSpdc. For IGF (intensity grid filters) descriptors there is a special helper class TGridFilter which is used to manage the IGFs.

As in most cases spectral descriptors are used as part of a set, the class TSpdcSet supports the management of collections of spectral descriptors.

There are two typical scenarios how to work with spectral descriptors: (1) create them interactively using the spectral descriptor editor and then use them in a program which, for example, classifies spectra. In this case the programmatic interaction is mostly restricted to loading sets of spectral descriptors from disk. (2) You can create spectral descriptors directly by a program, for example, in order to create regularly spaced descriptors from templates.

Sample program: Following are a few lines of code showing how to create a set of 10 descriptors calculating the baseline corrected areas of 10 regions regularly spaced across the spectrum.
program CreateSpdcs;

var
  i              : integer;
  wllow, wlhigh  : double;
  wldist         : double;
  grpvon, grpbis : integer;

begin
MData.ObtainGroupSpectralLimits (1, wllow, wlhigh);// get limits of group 1
wldist := (wlhigh - wllow) / 10;
SpdcData.Clear;                                    // clear the current SPDC set
for i:=1 to 10 do
  SpdcData.AddSpdcByParameters (smArea, ctIRspec,  // add 10 ABL descriptors
                0,1,'Caption','','',
                0,0, wllow+(i-1)*wldist, wllow+i*wldist,
                blLinear,5);
end.

Hint: The following video explains the basic ideas behind spectral descriptors.