This task creates a 2D array of subrects based on a specified number of pixels. A subrect is a bounding box used to spatially subset a raster. It is part of a sequence for dicing rasters:

Consider using ENVIDiceRasterByPixel to perform these steps in one task.

Example


; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('CreateSubrectsFromPixels')
 
; Define inputs
Task.NUMBER_OF_X_PIXELS = 250
Task.NUMBER_OF_Y_PIXELS = 350
Task.NCOLUMNS = 1000
Task.NROWS = 1000
 
; Run the task
Task.Execute
 
; Get the resulting subrects
Subrects = Task.SUBRECTS
 
; Get a list of names that could be used for the subrect areas
SubNames = Task.SUBRECT_NAMES
 
; Print information about the subrects
Help, Subrects

IDL prints:

SUBRECTS   LONG   =Array[4, 12]

This shows that 12 subrects were created with four coordinate points each. Now pass the subrects to the DiceRasterBySubrects task:

; Dice raster by subrects
DiceTask = ENVITask('DiceRasterBySubrects')
 
; Define inputs
DiceTask.INPUT_RASTER = Raster
DiceTask.SUBRECT_ARRAY = Subrects
DiceTask.SUBRECT_NAMES = SubNames
 
; Run the task
DiceTask.Execute
 
; Export the rasters to disk
ExportTask = ENVITask('ExportRastersToDirectory')
 
; Define inputs
ExportTask.INPUT_RASTER = DiceTask.OUTPUT_RASTER
ExportTask.OUTPUT_DIRECTORY = Filepath('', /TMP)
 
; Run the task
ExportTask.Execute

Syntax


Result = ENVITask('CreateSubrectsFromPixels')

Input parameters (Set, Get): NCOLUMNS, NROWS, NUMBER_OF_X_PIXELS, NUMBER_OF_Y_PIXELS

Output parameters (Get only): SUBRECTS, SUBRECT_NAMES

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters


NCOLUMNS (required)

Specify the number of columns in the raster.

NROWS (required)

Specify the number of rows in the raster.

NUMBER_OF_X_PIXELS (required)

Specify the number of resulting pixels per tile in the X direction.

NUMBER_OF_Y_PIXELS (required)

Specify the number of resulting pixels per tile in the Y direction.

Output Parameters


SUBRECTS

This parameter contains an array of output subrects.

SUBRECT_NAMES

This parameter contains the names of each output subrect.

Methods


Execute

Parameter

ParameterNames

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History


ENVI 5.4

Introduced

See Also


ENVITask, ENVITask::Parameter, ENVISubsetRaster, CreateSubrectsFromDistance Task, CreateSubrectsFromROI Task, CreateSubrectsFromTileCount Task, CreateSubrectsFromVector Task, DiceRasterByDistance Task, DiceRasterByPixel Task, DiceRasterBySubrects Task, DiceRasterByTileCount Task, DiceRasterByVector Task, ExportRastersToDirectory Task