SelectLassoRegion

Declaration: SelectLassoRegion (PosX, PosY: integer; var Layer: integer; ActiveButton: integer; var LassoLine: TPDblArray; var LassoMask: TBool2DArray; Caption: string): integer;
Opens the region selection dialog which allows you to select a region of the image by drawing a lasso line around the region. In order to adjust the image to your needs you can move both the cursor in the spectrum (which changes the displayed layer) and the position cursor in the image (which changes the displayed spectrum). For selecting a region, click the lasso button and draw a free hand line. After releasing the left mouse button the lasso line is closed by connecting the first and the last vertex of the line and the encircled area is converted to a pixel mask which inverts the encircled area. Clicking the OK button then returns the currently selected region and its boundary line.

When calling the dialog the variable PosX, PosY and Layer control the initial spectral display and the image. If PosX and PosY are both set to zero values when calling the function, the spectrum of the center of the image is displayed. If the Layer parameter is set to zero the spectral cursor is set to the center of the spectrum. The parameter ActiveButton determines which button is down when the dialog is displayed: 0 = location cursor, 1 = rectangular selection, 2 = lasso selection.

The parameter Caption controls the caption of the dialog, you may leave it empty to display the default caption "Please select a region". The selected region is returned in two ways: (1) the variable parameter LassoLine contains the world coordinates of the drawn lasso line, (2) the variable parameter LassoMask contains a pixel mask in which those cells are set to TRUE whose corresponding pixel is within the lasso line. The LassoMask is automatically resized to the size of the data cube (MData.SizeX and MData.SizeY). The layer used to display the image in the selection window is returned in the variable parameter Layer.

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
-4 ... invalid ActiveButton parameter


Last Update: 2018-Mai-06