Declaration: ProjectSpectrum (MainSpec: TDoubleArray; MainMeta: TMetaData; SpecGrp: integer; OtherSpec: TDoubleArray; OtherMeta: TMetaData; var OutSpec: TDoubleArray; var OutRange1, OutRange2: integer): integer;
The function ProjectSpectrum calculates the intersection of the two spectra MainSpec and OtherSpec and interpolates OtherSpec such that OutSpec is a copy of OtherSpec at the spectral resolution of MainSpec. OutSpec is automatically set to the length of MainSpec, the variable parameters OutRange1 and OutRange2 return the begin and the end of the valid interpolated data. Values outside this range are undefined.

The parameters MainMeta and OtherMeta hold the meta information of the two spectra. The meta information is used to project and interpolate spectral data contained in OtherSpec to OutSpec. The parameter SpecGrp specifies the spectral group to be processed. Please note that the spectral groups of MainSpec and OtherSpec have to belong to the same spectral types and that the spectral types must be continuous spectra (e.g. IR spectra, or UV/VIS spectra, etc).

The function returns the following error codes:
 0 ... everything is OK
-1 ... the two spectra do not overlap
-2 ... this kind of spectra cannot be interpolated
-3 ... spectral group does not exist (either in MainSpec or in OtherSpec)
-4 ... MainSpec does not match the corresponding meta information (MainSpec empty?)
-5 ... OtherSpec does not match the corresponding meta information (OtherSpec empty?)

Example: The following code snippet shows how to read a spectrum from a spectral collection and project it into the spectral space of the currently loaded hypercube:
  SPECCOLLLIB = 'xxxx.scll';   // name of spectral collection
  GRP = 1;                     // spectral group to be projected

  SpColl     : TSpecCollection;
  OtherMeta  : TMetaData;
  MainSpec   : TDoubleArray;
  OutSpec    : TDoubleArray;
  OutRange2  : integer;

OtherMeta := TMetaData.Create(nil);
SpColl := TSpecCollection.Create(nil);
SpColl.Load (SPECCOLLLIB, true);
SpColl.CopyWLSclParsToMetaData(OtherMeta);  // get the calibration of the spectral collection
GetSpectrum (1,1,1, GRP, MainSpec);         // get a spectrum from the hypercube
ProjectSpectrum (MainSpec, MData, GRP,      // interpolate the first spectrum in the collection
                 Spcoll.Items[1].SpectrumAsArray, OtherMeta,
                 OutSpec, OutRange1, OutRange2);