Declaration: SelectSpectrum(var PosX, PosY, Layer: integer; Caption: string): integer;
Opens the spectrum selection dialog which allows you to select a particular pixel (and a layer) of the image cube. You can move both the cursor in the spectrum (which changes the displayed layer) and the position cursor in the image. When changing the position cursor the corresponding spectrum is displayed in the spectral window at the left. Clicking the OK button selects the current spectrum and layer.

When calling the dialog the variable parameters PosX, PosY and Layer control the initial cursor positions, on return these parameters contain the selected values (pixel coordinates and layer index). If PosX and PosY are both set to zero values when calling the function, the intial position is set to the center of the image. If the Layer parameter is set to zero the spectral cursor is set to the center of the spectrum. The parameter Caption controls the caption of the dialog, you may leave it empty to display the default caption "Please select a spectrum".

The following image shows the spectrum selection dialog:

The function provides the following return codes:

 0 ... everything is OK
-1 ... the initial position [PosX,PosY] is invalid
-2 ... the initial layer is invalid
-3 ... the user cancelled the dialog

Last Update: 2016-Sep-27