RANDBIT

Generate random bitmap sample


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Return Value :: Details :: Example :: References :: Related

Back to top

Description


Generates a bitmap mask that can be used for random sampling. A bitmap is generated with a specified bit density. The bitmap may be based on a subsample of an existing bitmap, or on a sample of the whole image space.
Back to top

Parameters


randbit(file, dbib, dbob, density, dbsn, dbsd)

Name Type Caption Length Value range
FILE * str Input file name 1 -    
DBIB List[int] Input bitmap segment 0 -    
DBOB List[int] Output bitmap segment 0 -    
DENSITY * List[float] Random sampling density (%) 1 - 1 0 - 100
DBSN str Output bitmap segment name 0 -   Default: RANDMASK
DBSD str Output bitmap segment description 0 -    

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the name of the GDB-supported file containing input bitmaps, and to which the output bitmaps will be written.

DBIB

Specifies the image bitmaps to serve as sample masks for the output bitmaps.

Duplicate segments are allowed.

DBOB

Specifies the output bitmap to receive the sample results.

The output bitmap may be the same as the input bitmap; if this parameter is not specified, new bitmap segments are created.

Note: If the input bitmap (DBIB) and output bitmap (DBOB) parameters are defaulted, one output bitmap with the specified DENSITY will be generated.

Duplicate bitmap segments are NOT allowed.

DENSITY

Specifies the density, in percentage, at which to sample the output bitmap mask.

If set to 100 (percent), the output bitmap will be 1 (all pixels on) everywhere the input bitmap is 1 (or everywhere, if there is no input bitmap). If set to 50, approximately half the output bits will be 1.

DBSN

Specifies a name (up to 8 characters) for the output bitmap segment. If this parameter is not specified, the default name RANDMASK is used.

Note: The segment name can be changed using MAS.

DBSD

Describes (in up to 64 characters) the contents or origins of the output neural network segment.

Note: The segment descriptor can be changed using MAS.
Back to top

Return Value

Returns: Last Segments Created

Type:  PCI_INT

Returns the output segments created.

Back to top

Details

RANDBIT generates a mask to be used for random sampling. An output bitmap suitable for use with other "maskable" functions is generated, based on a specified sampling density (DENSITY) and an input bitmap mask (DBIB).

The input bitmap parameter (DBIB) specifies the input masks from which to compute a sub-sample space. If an input bitmap is not provided, the entire image space will be sampled.

Back to top

Example

Generate a sub-sample of the "Water1" training mask from irvine.pix. This can then be used to generate a signature, and the resulting classification can be compared to that generated by the original training mask.

from pci.randbit import randbit

file	=	r"/demo/irvine.pix"
dbib	=	[9]
dbob	=	[]
density	=	[50]
dbsn	=	""
dbsd	=	""

mask	=	randbit(file, dbib, dbob, density, dbsn, dbsd)
Back to top

References

Law & Kelton, "Simulation Modelling and Analysis", P449.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.